| 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 CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ | 5 #ifndef CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ |
| 6 #define CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ | 6 #define CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 virtual bool AllowPepperMediaStreamAPI(const GURL& url) OVERRIDE; | 141 virtual bool AllowPepperMediaStreamAPI(const GURL& url) OVERRIDE; |
| 142 virtual void AddKeySystems( | 142 virtual void AddKeySystems( |
| 143 std::vector<content::KeySystemInfo>* key_systems) OVERRIDE; | 143 std::vector<content::KeySystemInfo>* key_systems) OVERRIDE; |
| 144 virtual bool IsPluginAllowedToUseDevChannelAPIs() OVERRIDE; | 144 virtual bool IsPluginAllowedToUseDevChannelAPIs() OVERRIDE; |
| 145 virtual bool IsPluginAllowedToUseCompositorAPI(const GURL& url) OVERRIDE; | 145 virtual bool IsPluginAllowedToUseCompositorAPI(const GURL& url) OVERRIDE; |
| 146 virtual bool IsPluginAllowedToUseVideoDecodeAPI(const GURL& url) OVERRIDE; | 146 virtual bool IsPluginAllowedToUseVideoDecodeAPI(const GURL& url) OVERRIDE; |
| 147 virtual content::BrowserPluginDelegate* CreateBrowserPluginDelegate( | 147 virtual content::BrowserPluginDelegate* CreateBrowserPluginDelegate( |
| 148 content::RenderFrame* render_frame, | 148 content::RenderFrame* render_frame, |
| 149 const std::string& mime_type) OVERRIDE; | 149 const std::string& mime_type) OVERRIDE; |
| 150 | 150 |
| 151 #if defined(ENABLE_EXTENSIONS) |
| 151 // Takes ownership. | 152 // Takes ownership. |
| 152 void SetExtensionDispatcherForTest( | 153 void SetExtensionDispatcherForTest( |
| 153 extensions::Dispatcher* extension_dispatcher); | 154 extensions::Dispatcher* extension_dispatcher); |
| 154 extensions::Dispatcher* GetExtensionDispatcherForTest(); | 155 extensions::Dispatcher* GetExtensionDispatcherForTest(); |
| 156 #endif |
| 155 | 157 |
| 156 #if defined(ENABLE_SPELLCHECK) | 158 #if defined(ENABLE_SPELLCHECK) |
| 157 // Sets a new |spellcheck|. Used for testing only. | 159 // Sets a new |spellcheck|. Used for testing only. |
| 158 // Takes ownership of |spellcheck|. | 160 // Takes ownership of |spellcheck|. |
| 159 void SetSpellcheck(SpellCheck* spellcheck); | 161 void SetSpellcheck(SpellCheck* spellcheck); |
| 160 #endif | 162 #endif |
| 161 | 163 |
| 162 static blink::WebPlugin* CreatePlugin( | 164 static blink::WebPlugin* CreatePlugin( |
| 163 content::RenderFrame* render_frame, | 165 content::RenderFrame* render_frame, |
| 164 blink::WebLocalFrame* frame, | 166 blink::WebLocalFrame* frame, |
| 165 const blink::WebPluginParams& params, | 167 const blink::WebPluginParams& params, |
| 166 const ChromeViewHostMsg_GetPluginInfo_Output& output); | 168 const ChromeViewHostMsg_GetPluginInfo_Output& output); |
| 167 | 169 |
| 170 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) |
| 168 static bool IsExtensionOrSharedModuleWhitelisted( | 171 static bool IsExtensionOrSharedModuleWhitelisted( |
| 169 const GURL& url, const std::set<std::string>& whitelist); | 172 const GURL& url, const std::set<std::string>& whitelist); |
| 173 #endif |
| 170 | 174 |
| 171 static bool WasWebRequestUsedBySomeExtensions(); | 175 static bool WasWebRequestUsedBySomeExtensions(); |
| 172 | 176 |
| 173 private: | 177 private: |
| 174 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, NaClRestriction); | 178 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, NaClRestriction); |
| 175 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, | 179 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, |
| 176 ShouldSuppressErrorPage); | 180 ShouldSuppressErrorPage); |
| 177 | 181 |
| 182 #if defined(ENABLE_EXTENSIONS) |
| 178 // Gets extension by the given origin, regardless of whether the extension | 183 // Gets extension by the given origin, regardless of whether the extension |
| 179 // is active in the current process. | 184 // is active in the current process. |
| 180 const extensions::Extension* GetExtensionByOrigin( | 185 const extensions::Extension* GetExtensionByOrigin( |
| 181 const blink::WebSecurityOrigin& origin) const; | 186 const blink::WebSecurityOrigin& origin) const; |
| 182 | 187 |
| 183 // Returns true if the frame is navigating to an URL either into or out of an | 188 // Returns true if the frame is navigating to an URL either into or out of an |
| 184 // extension app's extent. | 189 // extension app's extent. |
| 185 bool CrossesExtensionExtents(blink::WebFrame* frame, | 190 bool CrossesExtensionExtents(blink::WebFrame* frame, |
| 186 const GURL& new_url, | 191 const GURL& new_url, |
| 187 const extensions::ExtensionSet& extensions, | 192 const extensions::ExtensionSet& extensions, |
| 188 bool is_extension_url, | 193 bool is_extension_url, |
| 189 bool is_initial_navigation); | 194 bool is_initial_navigation); |
| 195 #endif |
| 190 | 196 |
| 191 static GURL GetNaClContentHandlerURL(const std::string& actual_mime_type, | 197 static GURL GetNaClContentHandlerURL(const std::string& actual_mime_type, |
| 192 const content::WebPluginInfo& plugin); | 198 const content::WebPluginInfo& plugin); |
| 193 | 199 |
| 194 // Determines if a NaCl app is allowed, and modifies params to pass the app's | 200 // Determines if a NaCl app is allowed, and modifies params to pass the app's |
| 195 // permissions to the trusted NaCl plugin. | 201 // permissions to the trusted NaCl plugin. |
| 196 static bool IsNaClAllowed(const GURL& manifest_url, | 202 static bool IsNaClAllowed(const GURL& manifest_url, |
| 197 const GURL& app_url, | 203 const GURL& app_url, |
| 198 bool is_nacl_unrestricted, | 204 bool is_nacl_unrestricted, |
| 199 const extensions::Extension* extension, | 205 const extensions::Extension* extension, |
| 200 blink::WebPluginParams* params); | 206 blink::WebPluginParams* params); |
| 201 | 207 |
| 202 scoped_ptr<ChromeRenderProcessObserver> chrome_observer_; | 208 scoped_ptr<ChromeRenderProcessObserver> chrome_observer_; |
| 203 scoped_ptr<web_cache::WebCacheRenderProcessObserver> web_cache_observer_; | 209 scoped_ptr<web_cache::WebCacheRenderProcessObserver> web_cache_observer_; |
| 210 |
| 211 // TODO(thestig): Extract into a separate file if possible. Cleanup |
| 212 // ENABLE_EXTENSIONS ifdefs in the .cc file as well. |
| 213 #if defined(ENABLE_EXTENSIONS) |
| 204 scoped_ptr<ChromeExtensionsDispatcherDelegate> extension_dispatcher_delegate_; | 214 scoped_ptr<ChromeExtensionsDispatcherDelegate> extension_dispatcher_delegate_; |
| 205 scoped_ptr<extensions::Dispatcher> extension_dispatcher_; | 215 scoped_ptr<extensions::Dispatcher> extension_dispatcher_; |
| 206 scoped_ptr<extensions::RendererPermissionsPolicyDelegate> | 216 scoped_ptr<extensions::RendererPermissionsPolicyDelegate> |
| 207 permissions_policy_delegate_; | 217 permissions_policy_delegate_; |
| 218 #endif |
| 219 |
| 208 scoped_ptr<PrescientNetworkingDispatcher> prescient_networking_dispatcher_; | 220 scoped_ptr<PrescientNetworkingDispatcher> prescient_networking_dispatcher_; |
| 209 scoped_ptr<RendererNetPredictor> net_predictor_; | 221 scoped_ptr<RendererNetPredictor> net_predictor_; |
| 210 scoped_ptr<password_manager::CredentialManagerClient> | 222 scoped_ptr<password_manager::CredentialManagerClient> |
| 211 credential_manager_client_; | 223 credential_manager_client_; |
| 212 #if defined(ENABLE_SPELLCHECK) | 224 #if defined(ENABLE_SPELLCHECK) |
| 213 scoped_ptr<SpellCheck> spellcheck_; | 225 scoped_ptr<SpellCheck> spellcheck_; |
| 214 #endif | 226 #endif |
| 215 scoped_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_; | 227 scoped_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_; |
| 216 scoped_ptr<safe_browsing::PhishingClassifierFilter> phishing_classifier_; | 228 scoped_ptr<safe_browsing::PhishingClassifierFilter> phishing_classifier_; |
| 217 scoped_ptr<prerender::PrerenderDispatcher> prerender_dispatcher_; | 229 scoped_ptr<prerender::PrerenderDispatcher> prerender_dispatcher_; |
| 218 #if defined(ENABLE_WEBRTC) | 230 #if defined(ENABLE_WEBRTC) |
| 219 scoped_refptr<WebRtcLoggingMessageFilter> webrtc_logging_message_filter_; | 231 scoped_refptr<WebRtcLoggingMessageFilter> webrtc_logging_message_filter_; |
| 220 #endif | 232 #endif |
| 221 scoped_ptr<SearchBouncer> search_bouncer_; | 233 scoped_ptr<SearchBouncer> search_bouncer_; |
| 222 #if defined(ENABLE_FULL_PRINTING) | 234 #if defined(ENABLE_FULL_PRINTING) |
| 223 scoped_ptr<ChromePDFPrintClient> pdf_print_client_; | 235 scoped_ptr<ChromePDFPrintClient> pdf_print_client_; |
| 224 #endif | 236 #endif |
| 225 #if defined(ENABLE_PLUGINS) | 237 #if defined(ENABLE_PLUGINS) |
| 226 std::set<std::string> allowed_compositor_origins_; | 238 std::set<std::string> allowed_compositor_origins_; |
| 227 std::set<std::string> allowed_video_decode_origins_; | 239 std::set<std::string> allowed_video_decode_origins_; |
| 228 #endif | 240 #endif |
| 229 }; | 241 }; |
| 230 | 242 |
| 231 #endif // CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ | 243 #endif // CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ |
| OLD | NEW |