diff options
author | hanxi <hanxi@chromium.org> | 2014-10-09 06:27:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-09 13:27:32 +0000 |
commit | 3328d99286e14e8c31b922c995fb7de7804bba69 (patch) | |
tree | 48663f478ded6b62f3999937e879dddb930cdd4a /content/shell/browser/shell_browser_context.h | |
parent | 3c200fad33da10ca7b7bda1bba471d80ac570649 (diff) | |
download | chromium_src-3328d99286e14e8c31b922c995fb7de7804bba69.zip chromium_src-3328d99286e14e8c31b922c995fb7de7804bba69.tar.gz chromium_src-3328d99286e14e8c31b922c995fb7de7804bba69.tar.bz2 |
Fix bug: AppShell: CHECK failure in PeerConnection init.
The bug was caused due to a missing step to reset the url_request_getter in resource_context_ after initializing a url_request_context_getter in extensions::ShellBrowserContext, refer to CL (https://codereview.chromium.org/615583003/). To fix this bug, a refactor is done in this CL, including:
- ExtensionURLRequestContextGetter was originally implemented in the wrong directory. It's only used by app_shell, hence it belongs in extensions/shell/browser. Rename and move ExtensionURLRequestContextGetter to extensions::ShellURLRequestContextGetter and put it in extensions/shell/browser. Also share code as much as possible with content::ShellURLRequestContextGetter;
- Rename and move ExtensionNetworkDelegate to extensions::ShellNetworkDelegate and live in extensions/shell/browser;
- Reuse content/shell/common/shell_switches.h for kDumpRenderTree.
BUG=420698
Review URL: https://codereview.chromium.org/631203003
Cr-Commit-Position: refs/heads/master@{#298862}
Diffstat (limited to 'content/shell/browser/shell_browser_context.h')
-rw-r--r-- | content/shell/browser/shell_browser_context.h | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/content/shell/browser/shell_browser_context.h b/content/shell/browser/shell_browser_context.h index f015344..81e8b94 100644 --- a/content/shell/browser/shell_browser_context.h +++ b/content/shell/browser/shell_browser_context.h @@ -11,6 +11,8 @@ #include "base/memory/scoped_ptr.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/resource_context.h" +#include "content/shell/browser/shell_url_request_context_getter.h" #include "net/url_request/url_request_job_factory.h" namespace net { @@ -20,9 +22,7 @@ class NetLog; namespace content { class DownloadManagerDelegate; -class ResourceContext; class ShellDownloadManagerDelegate; -class ShellURLRequestContextGetter; class ShellBrowserContext : public BrowserContext { public: @@ -63,8 +63,40 @@ class ShellBrowserContext : public BrowserContext { ProtocolHandlerMap* protocol_handlers, URLRequestInterceptorScopedVector request_interceptors); + protected: + // Contains URLRequestContextGetter required for resource loading. + class ShellResourceContext : public ResourceContext { + public: + ShellResourceContext(); + virtual ~ShellResourceContext(); + + // ResourceContext implementation: + virtual net::HostResolver* GetHostResolver() override; + virtual net::URLRequestContext* GetRequestContext() override; + + void set_url_request_context_getter(ShellURLRequestContextGetter* getter) { + getter_ = getter; + } + + private: + ShellURLRequestContextGetter* getter_; + + DISALLOW_COPY_AND_ASSIGN(ShellResourceContext); + }; + + ShellURLRequestContextGetter* url_request_context_getter() { + return url_request_getter_.get(); + } + + // Used by ShellBrowserContext to initiate and set different types of + // URLRequestContextGetter. + void set_url_request_context_getter(ShellURLRequestContextGetter* getter) { + url_request_getter_ = getter; + } + + scoped_ptr<ShellResourceContext> resource_context_; + private: - class ShellResourceContext; // Performs initialization of the ShellBrowserContext while IO is still // allowed on the current thread. @@ -75,7 +107,6 @@ class ShellBrowserContext : public BrowserContext { bool ignore_certificate_errors_; base::FilePath path_; BrowserPluginGuestManager* guest_manager_; - scoped_ptr<ShellResourceContext> resource_context_; scoped_ptr<ShellDownloadManagerDelegate> download_manager_delegate_; scoped_refptr<ShellURLRequestContextGetter> url_request_getter_; |