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"
|
|
|
|
#include "base/memory/scoped_ptr.h"
|
|
|
|
|
|
|
|
namespace content {
|
|
|
|
class DownloadManagerDelegate;
|
|
|
|
class SpeechRecognitionPreferences;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CefDownloadManagerDelegate;
|
|
|
|
class CefURLRequestContextGetterProxy;
|
|
|
|
|
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:
|
|
|
|
CefBrowserContextProxy(CefRefPtr<CefRequestContextHandler> handler,
|
2015-02-14 00:17:08 +01:00
|
|
|
scoped_refptr<CefBrowserContextImpl> parent);
|
2013-09-03 18:43:31 +02:00
|
|
|
|
2015-09-11 14:14:45 +02:00
|
|
|
// SupportsUserData methods.
|
|
|
|
Data* GetUserData(const void* key) const override;
|
|
|
|
void SetUserData(const void* key, Data* data) override;
|
|
|
|
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;
|
2014-12-13 21:18:31 +01:00
|
|
|
scoped_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
|
|
|
const base::FilePath& partition_path) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
bool IsOffTheRecord() const override;
|
|
|
|
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
|
|
|
net::URLRequestContextGetter* GetRequestContext() override;
|
|
|
|
net::URLRequestContextGetter* GetRequestContextForRenderProcess(
|
|
|
|
int renderer_child_id) override;
|
|
|
|
net::URLRequestContextGetter* GetMediaRequestContext() override;
|
|
|
|
net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
|
|
|
|
int renderer_child_id) override;
|
|
|
|
net::URLRequestContextGetter*
|
2013-09-03 18:43:31 +02:00
|
|
|
GetMediaRequestContextForStoragePartition(
|
|
|
|
const base::FilePath& partition_path,
|
2014-11-12 20:25:15 +01:00
|
|
|
bool in_memory) 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;
|
2013-09-03 18:43:31 +02:00
|
|
|
|
|
|
|
// CefBrowserContext methods.
|
2015-03-02 21:25:14 +01:00
|
|
|
const CefRequestContextSettings& GetSettings() const override;
|
|
|
|
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
2014-11-12 20:25:15 +01:00
|
|
|
net::URLRequestContextGetter* CreateRequestContext(
|
2014-04-04 18:50:38 +02:00
|
|
|
content::ProtocolHandlerMap* protocol_handlers,
|
2014-06-12 22:28:58 +02:00
|
|
|
content::URLRequestInterceptorScopedVector request_interceptors)
|
2014-11-12 20:25:15 +01:00
|
|
|
override;
|
|
|
|
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,
|
2014-06-12 22:28:58 +02:00
|
|
|
content::URLRequestInterceptorScopedVector request_interceptors)
|
2014-11-12 20:25:15 +01:00
|
|
|
override;
|
2013-09-03 18:43:31 +02:00
|
|
|
|
2015-03-02 21:25:14 +01:00
|
|
|
scoped_refptr<CefBrowserContextImpl> parent() const {
|
|
|
|
return parent_;
|
|
|
|
}
|
2013-09-03 18:43:31 +02:00
|
|
|
|
|
|
|
private:
|
2015-02-14 00:17:08 +01:00
|
|
|
// Only allow deletion via scoped_refptr().
|
|
|
|
friend struct content::BrowserThread::DeleteOnThread<
|
|
|
|
content::BrowserThread::UI>;
|
|
|
|
friend class base::DeleteHelper<CefBrowserContextProxy>;
|
|
|
|
|
|
|
|
~CefBrowserContextProxy() override;
|
2013-09-03 18:43:31 +02:00
|
|
|
|
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_;
|
2015-02-14 00:17:08 +01:00
|
|
|
scoped_refptr<CefBrowserContextImpl> parent_;
|
2015-03-02 21:25:14 +01:00
|
|
|
|
2013-09-03 18:43:31 +02:00
|
|
|
scoped_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
|
|
|
|
scoped_refptr<CefURLRequestContextGetterProxy> url_request_getter_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefBrowserContextProxy);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_PROXY_H_
|