| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 namespace safe_browsing { | 46 namespace safe_browsing { |
| 47 class PhishingClassifierFilter; | 47 class PhishingClassifierFilter; |
| 48 } | 48 } |
| 49 | 49 |
| 50 namespace visitedlink { | 50 namespace visitedlink { |
| 51 class VisitedLinkSlave; | 51 class VisitedLinkSlave; |
| 52 } | 52 } |
| 53 | 53 |
| 54 namespace WebKit { | 54 namespace blink { |
| 55 class WebSecurityOrigin; | 55 class WebSecurityOrigin; |
| 56 } | 56 } |
| 57 | 57 |
| 58 #if defined(ENABLE_WEBRTC) | 58 #if defined(ENABLE_WEBRTC) |
| 59 class WebRtcLoggingMessageFilter; | 59 class WebRtcLoggingMessageFilter; |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 class ChromeContentRendererClient : public content::ContentRendererClient { | 62 class ChromeContentRendererClient : public content::ContentRendererClient { |
| 63 public: | 63 public: |
| 64 ChromeContentRendererClient(); | 64 ChromeContentRendererClient(); |
| 65 virtual ~ChromeContentRendererClient(); | 65 virtual ~ChromeContentRendererClient(); |
| 66 | 66 |
| 67 virtual void RenderThreadStarted() OVERRIDE; | 67 virtual void RenderThreadStarted() OVERRIDE; |
| 68 virtual void RenderViewCreated(content::RenderView* render_view) OVERRIDE; | 68 virtual void RenderViewCreated(content::RenderView* render_view) OVERRIDE; |
| 69 virtual void SetNumberOfViews(int number_of_views) OVERRIDE; | 69 virtual void SetNumberOfViews(int number_of_views) OVERRIDE; |
| 70 virtual SkBitmap* GetSadPluginBitmap() OVERRIDE; | 70 virtual SkBitmap* GetSadPluginBitmap() OVERRIDE; |
| 71 virtual SkBitmap* GetSadWebViewBitmap() OVERRIDE; | 71 virtual SkBitmap* GetSadWebViewBitmap() OVERRIDE; |
| 72 virtual std::string GetDefaultEncoding() OVERRIDE; | 72 virtual std::string GetDefaultEncoding() OVERRIDE; |
| 73 virtual bool OverrideCreatePlugin( | 73 virtual bool OverrideCreatePlugin( |
| 74 content::RenderView* render_view, | 74 content::RenderView* render_view, |
| 75 WebKit::WebFrame* frame, | 75 blink::WebFrame* frame, |
| 76 const WebKit::WebPluginParams& params, | 76 const blink::WebPluginParams& params, |
| 77 WebKit::WebPlugin** plugin) OVERRIDE; | 77 blink::WebPlugin** plugin) OVERRIDE; |
| 78 virtual WebKit::WebPlugin* CreatePluginReplacement( | 78 virtual blink::WebPlugin* CreatePluginReplacement( |
| 79 content::RenderView* render_view, | 79 content::RenderView* render_view, |
| 80 const base::FilePath& plugin_path) OVERRIDE; | 80 const base::FilePath& plugin_path) OVERRIDE; |
| 81 virtual bool HasErrorPage(int http_status_code, | 81 virtual bool HasErrorPage(int http_status_code, |
| 82 std::string* error_domain) OVERRIDE; | 82 std::string* error_domain) OVERRIDE; |
| 83 virtual bool ShouldSuppressErrorPage(const GURL& url) OVERRIDE; | 83 virtual bool ShouldSuppressErrorPage(const GURL& url) OVERRIDE; |
| 84 virtual void GetNavigationErrorStrings( | 84 virtual void GetNavigationErrorStrings( |
| 85 WebKit::WebFrame* frame, | 85 blink::WebFrame* frame, |
| 86 const WebKit::WebURLRequest& failed_request, | 86 const blink::WebURLRequest& failed_request, |
| 87 const WebKit::WebURLError& error, | 87 const blink::WebURLError& error, |
| 88 const std::string& accept_languages, | 88 const std::string& accept_languages, |
| 89 std::string* error_html, | 89 std::string* error_html, |
| 90 string16* error_description) OVERRIDE; | 90 string16* error_description) OVERRIDE; |
| 91 virtual void DeferMediaLoad(content::RenderView* render_view, | 91 virtual void DeferMediaLoad(content::RenderView* render_view, |
| 92 const base::Closure& closure) OVERRIDE; | 92 const base::Closure& closure) OVERRIDE; |
| 93 virtual bool RunIdleHandlerWhenWidgetsHidden() OVERRIDE; | 93 virtual bool RunIdleHandlerWhenWidgetsHidden() OVERRIDE; |
| 94 virtual bool AllowPopup() OVERRIDE; | 94 virtual bool AllowPopup() OVERRIDE; |
| 95 virtual bool ShouldFork(WebKit::WebFrame* frame, | 95 virtual bool ShouldFork(blink::WebFrame* frame, |
| 96 const GURL& url, | 96 const GURL& url, |
| 97 const std::string& http_method, | 97 const std::string& http_method, |
| 98 bool is_initial_navigation, | 98 bool is_initial_navigation, |
| 99 bool is_server_redirect, | 99 bool is_server_redirect, |
| 100 bool* send_referrer) OVERRIDE; | 100 bool* send_referrer) OVERRIDE; |
| 101 virtual bool WillSendRequest(WebKit::WebFrame* frame, | 101 virtual bool WillSendRequest(blink::WebFrame* frame, |
| 102 content::PageTransition transition_type, | 102 content::PageTransition transition_type, |
| 103 const GURL& url, | 103 const GURL& url, |
| 104 const GURL& first_party_for_cookies, | 104 const GURL& first_party_for_cookies, |
| 105 GURL* new_url) OVERRIDE; | 105 GURL* new_url) OVERRIDE; |
| 106 virtual bool ShouldPumpEventsDuringCookieMessage() OVERRIDE; | 106 virtual bool ShouldPumpEventsDuringCookieMessage() OVERRIDE; |
| 107 virtual void DidCreateScriptContext(WebKit::WebFrame* frame, | 107 virtual void DidCreateScriptContext(blink::WebFrame* frame, |
| 108 v8::Handle<v8::Context> context, | 108 v8::Handle<v8::Context> context, |
| 109 int extension_group, | 109 int extension_group, |
| 110 int world_id) OVERRIDE; | 110 int world_id) OVERRIDE; |
| 111 virtual void WillReleaseScriptContext(WebKit::WebFrame* frame, | 111 virtual void WillReleaseScriptContext(blink::WebFrame* frame, |
| 112 v8::Handle<v8::Context> context, | 112 v8::Handle<v8::Context> context, |
| 113 int world_id) OVERRIDE; | 113 int world_id) OVERRIDE; |
| 114 virtual unsigned long long VisitedLinkHash(const char* canonical_url, | 114 virtual unsigned long long VisitedLinkHash(const char* canonical_url, |
| 115 size_t length) OVERRIDE; | 115 size_t length) OVERRIDE; |
| 116 virtual bool IsLinkVisited(unsigned long long link_hash) OVERRIDE; | 116 virtual bool IsLinkVisited(unsigned long long link_hash) OVERRIDE; |
| 117 virtual WebKit::WebPrescientNetworking* GetPrescientNetworking() OVERRIDE; | 117 virtual blink::WebPrescientNetworking* GetPrescientNetworking() OVERRIDE; |
| 118 virtual bool ShouldOverridePageVisibilityState( | 118 virtual bool ShouldOverridePageVisibilityState( |
| 119 const content::RenderView* render_view, | 119 const content::RenderView* render_view, |
| 120 WebKit::WebPageVisibilityState* override_state) OVERRIDE; | 120 blink::WebPageVisibilityState* override_state) OVERRIDE; |
| 121 virtual bool HandleGetCookieRequest(content::RenderView* sender, | 121 virtual bool HandleGetCookieRequest(content::RenderView* sender, |
| 122 const GURL& url, | 122 const GURL& url, |
| 123 const GURL& first_party_for_cookies, | 123 const GURL& first_party_for_cookies, |
| 124 std::string* cookies) OVERRIDE; | 124 std::string* cookies) OVERRIDE; |
| 125 virtual bool HandleSetCookieRequest(content::RenderView* sender, | 125 virtual bool HandleSetCookieRequest(content::RenderView* sender, |
| 126 const GURL& url, | 126 const GURL& url, |
| 127 const GURL& first_party_for_cookies, | 127 const GURL& first_party_for_cookies, |
| 128 const std::string& value) OVERRIDE; | 128 const std::string& value) OVERRIDE; |
| 129 virtual bool AllowBrowserPlugin( | 129 virtual bool AllowBrowserPlugin( |
| 130 WebKit::WebPluginContainer* container) OVERRIDE; | 130 blink::WebPluginContainer* container) OVERRIDE; |
| 131 virtual const void* CreatePPAPIInterface( | 131 virtual const void* CreatePPAPIInterface( |
| 132 const std::string& interface_name) OVERRIDE; | 132 const std::string& interface_name) OVERRIDE; |
| 133 virtual bool IsExternalPepperPlugin(const std::string& module_name) OVERRIDE; | 133 virtual bool IsExternalPepperPlugin(const std::string& module_name) OVERRIDE; |
| 134 // TODO(victorhsieh): move to ChromeContentBrowserClient once we migrate | 134 // TODO(victorhsieh): move to ChromeContentBrowserClient once we migrate |
| 135 // PPAPI FileIO host to browser. | 135 // PPAPI FileIO host to browser. |
| 136 virtual bool IsPluginAllowedToCallRequestOSFileHandle( | 136 virtual bool IsPluginAllowedToCallRequestOSFileHandle( |
| 137 WebKit::WebPluginContainer* container) OVERRIDE; | 137 blink::WebPluginContainer* container) OVERRIDE; |
| 138 virtual WebKit::WebSpeechSynthesizer* OverrideSpeechSynthesizer( | 138 virtual blink::WebSpeechSynthesizer* OverrideSpeechSynthesizer( |
| 139 WebKit::WebSpeechSynthesizerClient* client) OVERRIDE; | 139 blink::WebSpeechSynthesizerClient* client) OVERRIDE; |
| 140 virtual bool ShouldReportDetailedMessageForSource( | 140 virtual bool ShouldReportDetailedMessageForSource( |
| 141 const base::string16& source) const OVERRIDE; | 141 const base::string16& source) const OVERRIDE; |
| 142 virtual bool ShouldEnableSiteIsolationPolicy() const OVERRIDE; | 142 virtual bool ShouldEnableSiteIsolationPolicy() const OVERRIDE; |
| 143 virtual WebKit::WebWorkerPermissionClientProxy* | 143 virtual blink::WebWorkerPermissionClientProxy* |
| 144 CreateWorkerPermissionClientProxy(content::RenderView* render_view, | 144 CreateWorkerPermissionClientProxy(content::RenderView* render_view, |
| 145 WebKit::WebFrame* frame) OVERRIDE; | 145 blink::WebFrame* frame) OVERRIDE; |
| 146 virtual bool AllowPepperMediaStreamAPI(const GURL& url) OVERRIDE; | 146 virtual bool AllowPepperMediaStreamAPI(const GURL& url) OVERRIDE; |
| 147 virtual void AddKeySystems( | 147 virtual void AddKeySystems( |
| 148 std::vector<content::KeySystemInfo>* key_systems) OVERRIDE; | 148 std::vector<content::KeySystemInfo>* key_systems) OVERRIDE; |
| 149 | 149 |
| 150 // For testing. | 150 // For testing. |
| 151 void SetExtensionDispatcher(extensions::Dispatcher* extension_dispatcher); | 151 void SetExtensionDispatcher(extensions::Dispatcher* extension_dispatcher); |
| 152 | 152 |
| 153 #if defined(ENABLE_SPELLCHECK) | 153 #if defined(ENABLE_SPELLCHECK) |
| 154 // Sets a new |spellcheck|. Used for low-mem restart and testing only. | 154 // Sets a new |spellcheck|. Used for low-mem restart and testing only. |
| 155 // Takes ownership of |spellcheck|. | 155 // Takes ownership of |spellcheck|. |
| 156 void SetSpellcheck(SpellCheck* spellcheck); | 156 void SetSpellcheck(SpellCheck* spellcheck); |
| 157 #endif | 157 #endif |
| 158 | 158 |
| 159 // Called in low-memory conditions to dump the memory used by the spellchecker | 159 // Called in low-memory conditions to dump the memory used by the spellchecker |
| 160 // and start over. | 160 // and start over. |
| 161 void OnPurgeMemory(); | 161 void OnPurgeMemory(); |
| 162 | 162 |
| 163 static WebKit::WebPlugin* CreatePlugin( | 163 static blink::WebPlugin* CreatePlugin( |
| 164 content::RenderView* render_view, | 164 content::RenderView* render_view, |
| 165 WebKit::WebFrame* frame, | 165 blink::WebFrame* frame, |
| 166 const WebKit::WebPluginParams& params, | 166 const blink::WebPluginParams& params, |
| 167 const ChromeViewHostMsg_GetPluginInfo_Output& output); | 167 const ChromeViewHostMsg_GetPluginInfo_Output& output); |
| 168 | 168 |
| 169 // TODO(mpcomplete): remove after we collect histogram data. | 169 // TODO(mpcomplete): remove after we collect histogram data. |
| 170 // http://crbug.com/100411 | 170 // http://crbug.com/100411 |
| 171 static bool IsAdblockInstalled(); | 171 static bool IsAdblockInstalled(); |
| 172 static bool IsAdblockPlusInstalled(); | 172 static bool IsAdblockPlusInstalled(); |
| 173 static bool IsAdblockWithWebRequestInstalled(); | 173 static bool IsAdblockWithWebRequestInstalled(); |
| 174 static bool IsAdblockPlusWithWebRequestInstalled(); | 174 static bool IsAdblockPlusWithWebRequestInstalled(); |
| 175 static bool IsOtherExtensionWithWebRequestInstalled(); | 175 static bool IsOtherExtensionWithWebRequestInstalled(); |
| 176 | 176 |
| 177 private: | 177 private: |
| 178 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, NaClRestriction); | 178 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, NaClRestriction); |
| 179 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, | 179 FRIEND_TEST_ALL_PREFIXES(ChromeContentRendererClientTest, |
| 180 ShouldSuppressErrorPage); | 180 ShouldSuppressErrorPage); |
| 181 | 181 |
| 182 // Gets extension by the given origin, regardless of whether the extension | 182 // Gets extension by the given origin, regardless of whether the extension |
| 183 // is active in the current process. | 183 // is active in the current process. |
| 184 const extensions::Extension* GetExtensionByOrigin( | 184 const extensions::Extension* GetExtensionByOrigin( |
| 185 const WebKit::WebSecurityOrigin& origin) const; | 185 const blink::WebSecurityOrigin& origin) const; |
| 186 | 186 |
| 187 // Returns true if the frame is navigating to an URL either into or out of an | 187 // Returns true if the frame is navigating to an URL either into or out of an |
| 188 // extension app's extent. | 188 // extension app's extent. |
| 189 bool CrossesExtensionExtents(WebKit::WebFrame* frame, | 189 bool CrossesExtensionExtents(blink::WebFrame* frame, |
| 190 const GURL& new_url, | 190 const GURL& new_url, |
| 191 const ExtensionSet& extensions, | 191 const ExtensionSet& extensions, |
| 192 bool is_extension_url, | 192 bool is_extension_url, |
| 193 bool is_initial_navigation); | 193 bool is_initial_navigation); |
| 194 | 194 |
| 195 static GURL GetNaClContentHandlerURL(const std::string& actual_mime_type, | 195 static GURL GetNaClContentHandlerURL(const std::string& actual_mime_type, |
| 196 const content::WebPluginInfo& plugin); | 196 const content::WebPluginInfo& plugin); |
| 197 | 197 |
| 198 // Determines if a NaCl app is allowed, and modifies params to pass the app's | 198 // Determines if a NaCl app is allowed, and modifies params to pass the app's |
| 199 // permissions to the trusted NaCl plugin. | 199 // permissions to the trusted NaCl plugin. |
| 200 static bool IsNaClAllowed(const GURL& manifest_url, | 200 static bool IsNaClAllowed(const GURL& manifest_url, |
| 201 const GURL& app_url, | 201 const GURL& app_url, |
| 202 bool is_nacl_unrestricted, | 202 bool is_nacl_unrestricted, |
| 203 const extensions::Extension* extension, | 203 const extensions::Extension* extension, |
| 204 WebKit::WebPluginParams* params); | 204 blink::WebPluginParams* params); |
| 205 | 205 |
| 206 scoped_ptr<ChromeRenderProcessObserver> chrome_observer_; | 206 scoped_ptr<ChromeRenderProcessObserver> chrome_observer_; |
| 207 scoped_ptr<extensions::Dispatcher> extension_dispatcher_; | 207 scoped_ptr<extensions::Dispatcher> extension_dispatcher_; |
| 208 scoped_ptr<extensions::RendererPermissionsPolicyDelegate> | 208 scoped_ptr<extensions::RendererPermissionsPolicyDelegate> |
| 209 permissions_policy_delegate_; | 209 permissions_policy_delegate_; |
| 210 scoped_ptr<PrescientNetworkingDispatcher> prescient_networking_dispatcher_; | 210 scoped_ptr<PrescientNetworkingDispatcher> prescient_networking_dispatcher_; |
| 211 scoped_ptr<RendererNetPredictor> net_predictor_; | 211 scoped_ptr<RendererNetPredictor> net_predictor_; |
| 212 #if defined(ENABLE_SPELLCHECK) | 212 #if defined(ENABLE_SPELLCHECK) |
| 213 scoped_ptr<SpellCheck> spellcheck_; | 213 scoped_ptr<SpellCheck> spellcheck_; |
| 214 #endif | 214 #endif |
| 215 scoped_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_; | 215 scoped_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_; |
| 216 scoped_ptr<safe_browsing::PhishingClassifierFilter> phishing_classifier_; | 216 scoped_ptr<safe_browsing::PhishingClassifierFilter> phishing_classifier_; |
| 217 scoped_ptr<prerender::PrerenderDispatcher> prerender_dispatcher_; | 217 scoped_ptr<prerender::PrerenderDispatcher> prerender_dispatcher_; |
| 218 #if defined(ENABLE_WEBRTC) | 218 #if defined(ENABLE_WEBRTC) |
| 219 scoped_refptr<WebRtcLoggingMessageFilter> webrtc_logging_message_filter_; | 219 scoped_refptr<WebRtcLoggingMessageFilter> webrtc_logging_message_filter_; |
| 220 #endif | 220 #endif |
| 221 scoped_ptr<SearchBouncer> search_bouncer_; | 221 scoped_ptr<SearchBouncer> search_bouncer_; |
| 222 | 222 |
| 223 #if defined(ENABLE_PLUGINS) | 223 #if defined(ENABLE_PLUGINS) |
| 224 std::set<std::string> allowed_file_handle_origins_; | 224 std::set<std::string> allowed_file_handle_origins_; |
| 225 #endif | 225 #endif |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 #endif // CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ | 228 #endif // CHROME_RENDERER_CHROME_CONTENT_RENDERER_CLIENT_H_ |
| OLD | NEW |