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> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 struct MainFunctionParams; | 98 struct MainFunctionParams; |
99 struct Referrer; | 99 struct Referrer; |
100 struct ShowDesktopNotificationHostMsgParams; | 100 struct ShowDesktopNotificationHostMsgParams; |
101 | 101 |
102 // A mapping from the scheme name to the protocol handler that services its | 102 // A mapping from the scheme name to the protocol handler that services its |
103 // content. | 103 // content. |
104 typedef std::map< | 104 typedef std::map< |
105 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> > | 105 std::string, linked_ptr<net::URLRequestJobFactory::ProtocolHandler> > |
106 ProtocolHandlerMap; | 106 ProtocolHandlerMap; |
107 | 107 |
| 108 // A scoped vector of protocol handlers. |
| 109 typedef ScopedVector<net::URLRequestJobFactory::ProtocolHandler> |
| 110 ProtocolHandlerScopedVector; |
| 111 |
108 // Embedder API (or SPI) for participating in browser logic, to be implemented | 112 // Embedder API (or SPI) for participating in browser logic, to be implemented |
109 // by the client of the content browser. See ChromeContentBrowserClient for the | 113 // by the client of the content browser. See ChromeContentBrowserClient for the |
110 // principal implementation. The methods are assumed to be called on the UI | 114 // principal implementation. The methods are assumed to be called on the UI |
111 // thread unless otherwise specified. Use this "escape hatch" sparingly, to | 115 // thread unless otherwise specified. Use this "escape hatch" sparingly, to |
112 // avoid the embedder interface ballooning and becoming very specific to Chrome. | 116 // avoid the embedder interface ballooning and becoming very specific to Chrome. |
113 // (Often, the call out to the client can happen in a different part of the code | 117 // (Often, the call out to the client can happen in a different part of the code |
114 // that either already has a hook out to the embedder, or calls out to one of | 118 // that either already has a hook out to the embedder, or calls out to one of |
115 // the observer interfaces.) | 119 // the observer interfaces.) |
116 class CONTENT_EXPORT ContentBrowserClient { | 120 class CONTENT_EXPORT ContentBrowserClient { |
117 public: | 121 public: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // and its override of URLDataSource::ShouldServiceRequest. For all schemes | 192 // and its override of URLDataSource::ShouldServiceRequest. For all schemes |
189 // returned here, view-source is allowed. | 193 // returned here, view-source is allowed. |
190 virtual void GetAdditionalWebUISchemes( | 194 virtual void GetAdditionalWebUISchemes( |
191 std::vector<std::string>* additional_schemes) {} | 195 std::vector<std::string>* additional_schemes) {} |
192 | 196 |
193 // Creates the main net::URLRequestContextGetter. Should only be called once | 197 // Creates the main net::URLRequestContextGetter. Should only be called once |
194 // per ContentBrowserClient object. | 198 // per ContentBrowserClient object. |
195 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. | 199 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. |
196 virtual net::URLRequestContextGetter* CreateRequestContext( | 200 virtual net::URLRequestContextGetter* CreateRequestContext( |
197 BrowserContext* browser_context, | 201 BrowserContext* browser_context, |
198 ProtocolHandlerMap* protocol_handlers); | 202 ProtocolHandlerMap* protocol_handlers, |
| 203 ProtocolHandlerScopedVector protocol_interceptors); |
199 | 204 |
200 // Creates the net::URLRequestContextGetter for a StoragePartition. Should | 205 // Creates the net::URLRequestContextGetter for a StoragePartition. Should |
201 // only be called once per partition_path per ContentBrowserClient object. | 206 // only be called once per partition_path per ContentBrowserClient object. |
202 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. | 207 // TODO(ajwong): Remove once http://crbug.com/159193 is resolved. |
203 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | 208 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
204 BrowserContext* browser_context, | 209 BrowserContext* browser_context, |
205 const base::FilePath& partition_path, | 210 const base::FilePath& partition_path, |
206 bool in_memory, | 211 bool in_memory, |
207 ProtocolHandlerMap* protocol_handlers); | 212 ProtocolHandlerMap* protocol_handlers, |
| 213 ProtocolHandlerScopedVector protocol_interceptors); |
208 | 214 |
209 // Returns whether a specified URL is handled by the embedder's internal | 215 // Returns whether a specified URL is handled by the embedder's internal |
210 // protocol handlers. | 216 // protocol handlers. |
211 virtual bool IsHandledURL(const GURL& url); | 217 virtual bool IsHandledURL(const GURL& url); |
212 | 218 |
213 // Returns whether the given process is allowed to commit |url|. This is a | 219 // Returns whether the given process is allowed to commit |url|. This is a |
214 // more conservative check than IsSuitableHost, since it is used after a | 220 // more conservative check than IsSuitableHost, since it is used after a |
215 // navigation has committed to ensure that the process did not exceed its | 221 // navigation has committed to ensure that the process did not exceed its |
216 // authority. | 222 // authority. |
217 virtual bool CanCommitURL(RenderProcessHost* process_host, const GURL& url); | 223 virtual bool CanCommitURL(RenderProcessHost* process_host, const GURL& url); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 content::BrowserContext* browser_context, | 623 content::BrowserContext* browser_context, |
618 const GURL& url); | 624 const GURL& url); |
619 | 625 |
620 // Returns true if dev channel APIs are available for plugins. | 626 // Returns true if dev channel APIs are available for plugins. |
621 virtual bool IsPluginAllowedToUseDevChannelAPIs(); | 627 virtual bool IsPluginAllowedToUseDevChannelAPIs(); |
622 }; | 628 }; |
623 | 629 |
624 } // namespace content | 630 } // namespace content |
625 | 631 |
626 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 632 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
OLD | NEW |