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_IMPL_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "libcef/browser/browser_context.h"
|
|
|
|
|
2015-02-14 00:17:08 +01:00
|
|
|
#include "libcef/browser/url_request_context_getter_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"
|
2015-03-02 21:25:14 +01:00
|
|
|
#include "chrome/browser/net/pref_proxy_config_tracker.h"
|
2013-09-03 18:43:31 +02:00
|
|
|
|
|
|
|
namespace content {
|
|
|
|
class DownloadManagerDelegate;
|
|
|
|
class SpeechRecognitionPreferences;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CefDownloadManagerDelegate;
|
2015-05-19 19:55:58 +02:00
|
|
|
class CefSSLHostStateDelegate;
|
2013-09-03 18:43:31 +02:00
|
|
|
|
2015-03-02 21:25:14 +01:00
|
|
|
// Isolated BrowserContext implementation. Life span is controlled by
|
|
|
|
// CefRequestContextImpl and (for the main context) CefBrowserMainParts. Only
|
|
|
|
// accessed on the UI thread unless otherwise indicated. See browser_context.h
|
|
|
|
// for an object relationship diagram.
|
2013-09-03 18:43:31 +02:00
|
|
|
class CefBrowserContextImpl : public CefBrowserContext {
|
|
|
|
public:
|
2015-03-02 21:25:14 +01:00
|
|
|
explicit CefBrowserContextImpl(const CefRequestContextSettings& settings);
|
|
|
|
|
|
|
|
// Returns the existing instance, if any, associated with the specified
|
|
|
|
// |cache_path|.
|
|
|
|
static scoped_refptr<CefBrowserContextImpl> GetForCachePath(
|
|
|
|
const base::FilePath& cache_path);
|
|
|
|
|
|
|
|
// Must be called immediately after this object is created.
|
|
|
|
void Initialize();
|
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
|
|
|
bool IsProxy() const override;
|
|
|
|
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
|
|
|
// Guaranteed to exist once this object has been initialized.
|
|
|
|
scoped_refptr<CefURLRequestContextGetterImpl> request_context() const {
|
|
|
|
return url_request_getter_;
|
|
|
|
}
|
|
|
|
|
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<CefBrowserContextImpl>;
|
|
|
|
|
|
|
|
~CefBrowserContextImpl() 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.
|
|
|
|
CefRequestContextSettings settings_;
|
|
|
|
base::FilePath cache_path_;
|
|
|
|
|
|
|
|
scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
|
|
|
|
2013-09-03 18:43:31 +02:00
|
|
|
scoped_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
|
2015-02-14 00:17:08 +01:00
|
|
|
scoped_refptr<CefURLRequestContextGetterImpl> url_request_getter_;
|
2015-04-20 13:11:11 +02:00
|
|
|
scoped_ptr<content::PermissionManager> permission_manager_;
|
2015-05-19 19:55:58 +02:00
|
|
|
scoped_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
|
2013-09-03 18:43:31 +02:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefBrowserContextImpl);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_
|