Structural improvements for request handling (issue #1044)

- Add new CefRequestContext and CefRequestContextHandler classes.
- Add CefRequestContext argument to CefBrowserHost static factory methods.
- Move GetCookieManager from CefRequestHandler to CefRequestContextHandler.
- Use BrowserContext as the root proxy object for network requests.
- Move accessors for CefBrowserMainParts members from CefContext to CefContentBrowserClient.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1424 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-09-03 16:43:31 +00:00
parent 935a35f21c
commit 385be456c3
57 changed files with 2288 additions and 440 deletions

View File

@@ -12,17 +12,23 @@
#include <string>
#include <utility>
#include "include/cef_request_context_handler.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/content_browser_client.h"
#include "net/proxy/proxy_config_service.h"
#include "net/url_request/url_request_context_getter.h"
#include "url/gurl.h"
class CefBrowserContext;
class CefBrowserInfo;
class CefBrowserMainParts;
class CefDevToolsDelegate;
class CefResourceDispatcherHostDelegate;
class PrefService;
namespace content {
class PluginServiceFilter;
@@ -37,10 +43,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
// Returns the singleton CefContentBrowserClient instance.
static CefContentBrowserClient* Get();
CefBrowserMainParts* browser_main_parts() const {
return browser_main_parts_;
}
// Methods for managing CefBrowserInfo life span. Do not add new callers of
// these methods.
// During popup window creation there is a race between the call to
@@ -56,10 +58,22 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
// Retrieves the CefBrowserInfo matching the specified IDs or an empty
// pointer if no match is found. It is allowed to add new callers of this
// method but consider using CefContext::GetBrowserByRoutingID() instead.
// method but consider using CefBrowserHostImpl::GetBrowserByRoutingID()
// instead.
scoped_refptr<CefBrowserInfo> GetBrowserInfo(int render_process_id,
int render_view_id);
// Create and return a new CefBrowserContextProxy object.
CefBrowserContext* CreateBrowserContextProxy(
CefRefPtr<CefRequestContextHandler> handler);
// BrowserContexts are nominally owned by RenderViewHosts and
// CefRequestContextImpls. Keep track of how many objects reference a given
// context and delete the context when the reference count reaches zero.
void AddBrowserContextReference(CefBrowserContext* context);
void RemoveBrowserContextReference(CefBrowserContext* context);
// ContentBrowserClient implementation.
virtual content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams& parameters) OVERRIDE;
virtual content::WebContentsViewPort* OverrideCreateWebContentsView(
@@ -145,10 +159,15 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
return use_osr_next_contents_view_;
}
private:
CefBrowserContext* CefBrowserContextForBrowserContext(
content::BrowserContext* content_browser_context);
CefBrowserContext* browser_context() const;
scoped_refptr<net::URLRequestContextGetter> request_context() const;
CefDevToolsDelegate* devtools_delegate() const;
PrefService* pref_service() const;
// Passes ownership.
scoped_ptr<net::ProxyConfigService> proxy_config_service() const;
private:
CefBrowserMainParts* browser_main_parts_;
scoped_ptr<content::PluginServiceFilter> plugin_service_filter_;