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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
16 #include "base/memory/linked_ptr.h" | |
17 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
19 #include "base/values.h" | 18 #include "base/values.h" |
20 #include "build/build_config.h" | 19 #include "build/build_config.h" |
21 #include "content/public/browser/certificate_request_result_type.h" | 20 #include "content/public/browser/certificate_request_result_type.h" |
22 #include "content/public/browser/navigation_throttle.h" | 21 #include "content/public/browser/navigation_throttle.h" |
23 #include "content/public/common/content_client.h" | 22 #include "content/public/common/content_client.h" |
24 #include "content/public/common/media_stream_request.h" | 23 #include "content/public/common/media_stream_request.h" |
25 #include "content/public/common/resource_type.h" | 24 #include "content/public/common/resource_type.h" |
26 #include "content/public/common/socket_permission_request.h" | 25 #include "content/public/common/socket_permission_request.h" |
27 #include "content/public/common/window_container_type.h" | 26 #include "content/public/common/window_container_type.h" |
28 #include "net/base/mime_util.h" | 27 #include "net/base/mime_util.h" |
29 #include "net/cookies/canonical_cookie.h" | 28 #include "net/cookies/canonical_cookie.h" |
30 #include "net/url_request/url_request_interceptor.h" | |
31 #include "net/url_request/url_request_job_factory.h" | |
32 #include "storage/browser/fileapi/file_system_context.h" | 29 #include "storage/browser/fileapi/file_system_context.h" |
33 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" | 30 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" |
34 #include "ui/base/window_open_disposition.h" | 31 #include "ui/base/window_open_disposition.h" |
35 | 32 |
36 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 33 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
37 #include "base/posix/global_descriptors.h" | 34 #include "base/posix/global_descriptors.h" |
38 #endif | 35 #endif |
39 | 36 |
40 #if defined(OS_POSIX) | 37 #if defined(OS_POSIX) |
41 #include "content/public/browser/file_descriptor_info.h" | 38 #include "content/public/browser/file_descriptor_info.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 class SiteInstance; | 118 class SiteInstance; |
122 class SpeechRecognitionManagerDelegate; | 119 class SpeechRecognitionManagerDelegate; |
123 class TracingDelegate; | 120 class TracingDelegate; |
124 class WebContents; | 121 class WebContents; |
125 class WebContentsViewDelegate; | 122 class WebContentsViewDelegate; |
126 struct MainFunctionParams; | 123 struct MainFunctionParams; |
127 struct OpenURLParams; | 124 struct OpenURLParams; |
128 struct Referrer; | 125 struct Referrer; |
129 struct WebPreferences; | 126 struct WebPreferences; |
130 | 127 |
131 // A mapping from the scheme name to the protocol handler that services its | |
132 // content. | |
133 typedef std::map< | |
134 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> > | |
135 ProtocolHandlerMap; | |
136 | |
137 // A scoped vector of protocol interceptors. | |
138 typedef ScopedVector<net::URLRequestInterceptor> | |
139 URLRequestInterceptorScopedVector; | |
140 | |
141 // Embedder API (or SPI) for participating in browser logic, to be implemented | 128 // Embedder API (or SPI) for participating in browser logic, to be implemented |
142 // by the client of the content browser. See ChromeContentBrowserClient for the | 129 // by the client of the content browser. See ChromeContentBrowserClient for the |
143 // principal implementation. The methods are assumed to be called on the UI | 130 // principal implementation. The methods are assumed to be called on the UI |
144 // thread unless otherwise specified. Use this "escape hatch" sparingly, to | 131 // thread unless otherwise specified. Use this "escape hatch" sparingly, to |
145 // avoid the embedder interface ballooning and becoming very specific to Chrome. | 132 // avoid the embedder interface ballooning and becoming very specific to Chrome. |
146 // (Often, the call out to the client can happen in a different part of the code | 133 // (Often, the call out to the client can happen in a different part of the code |
147 // that either already has a hook out to the embedder, or calls out to one of | 134 // that either already has a hook out to the embedder, or calls out to one of |
148 // the observer interfaces.) | 135 // the observer interfaces.) |
149 class CONTENT_EXPORT ContentBrowserClient { | 136 class CONTENT_EXPORT ContentBrowserClient { |
150 public: | 137 public: |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // Returns a list of webUI hosts to ignore the storage partition check in | 215 // Returns a list of webUI hosts to ignore the storage partition check in |
229 // URLRequestChromeJob::CheckStoragePartitionMatches. | 216 // URLRequestChromeJob::CheckStoragePartitionMatches. |
230 virtual void GetAdditionalWebUIHostsToIgnoreParititionCheck( | 217 virtual void GetAdditionalWebUIHostsToIgnoreParititionCheck( |
231 std::vector<std::string>* hosts) {} | 218 std::vector<std::string>* hosts) {} |
232 | 219 |
233 // Called when WebUI objects are created to get aggregate usage data (i.e. is | 220 // Called when WebUI objects are created to get aggregate usage data (i.e. is |
234 // chrome://downloads used more than chrome://bookmarks?). Only internal (e.g. | 221 // chrome://downloads used more than chrome://bookmarks?). Only internal (e.g. |
235 // chrome://) URLs are logged. Returns whether the URL was actually logged. | 222 // chrome://) URLs are logged. Returns whether the URL was actually logged. |
236 virtual bool LogWebUIUrl(const GURL& web_ui_url) const; | 223 virtual bool LogWebUIUrl(const GURL& web_ui_url) const; |
237 | 224 |
238 // Creates the main net::URLRequestContextGetter. Should only be called once | |
239 // per ContentBrowserClient object. | |
240 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. | |
241 virtual net::URLRequestContextGetter* CreateRequestContext( | |
242 BrowserContext* browser_context, | |
243 ProtocolHandlerMap* protocol_handlers, | |
244 URLRequestInterceptorScopedVector request_interceptors); | |
245 | |
246 // Creates the net::URLRequestContextGetter for a StoragePartition. Should | |
247 // only be called once per partition_path per ContentBrowserClient object. | |
248 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. | |
249 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | |
250 BrowserContext* browser_context, | |
251 const base::FilePath& partition_path, | |
252 bool in_memory, | |
253 ProtocolHandlerMap* protocol_handlers, | |
254 URLRequestInterceptorScopedVector request_interceptors); | |
255 | |
256 // Returns whether a specified URL is handled by the embedder's internal | 225 // Returns whether a specified URL is handled by the embedder's internal |
257 // protocol handlers. | 226 // protocol handlers. |
258 virtual bool IsHandledURL(const GURL& url); | 227 virtual bool IsHandledURL(const GURL& url); |
259 | 228 |
260 // Returns whether the given process is allowed to commit |url|. This is a | 229 // Returns whether the given process is allowed to commit |url|. This is a |
261 // more conservative check than IsSuitableHost, since it is used after a | 230 // more conservative check than IsSuitableHost, since it is used after a |
262 // navigation has committed to ensure that the process did not exceed its | 231 // navigation has committed to ensure that the process did not exceed its |
263 // authority. | 232 // authority. |
264 // This is called on the UI thread. | 233 // This is called on the UI thread. |
265 virtual bool CanCommitURL(RenderProcessHost* process_host, const GURL& url); | 234 virtual bool CanCommitURL(RenderProcessHost* process_host, const GURL& url); |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 // Allows an embedder to provide its own ExternalVideoSurfaceContainer | 752 // Allows an embedder to provide its own ExternalVideoSurfaceContainer |
784 // implementation. Return nullptr to disable external surface video. | 753 // implementation. Return nullptr to disable external surface video. |
785 virtual ExternalVideoSurfaceContainer* | 754 virtual ExternalVideoSurfaceContainer* |
786 OverrideCreateExternalVideoSurfaceContainer(WebContents* web_contents); | 755 OverrideCreateExternalVideoSurfaceContainer(WebContents* web_contents); |
787 #endif | 756 #endif |
788 }; | 757 }; |
789 | 758 |
790 } // namespace content | 759 } // namespace content |
791 | 760 |
792 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 761 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
OLD | NEW |