chromium/content/browser/content_index/content_index_database.cc

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

#include "content/browser/content_index/content_index_database.h"

#include <optional>
#include <set>
#include <string>
#include <vector>

#include "base/barrier_closure.h"
#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "content/browser/background_fetch/storage/image_helpers.h"
#include "content/browser/content_index/content_index.pb.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/gurl.h"
#include "url/origin.h"

// TODO(crbug.com/40631965): Move image utility functions to common library.
DeserializeIcon;
SerializeIcon;

namespace content {

namespace {

constexpr char kEntryPrefix[] =;
constexpr char kIconPrefix[] =;

std::string EntryKey(const std::string& id) {}

std::string IconsKey(const std::string& id) {}

std::string CreateSerializedContentEntry(
    const blink::mojom::ContentDescription& description,
    const GURL& launch_url,
    base::Time entry_time,
    bool is_top_level_context) {}

blink::mojom::ContentDescriptionPtr DescriptionFromProto(
    const proto::ContentDescription& description) {}

std::optional<ContentIndexEntry> EntryFromSerializedProto(
    int64_t service_worker_registration_id,
    const std::string& serialized_proto) {}

}  // namespace

ContentIndexDatabase::ContentIndexDatabase(
    BrowserContext* browser_context,
    scoped_refptr<ServiceWorkerContextWrapper> service_worker_context)
    :{}

ContentIndexDatabase::~ContentIndexDatabase() = default;

void ContentIndexDatabase::AddEntry(
    int64_t service_worker_registration_id,
    const url::Origin& origin,
    bool is_top_level_context,
    blink::mojom::ContentDescriptionPtr description,
    const std::vector<SkBitmap>& icons,
    const GURL& launch_url,
    blink::mojom::ContentIndexService::AddCallback callback) {}

void ContentIndexDatabase::DidSerializeIcons(
    int64_t service_worker_registration_id,
    const url::Origin& origin,
    bool is_top_level_context,
    blink::mojom::ContentDescriptionPtr description,
    const GURL& launch_url,
    std::unique_ptr<proto::SerializedIcons> serialized_icons,
    blink::mojom::ContentIndexService::AddCallback callback) {}

void ContentIndexDatabase::DidAddEntry(
    blink::mojom::ContentIndexService::AddCallback callback,
    ContentIndexEntry entry,
    blink::ServiceWorkerStatusCode status) {}

void ContentIndexDatabase::DeleteEntry(
    int64_t service_worker_registration_id,
    const url::Origin& origin,
    const std::string& entry_id,
    blink::mojom::ContentIndexService::DeleteCallback callback) {}

void ContentIndexDatabase::DeleteEntryImpl(
    int64_t service_worker_registration_id,
    const url::Origin& origin,
    const std::string& entry_id,
    blink::mojom::ContentIndexService::DeleteCallback callback) {}

void ContentIndexDatabase::DidDeleteEntry(
    int64_t service_worker_registration_id,
    const url::Origin& origin,
    const std::string& entry_id,
    blink::mojom::ContentIndexService::DeleteCallback callback,
    blink::ServiceWorkerStatusCode status) {}

void ContentIndexDatabase::GetDescriptions(
    int64_t service_worker_registration_id,
    const url::Origin& origin,
    blink::mojom::ContentIndexService::GetDescriptionsCallback callback) {}

void ContentIndexDatabase::DidGetDescriptions(
    int64_t service_worker_registration_id,
    blink::mojom::ContentIndexService::GetDescriptionsCallback callback,
    const std::vector<std::string>& data,
    blink::ServiceWorkerStatusCode status) {}

void ContentIndexDatabase::GetIcons(
    int64_t service_worker_registration_id,
    const std::string& description_id,
    ContentIndexContext::GetIconsCallback callback) {}

void ContentIndexDatabase::DidGetSerializedIcons(
    int64_t service_worker_registration_id,
    ContentIndexContext::GetIconsCallback callback,
    const std::vector<std::string>& data,
    blink::ServiceWorkerStatusCode status) {}

void ContentIndexDatabase::DidDeserializeIcons(
    ContentIndexContext::GetIconsCallback callback,
    std::unique_ptr<std::vector<SkBitmap>> icons) {}

void ContentIndexDatabase::GetAllEntries(
    ContentIndexContext::GetAllEntriesCallback callback) {}

void ContentIndexDatabase::DidGetEntries(
    ContentIndexContext::GetAllEntriesCallback callback,
    const std::vector<std::pair<int64_t, std::string>>& user_data,
    blink::ServiceWorkerStatusCode status) {}

void ContentIndexDatabase::GetEntry(
    int64_t service_worker_registration_id,
    const std::string& description_id,
    ContentIndexContext::GetEntryCallback callback) {}

void ContentIndexDatabase::DidGetEntry(
    int64_t service_worker_registration_id,
    ContentIndexContext::GetEntryCallback callback,
    const std::vector<std::string>& data,
    blink::ServiceWorkerStatusCode status) {}

void ContentIndexDatabase::ClearServiceWorkerDataOnCorruption(
    int64_t service_worker_registration_id) {}

void ContentIndexDatabase::DeleteItem(int64_t service_worker_registration_id,
                                      const url::Origin& origin,
                                      const std::string& description_id) {}

void ContentIndexDatabase::DidDeleteItem(
    int64_t service_worker_registration_id,
    const url::Origin& origin,
    const std::string& description_id,
    blink::mojom::ContentIndexError error) {}

void ContentIndexDatabase::StartActiveWorkerForDispatch(
    const std::string& description_id,
    blink::ServiceWorkerStatusCode service_worker_status,
    scoped_refptr<ServiceWorkerRegistration> registration) {}

void ContentIndexDatabase::DeliverMessageToWorker(
    scoped_refptr<ServiceWorkerVersion> service_worker,
    scoped_refptr<ServiceWorkerRegistration> registration,
    const std::string& description_id,
    blink::ServiceWorkerStatusCode service_worker_status) {}

void ContentIndexDatabase::DidDispatchEvent(
    const url::Origin& origin,
    blink::ServiceWorkerStatusCode service_worker_status) {}

void ContentIndexDatabase::BlockOrigin(const url::Origin& origin) {}

void ContentIndexDatabase::UnblockOrigin(const url::Origin& origin) {}

void ContentIndexDatabase::Shutdown() {}

void ContentIndexDatabase::NotifyProviderContentAdded(
    std::vector<ContentIndexEntry> entries) {}

void ContentIndexDatabase::NotifyProviderContentDeleted(
    int64_t service_worker_registration_id,
    const url::Origin& origin,
    const std::string& entry_id) {}

}  // namespace content