Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <map> | |
| 8 #include <string> | 9 #include <string> |
| 9 #include <utility> | 10 #include <utility> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/memory/linked_ptr.h" | |
| 13 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 14 #include "content/public/browser/file_descriptor_info.h" | 16 #include "content/public/browser/file_descriptor_info.h" |
| 15 #include "content/public/common/socket_permission_request.h" | 17 #include "content/public/common/socket_permission_request.h" |
| 16 #include "content/public/common/content_client.h" | 18 #include "content/public/common/content_client.h" |
| 17 #include "content/public/common/window_container_type.h" | 19 #include "content/public/common/window_container_type.h" |
| 18 #include "net/base/mime_util.h" | 20 #include "net/base/mime_util.h" |
| 19 #include "net/cookies/canonical_cookie.h" | 21 #include "net/cookies/canonical_cookie.h" |
| 20 #include "net/url_request/url_request_job_factory.h" | 22 #include "net/url_request/url_request_job_factory.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen ter.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen ter.h" |
| 22 #include "webkit/glue/resource_type.h" | 24 #include "webkit/glue/resource_type.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 46 | 48 |
| 47 namespace net { | 49 namespace net { |
| 48 class CookieOptions; | 50 class CookieOptions; |
| 49 class HttpNetworkSession; | 51 class HttpNetworkSession; |
| 50 class NetLog; | 52 class NetLog; |
| 51 class SSLCertRequestInfo; | 53 class SSLCertRequestInfo; |
| 52 class SSLInfo; | 54 class SSLInfo; |
| 53 class URLRequest; | 55 class URLRequest; |
| 54 class URLRequestContext; | 56 class URLRequestContext; |
| 55 class URLRequestContextGetter; | 57 class URLRequestContextGetter; |
| 58 class URLRequestJobFactoryImpl; | |
| 56 class X509Certificate; | 59 class X509Certificate; |
| 57 } | 60 } |
| 58 | 61 |
| 59 namespace ui { | 62 namespace ui { |
| 60 class SelectFilePolicy; | 63 class SelectFilePolicy; |
| 61 } | 64 } |
| 62 | 65 |
| 63 namespace content { | 66 namespace content { |
| 64 | 67 |
| 65 class AccessTokenStore; | 68 class AccessTokenStore; |
| 66 class BrowserChildProcessHost; | 69 class BrowserChildProcessHost; |
| 67 class BrowserContext; | 70 class BrowserContext; |
| 68 class BrowserMainParts; | 71 class BrowserMainParts; |
| 69 class BrowserPpapiHost; | 72 class BrowserPpapiHost; |
| 70 class BrowserURLHandler; | 73 class BrowserURLHandler; |
| 71 class MediaObserver; | 74 class MediaObserver; |
| 72 class QuotaPermissionContext; | 75 class QuotaPermissionContext; |
| 73 class RenderProcessHost; | 76 class RenderProcessHost; |
| 74 class RenderViewHost; | 77 class RenderViewHost; |
| 75 class RenderViewHostDelegateView; | 78 class RenderViewHostDelegateView; |
| 76 class ResourceContext; | 79 class ResourceContext; |
| 77 class SiteInstance; | 80 class SiteInstance; |
| 78 class SpeechRecognitionManagerDelegate; | 81 class SpeechRecognitionManagerDelegate; |
| 79 class WebContents; | 82 class WebContents; |
| 80 class WebContentsViewDelegate; | 83 class WebContentsViewDelegate; |
| 81 class WebContentsViewPort; | 84 class WebContentsViewPort; |
| 82 struct MainFunctionParams; | 85 struct MainFunctionParams; |
| 83 struct ShowDesktopNotificationHostMsgParams; | 86 struct ShowDesktopNotificationHostMsgParams; |
| 84 | 87 |
| 88 // A mapping from the scheme name to the protocol handler that services its | |
| 89 // content. | |
| 90 typedef std::map< | |
| 91 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> > | |
| 92 ProtocolHandlerMap; | |
| 93 | |
| 85 // Embedder API (or SPI) for participating in browser logic, to be implemented | 94 // Embedder API (or SPI) for participating in browser logic, to be implemented |
| 86 // by the client of the content browser. See ChromeContentBrowserClient for the | 95 // by the client of the content browser. See ChromeContentBrowserClient for the |
| 87 // principal implementation. The methods are assumed to be called on the UI | 96 // principal implementation. The methods are assumed to be called on the UI |
| 88 // thread unless otherwise specified. Use this "escape hatch" sparingly, to | 97 // thread unless otherwise specified. Use this "escape hatch" sparingly, to |
| 89 // avoid the embedder interface ballooning and becoming very specific to Chrome. | 98 // avoid the embedder interface ballooning and becoming very specific to Chrome. |
| 90 // (Often, the call out to the client can happen in a different part of the code | 99 // (Often, the call out to the client can happen in a different part of the code |
| 91 // that either already has a hook out to the embedder, or calls out to one of | 100 // that either already has a hook out to the embedder, or calls out to one of |
| 92 // the observer interfaces.) | 101 // the observer interfaces.) |
| 93 class CONTENT_EXPORT ContentBrowserClient { | 102 class CONTENT_EXPORT ContentBrowserClient { |
| 94 public: | 103 public: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 // Get the effective URL for the given actual URL, to allow an embedder to | 141 // Get the effective URL for the given actual URL, to allow an embedder to |
| 133 // group different url schemes in the same SiteInstance. | 142 // group different url schemes in the same SiteInstance. |
| 134 virtual GURL GetEffectiveURL(BrowserContext* browser_context, | 143 virtual GURL GetEffectiveURL(BrowserContext* browser_context, |
| 135 const GURL& url); | 144 const GURL& url); |
| 136 | 145 |
| 137 // Returns whether all instances of the specified effective URL should be | 146 // Returns whether all instances of the specified effective URL should be |
| 138 // rendered by the same process, rather than using process-per-site-instance. | 147 // rendered by the same process, rather than using process-per-site-instance. |
| 139 virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context, | 148 virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context, |
| 140 const GURL& effective_url); | 149 const GURL& effective_url); |
| 141 | 150 |
| 151 // Returns a list additional WebUI schemes, if any. These additional schemes | |
| 152 // act as aliases to the chrome: scheme. The additional schemes may or may | |
| 153 // not serve specific WebUI pages depending on the particular URLDataSource | |
| 154 // and its override of URLDataSource::ShouldServiceRequest. | |
| 155 virtual std::vector<std::string> GetAdditionalWebUISchemes(); | |
| 156 | |
| 157 // Utility to install additional WebUI handlers into the |job_factory|. | |
| 158 // Ownership of the handlers is transfered from |protocol_handlers| | |
| 159 // to the |job_factory|. | |
| 160 static void InstallProtocolHandlers( | |
|
jam
2013/02/28 02:21:21
nit: we don't really put static methods in this in
dhollowa
2013/02/28 18:21:12
Done. I moved this closer to the call sites. One
| |
| 161 net::URLRequestJobFactoryImpl* job_factory, | |
| 162 content::ProtocolHandlerMap* protocol_handlers); | |
| 163 | |
| 142 // Creates the main net::URLRequestContextGetter. Should only be called once | 164 // Creates the main net::URLRequestContextGetter. Should only be called once |
| 143 // per ContentBrowserClient object. | 165 // per ContentBrowserClient object. |
| 144 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. | 166 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. |
| 145 virtual net::URLRequestContextGetter* CreateRequestContext( | 167 virtual net::URLRequestContextGetter* CreateRequestContext( |
| 146 BrowserContext* browser_context, | 168 BrowserContext* browser_context, |
| 147 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 169 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 148 blob_protocol_handler, | |
| 149 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 150 file_system_protocol_handler, | |
| 151 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 152 developer_protocol_handler, | 170 developer_protocol_handler, |
| 153 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 171 ProtocolHandlerMap* protocol_handlers); |
| 154 chrome_protocol_handler, | |
| 155 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 156 chrome_devtools_protocol_handler); | |
| 157 | 172 |
| 158 // Creates the net::URLRequestContextGetter for a StoragePartition. Should | 173 // Creates the net::URLRequestContextGetter for a StoragePartition. Should |
| 159 // only be called once per partition_path per ContentBrowserClient object. | 174 // only be called once per partition_path per ContentBrowserClient object. |
| 160 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. | 175 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. |
| 161 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | 176 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
| 162 BrowserContext* browser_context, | 177 BrowserContext* browser_context, |
| 163 const base::FilePath& partition_path, | 178 const base::FilePath& partition_path, |
| 164 bool in_memory, | 179 bool in_memory, |
| 165 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 180 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 166 blob_protocol_handler, | |
| 167 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 168 file_system_protocol_handler, | |
| 169 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 170 developer_protocol_handler, | 181 developer_protocol_handler, |
| 171 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 182 ProtocolHandlerMap* protocol_handlers); |
| 172 chrome_protocol_handler, | |
| 173 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 174 chrome_devtools_protocol_handler); | |
| 175 | 183 |
| 176 // Returns whether a specified URL is handled by the embedder's internal | 184 // Returns whether a specified URL is handled by the embedder's internal |
| 177 // protocol handlers. | 185 // protocol handlers. |
| 178 virtual bool IsHandledURL(const GURL& url); | 186 virtual bool IsHandledURL(const GURL& url); |
| 179 | 187 |
| 180 // Returns whether a new view for a given |site_url| can be launched in a | 188 // Returns whether a new view for a given |site_url| can be launched in a |
| 181 // given |process_host|. | 189 // given |process_host|. |
| 182 virtual bool IsSuitableHost(RenderProcessHost* process_host, | 190 virtual bool IsSuitableHost(RenderProcessHost* process_host, |
| 183 const GURL& site_url); | 191 const GURL& site_url); |
| 184 | 192 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 // This is called on a worker thread. | 519 // This is called on a worker thread. |
| 512 virtual | 520 virtual |
| 513 crypto::CryptoModuleBlockingPasswordDelegate* GetCryptoPasswordDelegate( | 521 crypto::CryptoModuleBlockingPasswordDelegate* GetCryptoPasswordDelegate( |
| 514 const GURL& url); | 522 const GURL& url); |
| 515 #endif | 523 #endif |
| 516 }; | 524 }; |
| 517 | 525 |
| 518 } // namespace content | 526 } // namespace content |
| 519 | 527 |
| 520 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 528 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
| OLD | NEW |