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 <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "content/public/browser/certificate_request_result_type.h" | 18 #include "content/public/browser/certificate_request_result_type.h" |
19 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" |
20 #include "content/public/common/socket_permission_request.h" | 20 #include "content/public/common/socket_permission_request.h" |
21 #include "content/public/common/window_container_type.h" | 21 #include "content/public/common/window_container_type.h" |
22 #include "net/base/mime_util.h" | 22 #include "net/base/mime_util.h" |
23 #include "net/cookies/canonical_cookie.h" | 23 #include "net/cookies/canonical_cookie.h" |
24 #include "net/url_request/url_request_interceptor.h" | |
24 #include "net/url_request/url_request_job_factory.h" | 25 #include "net/url_request/url_request_job_factory.h" |
25 #include "third_party/WebKit/public/web/WebNotificationPresenter.h" | 26 #include "third_party/WebKit/public/web/WebNotificationPresenter.h" |
26 #include "ui/base/window_open_disposition.h" | 27 #include "ui/base/window_open_disposition.h" |
27 #include "webkit/browser/fileapi/file_system_context.h" | 28 #include "webkit/browser/fileapi/file_system_context.h" |
28 #include "webkit/common/resource_type.h" | 29 #include "webkit/common/resource_type.h" |
29 | 30 |
30 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 31 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
31 #include "base/posix/global_descriptors.h" | 32 #include "base/posix/global_descriptors.h" |
32 #endif | 33 #endif |
33 | 34 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 struct MainFunctionParams; | 106 struct MainFunctionParams; |
106 struct Referrer; | 107 struct Referrer; |
107 struct ShowDesktopNotificationHostMsgParams; | 108 struct ShowDesktopNotificationHostMsgParams; |
108 | 109 |
109 // A mapping from the scheme name to the protocol handler that services its | 110 // A mapping from the scheme name to the protocol handler that services its |
110 // content. | 111 // content. |
111 typedef std::map< | 112 typedef std::map< |
112 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> > | 113 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> > |
113 ProtocolHandlerMap; | 114 ProtocolHandlerMap; |
114 | 115 |
115 // A scoped vector of protocol handlers. | 116 // A scoped vector of protocol handlers. |
jam
2014/05/30 01:19:15
nit: update comment
mmenke
2014/05/30 14:40:22
Done.
| |
116 typedef ScopedVector<net::URLRequestJobFactory::ProtocolHandler> | 117 typedef ScopedVector<net::URLRequestInterceptor> |
117 ProtocolHandlerScopedVector; | 118 URLRequestInterceptorScopedVector; |
118 | 119 |
119 // Embedder API (or SPI) for participating in browser logic, to be implemented | 120 // Embedder API (or SPI) for participating in browser logic, to be implemented |
120 // by the client of the content browser. See ChromeContentBrowserClient for the | 121 // by the client of the content browser. See ChromeContentBrowserClient for the |
121 // principal implementation. The methods are assumed to be called on the UI | 122 // principal implementation. The methods are assumed to be called on the UI |
122 // thread unless otherwise specified. Use this "escape hatch" sparingly, to | 123 // thread unless otherwise specified. Use this "escape hatch" sparingly, to |
123 // avoid the embedder interface ballooning and becoming very specific to Chrome. | 124 // avoid the embedder interface ballooning and becoming very specific to Chrome. |
124 // (Often, the call out to the client can happen in a different part of the code | 125 // (Often, the call out to the client can happen in a different part of the code |
125 // that either already has a hook out to the embedder, or calls out to one of | 126 // that either already has a hook out to the embedder, or calls out to one of |
126 // the observer interfaces.) | 127 // the observer interfaces.) |
127 class CONTENT_EXPORT ContentBrowserClient { | 128 class CONTENT_EXPORT ContentBrowserClient { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 // URLRequestChromeJob::CheckStoragePartitionMatches. | 199 // URLRequestChromeJob::CheckStoragePartitionMatches. |
199 virtual void GetAdditionalWebUIHostsToIgnoreParititionCheck( | 200 virtual void GetAdditionalWebUIHostsToIgnoreParititionCheck( |
200 std::vector<std::string>* hosts) {} | 201 std::vector<std::string>* hosts) {} |
201 | 202 |
202 // Creates the main net::URLRequestContextGetter. Should only be called once | 203 // Creates the main net::URLRequestContextGetter. Should only be called once |
203 // per ContentBrowserClient object. | 204 // per ContentBrowserClient object. |
204 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. | 205 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. |
205 virtual net::URLRequestContextGetter* CreateRequestContext( | 206 virtual net::URLRequestContextGetter* CreateRequestContext( |
206 BrowserContext* browser_context, | 207 BrowserContext* browser_context, |
207 ProtocolHandlerMap* protocol_handlers, | 208 ProtocolHandlerMap* protocol_handlers, |
208 ProtocolHandlerScopedVector protocol_interceptors); | 209 URLRequestInterceptorScopedVector request_interceptors); |
209 | 210 |
210 // Creates the net::URLRequestContextGetter for a StoragePartition. Should | 211 // Creates the net::URLRequestContextGetter for a StoragePartition. Should |
211 // only be called once per partition_path per ContentBrowserClient object. | 212 // only be called once per partition_path per ContentBrowserClient object. |
212 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. | 213 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. |
213 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | 214 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
214 BrowserContext* browser_context, | 215 BrowserContext* browser_context, |
215 const base::FilePath& partition_path, | 216 const base::FilePath& partition_path, |
216 bool in_memory, | 217 bool in_memory, |
217 ProtocolHandlerMap* protocol_handlers, | 218 ProtocolHandlerMap* protocol_handlers, |
218 ProtocolHandlerScopedVector protocol_interceptors); | 219 URLRequestInterceptorScopedVector request_interceptors); |
219 | 220 |
220 // Returns whether a specified URL is handled by the embedder's internal | 221 // Returns whether a specified URL is handled by the embedder's internal |
221 // protocol handlers. | 222 // protocol handlers. |
222 virtual bool IsHandledURL(const GURL& url); | 223 virtual bool IsHandledURL(const GURL& url); |
223 | 224 |
224 // Returns whether the given process is allowed to commit |url|. This is a | 225 // Returns whether the given process is allowed to commit |url|. This is a |
225 // more conservative check than IsSuitableHost, since it is used after a | 226 // more conservative check than IsSuitableHost, since it is used after a |
226 // navigation has committed to ensure that the process did not exceed its | 227 // navigation has committed to ensure that the process did not exceed its |
227 // authority. | 228 // authority. |
228 virtual bool CanCommitURL(RenderProcessHost* process_host, const GURL& url); | 229 virtual bool CanCommitURL(RenderProcessHost* process_host, const GURL& url); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 // Allows an embedder to provide its own ExternalVideoSurfaceContainer | 642 // Allows an embedder to provide its own ExternalVideoSurfaceContainer |
642 // implementation. Return NULL to disable external surface video. | 643 // implementation. Return NULL to disable external surface video. |
643 virtual ExternalVideoSurfaceContainer* | 644 virtual ExternalVideoSurfaceContainer* |
644 OverrideCreateExternalVideoSurfaceContainer(WebContents* web_contents); | 645 OverrideCreateExternalVideoSurfaceContainer(WebContents* web_contents); |
645 #endif | 646 #endif |
646 }; | 647 }; |
647 | 648 |
648 } // namespace content | 649 } // namespace content |
649 | 650 |
650 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 651 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
OLD | NEW |