chromium/chrome/browser/share/share_history.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/share/share_history.h"

#include "base/containers/flat_map.h"
#include "base/memory/ptr_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/share/proto/share_history_message.pb.h"
#include "components/leveldb_proto/public/proto_database_provider.h"
#include "content/public/browser/storage_partition.h"

#if BUILDFLAG(IS_ANDROID)
#include "base/android/jni_string.h"
#include "chrome/browser/profiles/profile.h"

// Must come after other includes, because FromJniType() uses Profile.
#include "chrome/browser/share/jni_headers/ShareHistoryBridge_jni.h"

using base::android::JavaParamRef;
#endif

namespace sharing {

namespace {

const char* const kShareHistoryFolder =;

// This is the key used for the single entry in the backing LevelDB. The fact
// that it is the same string as the above folder name is a coincidence; please
// do not fold these constants together.
const char* const kShareHistoryKey =;

constexpr auto kMaxHistoryAge =;

int TodaysDay() {}

std::unique_ptr<ShareHistory::BackingDb> MakeDefaultDbForProfile(
    Profile* profile) {}

bool DayOverlapsTimeRange(base::Time day_start,
                          base::Time start,
                          base::Time end) {}

}  // namespace

// static
void ShareHistory::CreateForProfile(Profile* profile) {}

// static
ShareHistory* ShareHistory::Get(Profile* profile) {}

ShareHistory::~ShareHistory() = default;

ShareHistory::ShareHistory() = default;
ShareHistory::ShareHistory(Profile* profile,
                           std::unique_ptr<BackingDb> backing_db)
    :{}

void ShareHistory::AddShareEntry(const std::string& component_name) {}

void ShareHistory::GetFlatShareHistory(GetFlatHistoryCallback callback,
                                       int window) {}

void ShareHistory::Clear(const base::Time& start, const base::Time& end) {}

void ShareHistory::Init() {}

void ShareHistory::OnInitDone(leveldb_proto::Enums::InitStatus status) {}

void ShareHistory::OnInitialReadDone(
    bool ok,
    std::unique_ptr<mojom::ShareHistory> history) {}

void ShareHistory::FlushToBackingDb() {}

mojom::DayShareHistory* ShareHistory::DayShareHistoryForToday() {}

mojom::TargetShareHistory* ShareHistory::TargetShareHistoryByName(
    mojom::DayShareHistory* history,
    const std::string& target_name) {}

}  // namespace sharing

#if BUILDFLAG(IS_ANDROID)
void JNI_ShareHistoryBridge_AddShareEntry(JNIEnv* env,
                                          Profile* profile,
                                          const JavaParamRef<jstring>& name) {
  auto* instance = sharing::ShareHistory::Get(profile);
  if (instance)
    instance->AddShareEntry(base::android::ConvertJavaStringToUTF8(env, name));
}

void JNI_ShareHistoryBridge_Clear(JNIEnv* env, Profile* profile) {
  auto* instance = sharing::ShareHistory::Get(profile);
  if (instance)
    instance->Clear();
}
#endif