chromium/chrome/browser/extensions/api/cookies/cookies_api.cc

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

// Implements the Chrome Extensions Cookies API.

#include "chrome/browser/extensions/api/cookies/cookies_api.h"

#include <memory>
#include <utility>
#include <vector>

#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/time/time.h"
#include "chrome/browser/extensions/api/cookies/cookies_helpers.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/extension_telemetry/cookies_get_all_signal.h"
#include "chrome/browser/safe_browsing/extension_telemetry/cookies_get_signal.h"
#include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service.h"
#include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/extensions/api/cookies.h"
#include "components/safe_browsing/core/common/features.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/stack_frame.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_constants.h"
#include "services/network/public/mojom/network_service.mojom.h"

BrowserThread;

namespace extensions {

namespace {

// Keys
constexpr char kCauseKey[] =;
constexpr char kCookieKey[] =;
constexpr char kRemovedKey[] =;

// Cause Constants
constexpr char kEvictedChangeCause[] =;
constexpr char kExpiredChangeCause[] =;
constexpr char kExpiredOverwriteChangeCause[] =;
constexpr char kExplicitChangeCause[] =;
constexpr char kOverwriteChangeCause[] =;

// Errors
constexpr char kCookieSetFailedError[] =;
constexpr char kInvalidStoreIdError[] =;
constexpr char kInvalidUrlError[] =;
constexpr char kNoHostPermissionsError[] =;

bool ParseUrl(const Extension* extension,
              const std::string& url_string,
              GURL* url,
              bool check_host_permissions,
              std::string* error) {}

network::mojom::CookieManager* ParseStoreCookieManager(
    content::BrowserContext* function_context,
    bool include_incognito,
    std::string* store_id,
    std::string* error) {}

}  // namespace

CookiesEventRouter::CookieChangeListener::CookieChangeListener(
    CookiesEventRouter* router,
    bool otr)
    :{}
CookiesEventRouter::CookieChangeListener::~CookieChangeListener() = default;

void CookiesEventRouter::CookieChangeListener::OnCookieChange(
    const net::CookieChangeInfo& change) {}

CookiesEventRouter::CookiesEventRouter(content::BrowserContext* context)
    :{}

CookiesEventRouter::~CookiesEventRouter() = default;

void CookiesEventRouter::OnCookieChange(bool otr,
                                        const net::CookieChangeInfo& change) {}

void CookiesEventRouter::OnOffTheRecordProfileCreated(Profile* off_the_record) {}

void CookiesEventRouter::MaybeStartListening() {}

void CookiesEventRouter::BindToCookieManager(
    mojo::Receiver<network::mojom::CookieChangeListener>* receiver,
    Profile* profile) {}

void CookiesEventRouter::OnConnectionError(
    mojo::Receiver<network::mojom::CookieChangeListener>* receiver) {}

void CookiesEventRouter::DispatchEvent(content::BrowserContext* context,
                                       events::HistogramValue histogram_value,
                                       const std::string& event_name,
                                       base::Value::List event_args,
                                       const GURL& cookie_domain) {}

CookiesGetFunction::CookiesGetFunction() = default;
CookiesGetFunction::~CookiesGetFunction() = default;

ExtensionFunction::ResponseAction CookiesGetFunction::Run() {}

void CookiesGetFunction::GetCookieListCallback(
    const net::CookieAccessResultList& cookie_list,
    const net::CookieAccessResultList& excluded_cookies) {}

void CookiesGetFunction::NotifyExtensionTelemetry() {}

CookiesGetAllFunction::CookiesGetAllFunction() {}

CookiesGetAllFunction::~CookiesGetAllFunction() {}

ExtensionFunction::ResponseAction CookiesGetAllFunction::Run() {}

void CookiesGetAllFunction::GetAllCookiesCallback(
    const net::CookieList& cookie_list) {}

void CookiesGetAllFunction::GetCookieListCallback(
    const net::CookieAccessResultList& cookie_list,
    const net::CookieAccessResultList& excluded_cookies) {}

void CookiesGetAllFunction::NotifyExtensionTelemetry() {}

CookiesSetFunction::CookiesSetFunction()
    :{}

CookiesSetFunction::~CookiesSetFunction() {}

ExtensionFunction::ResponseAction CookiesSetFunction::Run() {}

void CookiesSetFunction::SetCanonicalCookieCallback(
    net::CookieAccessResult set_cookie_result) {}

void CookiesSetFunction::GetCookieListCallback(
    const net::CookieAccessResultList& cookie_list,
    const net::CookieAccessResultList& excluded_cookies) {}

CookiesRemoveFunction::CookiesRemoveFunction() {}

CookiesRemoveFunction::~CookiesRemoveFunction() {}

ExtensionFunction::ResponseAction CookiesRemoveFunction::Run() {}

void CookiesRemoveFunction::RemoveCookieCallback(uint32_t /* num_deleted */) {}

ExtensionFunction::ResponseAction CookiesGetAllCookieStoresFunction::Run() {}

CookiesAPI::CookiesAPI(content::BrowserContext* context)
    :{}

CookiesAPI::~CookiesAPI() = default;

void CookiesAPI::Shutdown() {}

static base::LazyInstance<BrowserContextKeyedAPIFactory<CookiesAPI>>::
    DestructorAtExit g_cookies_api_factory =;

// static
BrowserContextKeyedAPIFactory<CookiesAPI>* CookiesAPI::GetFactoryInstance() {}

void CookiesAPI::OnListenerAdded(const EventListenerInfo& details) {}

}  // namespace extensions