2013-09-03 18:43:31 +02:00
|
|
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_PROXY_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_PROXY_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "libcef/browser/browser_context.h"
|
2015-02-14 00:17:08 +01:00
|
|
|
#include "libcef/browser/browser_context_impl.h"
|
2013-09-03 18:43:31 +02:00
|
|
|
|
|
|
|
#include "base/files/file_path.h"
|
|
|
|
#include "base/memory/ref_counted.h"
|
|
|
|
|
|
|
|
class CefDownloadManagerDelegate;
|
2016-08-24 11:28:52 +02:00
|
|
|
class CefStoragePartitionProxy;
|
2013-09-03 18:43:31 +02:00
|
|
|
|
2015-02-14 00:17:08 +01:00
|
|
|
// BrowserContext implementation for a particular CefRequestContext. Life span
|
|
|
|
// is controlled by CefRequestContextImpl. Only accessed on the UI thread. See
|
|
|
|
// browser_context.h for an object relationship diagram.
|
2013-09-03 18:43:31 +02:00
|
|
|
class CefBrowserContextProxy : public CefBrowserContext {
|
|
|
|
public:
|
2017-05-04 23:53:27 +02:00
|
|
|
CefBrowserContextProxy(CefRequestContextImpl* const request_context,
|
|
|
|
CefRefPtr<CefRequestContextHandler> handler,
|
2017-02-14 23:27:19 +01:00
|
|
|
CefBrowserContextImpl* parent);
|
2013-09-03 18:43:31 +02:00
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
// Must be called immediately after this object is created.
|
|
|
|
void Initialize() override;
|
|
|
|
|
2015-09-11 14:14:45 +02:00
|
|
|
// SupportsUserData methods.
|
|
|
|
Data* GetUserData(const void* key) const override;
|
2017-03-03 23:37:23 +01:00
|
|
|
void SetUserData(const void* key, std::unique_ptr<Data> data) override;
|
2015-09-11 14:14:45 +02:00
|
|
|
void RemoveUserData(const void* key) override;
|
|
|
|
|
2013-09-03 18:43:31 +02:00
|
|
|
// BrowserContext methods.
|
2014-11-12 20:25:15 +01:00
|
|
|
base::FilePath GetPath() const override;
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
2014-12-13 21:18:31 +01:00
|
|
|
const base::FilePath& partition_path) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
bool IsOffTheRecord() const override;
|
|
|
|
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
|
|
|
content::BrowserPluginGuestManager* GetGuestManager() override;
|
|
|
|
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
|
|
|
content::PushMessagingService* GetPushMessagingService() override;
|
|
|
|
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
2015-04-20 13:11:11 +02:00
|
|
|
content::PermissionManager* GetPermissionManager() override;
|
2015-11-10 21:18:16 +01:00
|
|
|
content::BackgroundSyncController* GetBackgroundSyncController() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
net::URLRequestContextGetter* CreateRequestContext(
|
2014-04-04 18:50:38 +02:00
|
|
|
content::ProtocolHandlerMap* protocol_handlers,
|
2017-05-17 11:29:28 +02:00
|
|
|
content::URLRequestInterceptorScopedVector request_interceptors) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
|
2013-09-03 18:43:31 +02:00
|
|
|
const base::FilePath& partition_path,
|
|
|
|
bool in_memory,
|
2014-04-04 18:50:38 +02:00
|
|
|
content::ProtocolHandlerMap* protocol_handlers,
|
2017-05-17 11:29:28 +02:00
|
|
|
content::URLRequestInterceptorScopedVector request_interceptors) override;
|
2017-04-20 21:28:17 +02:00
|
|
|
void RegisterInProcessServices(StaticServiceMap* services) override;
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
// Profile methods.
|
|
|
|
PrefService* GetPrefs() override;
|
|
|
|
const PrefService* GetPrefs() const override;
|
|
|
|
|
|
|
|
// CefBrowserContext methods.
|
2017-05-04 23:53:27 +02:00
|
|
|
CefRequestContextImpl* GetCefRequestContext() const override;
|
2016-08-24 11:28:52 +02:00
|
|
|
const CefRequestContextSettings& GetSettings() const override;
|
|
|
|
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
2015-09-09 16:05:39 +02:00
|
|
|
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
2016-01-12 01:19:51 +01:00
|
|
|
void AddVisitedURLs(const std::vector<GURL>& urls) override;
|
2013-09-03 18:43:31 +02:00
|
|
|
|
2016-08-24 11:28:52 +02:00
|
|
|
content::StoragePartition* GetOrCreateStoragePartitionProxy(
|
2017-05-17 11:29:28 +02:00
|
|
|
content::StoragePartition* partition_impl);
|
2016-08-24 11:28:52 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
CefBrowserContextImpl* parent() const { return parent_; }
|
2013-09-03 18:43:31 +02:00
|
|
|
|
|
|
|
private:
|
2017-02-14 23:27:19 +01:00
|
|
|
// Allow deletion via std::unique_ptr() only.
|
|
|
|
friend std::default_delete<CefBrowserContextProxy>;
|
2015-02-14 00:17:08 +01:00
|
|
|
|
|
|
|
~CefBrowserContextProxy() override;
|
2013-09-03 18:43:31 +02:00
|
|
|
|
2017-05-04 23:53:27 +02:00
|
|
|
// Guaranteed to outlive this object.
|
|
|
|
CefRequestContextImpl* const request_context_;
|
|
|
|
|
2015-03-02 21:25:14 +01:00
|
|
|
// Members initialized during construction are safe to access from any thread.
|
2013-09-03 18:43:31 +02:00
|
|
|
CefRefPtr<CefRequestContextHandler> handler_;
|
2017-02-14 23:27:19 +01:00
|
|
|
CefBrowserContextImpl* parent_; // Guaranteed to outlive this object.
|
2015-03-02 21:25:14 +01:00
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
|
2016-08-24 11:28:52 +02:00
|
|
|
std::unique_ptr<CefStoragePartitionProxy> storage_partition_proxy_;
|
2013-09-03 18:43:31 +02:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefBrowserContextProxy);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_PROXY_H_
|