| 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_RENDERER_CONTENT_RENDERER_CLIENT_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_CONTENT_RENDERER_CLIENT_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_CONTENT_RENDERER_CLIENT_H_ | 6 #define CONTENT_PUBLIC_RENDERER_CONTENT_RENDERER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "content/public/common/content_client.h" | 13 #include "content/public/common/content_client.h" |
| 14 #include "content/public/common/page_transition_types.h" | 14 #include "content/public/common/page_transition_types.h" |
| 15 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
| 16 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 16 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
| 17 #include "third_party/WebKit/public/web/WebNavigationType.h" | 17 #include "third_party/WebKit/public/web/WebNavigationType.h" |
| 18 #include "third_party/WebKit/public/web/WebPageVisibilityState.h" | 18 #include "third_party/WebKit/public/web/WebPageVisibilityState.h" |
| 19 #include "v8/include/v8.h" | 19 #include "v8/include/v8.h" |
| 20 | 20 |
| 21 class GURL; | 21 class GURL; |
| 22 class SkBitmap; | 22 class SkBitmap; |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class FilePath; | 25 class FilePath; |
| 26 class MessageLoop; | 26 class MessageLoop; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace WebKit { | 29 namespace blink { |
| 30 class WebAudioDevice; | 30 class WebAudioDevice; |
| 31 class WebClipboard; | 31 class WebClipboard; |
| 32 class WebFrame; | 32 class WebFrame; |
| 33 class WebMIDIAccessor; | 33 class WebMIDIAccessor; |
| 34 class WebMIDIAccessorClient; | 34 class WebMIDIAccessorClient; |
| 35 class WebMediaStreamCenter; | 35 class WebMediaStreamCenter; |
| 36 class WebMediaStreamCenterClient; | 36 class WebMediaStreamCenterClient; |
| 37 class WebPlugin; | 37 class WebPlugin; |
| 38 class WebPluginContainer; | 38 class WebPluginContainer; |
| 39 class WebPrescientNetworking; | 39 class WebPrescientNetworking; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 virtual SkBitmap* GetSadWebViewBitmap(); | 77 virtual SkBitmap* GetSadWebViewBitmap(); |
| 78 | 78 |
| 79 // Returns the default text encoding. | 79 // Returns the default text encoding. |
| 80 virtual std::string GetDefaultEncoding(); | 80 virtual std::string GetDefaultEncoding(); |
| 81 | 81 |
| 82 // Allows the embedder to override creating a plugin. If it returns true, then | 82 // Allows the embedder to override creating a plugin. If it returns true, then |
| 83 // |plugin| will contain the created plugin, although it could be NULL. If it | 83 // |plugin| will contain the created plugin, although it could be NULL. If it |
| 84 // returns false, the content layer will create the plugin. | 84 // returns false, the content layer will create the plugin. |
| 85 virtual bool OverrideCreatePlugin( | 85 virtual bool OverrideCreatePlugin( |
| 86 RenderView* render_view, | 86 RenderView* render_view, |
| 87 WebKit::WebFrame* frame, | 87 blink::WebFrame* frame, |
| 88 const WebKit::WebPluginParams& params, | 88 const blink::WebPluginParams& params, |
| 89 WebKit::WebPlugin** plugin); | 89 blink::WebPlugin** plugin); |
| 90 | 90 |
| 91 // Creates a replacement plug-in that is shown when the plug-in at |file_path| | 91 // Creates a replacement plug-in that is shown when the plug-in at |file_path| |
| 92 // couldn't be loaded. This allows the embedder to show a custom placeholder. | 92 // couldn't be loaded. This allows the embedder to show a custom placeholder. |
| 93 virtual WebKit::WebPlugin* CreatePluginReplacement( | 93 virtual blink::WebPlugin* CreatePluginReplacement( |
| 94 RenderView* render_view, | 94 RenderView* render_view, |
| 95 const base::FilePath& plugin_path); | 95 const base::FilePath& plugin_path); |
| 96 | 96 |
| 97 // Returns true if the embedder has an error page to show for the given http | 97 // Returns true if the embedder has an error page to show for the given http |
| 98 // status code. If so |error_domain| should be set to according to WebURLError | 98 // status code. If so |error_domain| should be set to according to WebURLError |
| 99 // and the embedder's GetNavigationErrorHtml will be called afterwards to get | 99 // and the embedder's GetNavigationErrorHtml will be called afterwards to get |
| 100 // the error html. | 100 // the error html. |
| 101 virtual bool HasErrorPage(int http_status_code, | 101 virtual bool HasErrorPage(int http_status_code, |
| 102 std::string* error_domain); | 102 std::string* error_domain); |
| 103 | 103 |
| 104 // Returns true if the embedder prefers not to show an error page for a failed | 104 // Returns true if the embedder prefers not to show an error page for a failed |
| 105 // navigation to |url|. | 105 // navigation to |url|. |
| 106 virtual bool ShouldSuppressErrorPage(const GURL& url); | 106 virtual bool ShouldSuppressErrorPage(const GURL& url); |
| 107 | 107 |
| 108 // Returns the information to display when a navigation error occurs. | 108 // Returns the information to display when a navigation error occurs. |
| 109 // If |error_html| is not null then it may be set to a HTML page containing | 109 // If |error_html| is not null then it may be set to a HTML page containing |
| 110 // the details of the error and maybe links to more info. | 110 // the details of the error and maybe links to more info. |
| 111 // If |error_description| is not null it may be set to contain a brief | 111 // If |error_description| is not null it may be set to contain a brief |
| 112 // message describing the error that has occurred. | 112 // message describing the error that has occurred. |
| 113 // Either of the out parameters may be not written to in certain cases | 113 // Either of the out parameters may be not written to in certain cases |
| 114 // (lack of information on the error code) so the caller should take care to | 114 // (lack of information on the error code) so the caller should take care to |
| 115 // initialize the string values with safe defaults before the call. | 115 // initialize the string values with safe defaults before the call. |
| 116 virtual void GetNavigationErrorStrings( | 116 virtual void GetNavigationErrorStrings( |
| 117 WebKit::WebFrame* frame, | 117 blink::WebFrame* frame, |
| 118 const WebKit::WebURLRequest& failed_request, | 118 const blink::WebURLRequest& failed_request, |
| 119 const WebKit::WebURLError& error, | 119 const blink::WebURLError& error, |
| 120 const std::string& accept_languages, | 120 const std::string& accept_languages, |
| 121 std::string* error_html, | 121 std::string* error_html, |
| 122 string16* error_description) {} | 122 string16* error_description) {} |
| 123 | 123 |
| 124 // Allows the embedder to control when media resources are loaded. Embedders | 124 // Allows the embedder to control when media resources are loaded. Embedders |
| 125 // can run |closure| immediately if they don't wish to defer media resource | 125 // can run |closure| immediately if they don't wish to defer media resource |
| 126 // loading. | 126 // loading. |
| 127 virtual void DeferMediaLoad(RenderView* render_view, | 127 virtual void DeferMediaLoad(RenderView* render_view, |
| 128 const base::Closure& closure); | 128 const base::Closure& closure); |
| 129 | 129 |
| 130 // Allows the embedder to override creating a WebMediaStreamCenter. If it | 130 // Allows the embedder to override creating a WebMediaStreamCenter. If it |
| 131 // returns NULL the content layer will create the stream center. | 131 // returns NULL the content layer will create the stream center. |
| 132 virtual WebKit::WebMediaStreamCenter* OverrideCreateWebMediaStreamCenter( | 132 virtual blink::WebMediaStreamCenter* OverrideCreateWebMediaStreamCenter( |
| 133 WebKit::WebMediaStreamCenterClient* client); | 133 blink::WebMediaStreamCenterClient* client); |
| 134 | 134 |
| 135 // Allows the embedder to override creating a WebRTCPeerConnectionHandler. If | 135 // Allows the embedder to override creating a WebRTCPeerConnectionHandler. If |
| 136 // it returns NULL the content layer will create the connection handler. | 136 // it returns NULL the content layer will create the connection handler. |
| 137 virtual WebKit::WebRTCPeerConnectionHandler* | 137 virtual blink::WebRTCPeerConnectionHandler* |
| 138 OverrideCreateWebRTCPeerConnectionHandler( | 138 OverrideCreateWebRTCPeerConnectionHandler( |
| 139 WebKit::WebRTCPeerConnectionHandlerClient* client); | 139 blink::WebRTCPeerConnectionHandlerClient* client); |
| 140 | 140 |
| 141 // Allows the embedder to override creating a WebMIDIAccessor. If it | 141 // Allows the embedder to override creating a WebMIDIAccessor. If it |
| 142 // returns NULL the content layer will create the MIDI accessor. | 142 // returns NULL the content layer will create the MIDI accessor. |
| 143 virtual WebKit::WebMIDIAccessor* OverrideCreateMIDIAccessor( | 143 virtual blink::WebMIDIAccessor* OverrideCreateMIDIAccessor( |
| 144 WebKit::WebMIDIAccessorClient* client); | 144 blink::WebMIDIAccessorClient* client); |
| 145 | 145 |
| 146 // Allows the embedder to override creating a WebAudioDevice. If it | 146 // Allows the embedder to override creating a WebAudioDevice. If it |
| 147 // returns NULL the content layer will create the audio device. | 147 // returns NULL the content layer will create the audio device. |
| 148 virtual WebKit::WebAudioDevice* OverrideCreateAudioDevice( | 148 virtual blink::WebAudioDevice* OverrideCreateAudioDevice( |
| 149 double sample_rate); | 149 double sample_rate); |
| 150 | 150 |
| 151 // Allows the embedder to override the WebKit::WebClipboard used. If it | 151 // Allows the embedder to override the blink::WebClipboard used. If it |
| 152 // returns NULL the content layer will handle clipboard interactions. | 152 // returns NULL the content layer will handle clipboard interactions. |
| 153 virtual WebKit::WebClipboard* OverrideWebClipboard(); | 153 virtual blink::WebClipboard* OverrideWebClipboard(); |
| 154 | 154 |
| 155 // Allows the embedder to override the WebThemeEngine used. If it returns NULL | 155 // Allows the embedder to override the WebThemeEngine used. If it returns NULL |
| 156 // the content layer will provide an engine. | 156 // the content layer will provide an engine. |
| 157 virtual WebKit::WebThemeEngine* OverrideThemeEngine(); | 157 virtual blink::WebThemeEngine* OverrideThemeEngine(); |
| 158 | 158 |
| 159 // Allows the embedder to override the WebSpeechSynthesizer used. | 159 // Allows the embedder to override the WebSpeechSynthesizer used. |
| 160 // If it returns NULL the content layer will provide an engine. | 160 // If it returns NULL the content layer will provide an engine. |
| 161 virtual WebKit::WebSpeechSynthesizer* OverrideSpeechSynthesizer( | 161 virtual blink::WebSpeechSynthesizer* OverrideSpeechSynthesizer( |
| 162 WebKit::WebSpeechSynthesizerClient* client); | 162 blink::WebSpeechSynthesizerClient* client); |
| 163 | 163 |
| 164 // Returns true if the renderer process should schedule the idle handler when | 164 // Returns true if the renderer process should schedule the idle handler when |
| 165 // all widgets are hidden. | 165 // all widgets are hidden. |
| 166 virtual bool RunIdleHandlerWhenWidgetsHidden(); | 166 virtual bool RunIdleHandlerWhenWidgetsHidden(); |
| 167 | 167 |
| 168 // Returns true if a popup window should be allowed. | 168 // Returns true if a popup window should be allowed. |
| 169 virtual bool AllowPopup(); | 169 virtual bool AllowPopup(); |
| 170 | 170 |
| 171 // Returns true if the navigation was handled by the embedder and should be | 171 // Returns true if the navigation was handled by the embedder and should be |
| 172 // ignored by WebKit. This method is used by CEF. | 172 // ignored by WebKit. This method is used by CEF. |
| 173 virtual bool HandleNavigation(WebKit::WebFrame* frame, | 173 virtual bool HandleNavigation(blink::WebFrame* frame, |
| 174 const WebKit::WebURLRequest& request, | 174 const blink::WebURLRequest& request, |
| 175 WebKit::WebNavigationType type, | 175 blink::WebNavigationType type, |
| 176 WebKit::WebNavigationPolicy default_policy, | 176 blink::WebNavigationPolicy default_policy, |
| 177 bool is_redirect); | 177 bool is_redirect); |
| 178 | 178 |
| 179 // Returns true if we should fork a new process for the given navigation. | 179 // Returns true if we should fork a new process for the given navigation. |
| 180 // If |send_referrer| is set to false (which is the default), no referrer | 180 // If |send_referrer| is set to false (which is the default), no referrer |
| 181 // header will be send for the navigation. Otherwise, the referrer header is | 181 // header will be send for the navigation. Otherwise, the referrer header is |
| 182 // set according to the frame's referrer policy. | 182 // set according to the frame's referrer policy. |
| 183 virtual bool ShouldFork(WebKit::WebFrame* frame, | 183 virtual bool ShouldFork(blink::WebFrame* frame, |
| 184 const GURL& url, | 184 const GURL& url, |
| 185 const std::string& http_method, | 185 const std::string& http_method, |
| 186 bool is_initial_navigation, | 186 bool is_initial_navigation, |
| 187 bool is_server_redirect, | 187 bool is_server_redirect, |
| 188 bool* send_referrer); | 188 bool* send_referrer); |
| 189 | 189 |
| 190 // Notifies the embedder that the given frame is requesting the resource at | 190 // Notifies the embedder that the given frame is requesting the resource at |
| 191 // |url|. If the function returns true, the url is changed to |new_url|. | 191 // |url|. If the function returns true, the url is changed to |new_url|. |
| 192 virtual bool WillSendRequest(WebKit::WebFrame* frame, | 192 virtual bool WillSendRequest(blink::WebFrame* frame, |
| 193 PageTransition transition_type, | 193 PageTransition transition_type, |
| 194 const GURL& url, | 194 const GURL& url, |
| 195 const GURL& first_party_for_cookies, | 195 const GURL& first_party_for_cookies, |
| 196 GURL* new_url); | 196 GURL* new_url); |
| 197 | 197 |
| 198 // Whether to pump events when sending sync cookie messages. Needed if the | 198 // Whether to pump events when sending sync cookie messages. Needed if the |
| 199 // embedder can potentiall put up a modal dialog on the UI thread as a result. | 199 // embedder can potentiall put up a modal dialog on the UI thread as a result. |
| 200 virtual bool ShouldPumpEventsDuringCookieMessage(); | 200 virtual bool ShouldPumpEventsDuringCookieMessage(); |
| 201 | 201 |
| 202 // See the corresponding functions in WebKit::WebFrameClient. | 202 // See the corresponding functions in blink::WebFrameClient. |
| 203 virtual void DidCreateScriptContext(WebKit::WebFrame* frame, | 203 virtual void DidCreateScriptContext(blink::WebFrame* frame, |
| 204 v8::Handle<v8::Context> context, | 204 v8::Handle<v8::Context> context, |
| 205 int extension_group, | 205 int extension_group, |
| 206 int world_id) {} | 206 int world_id) {} |
| 207 virtual void WillReleaseScriptContext(WebKit::WebFrame* frame, | 207 virtual void WillReleaseScriptContext(blink::WebFrame* frame, |
| 208 v8::Handle<v8::Context>, | 208 v8::Handle<v8::Context>, |
| 209 int world_id) {} | 209 int world_id) {} |
| 210 | 210 |
| 211 // See WebKit::Platform. | 211 // See blink::Platform. |
| 212 virtual unsigned long long VisitedLinkHash(const char* canonical_url, | 212 virtual unsigned long long VisitedLinkHash(const char* canonical_url, |
| 213 size_t length); | 213 size_t length); |
| 214 virtual bool IsLinkVisited(unsigned long long link_hash); | 214 virtual bool IsLinkVisited(unsigned long long link_hash); |
| 215 virtual WebKit::WebPrescientNetworking* GetPrescientNetworking(); | 215 virtual blink::WebPrescientNetworking* GetPrescientNetworking(); |
| 216 virtual bool ShouldOverridePageVisibilityState( | 216 virtual bool ShouldOverridePageVisibilityState( |
| 217 const RenderView* render_view, | 217 const RenderView* render_view, |
| 218 WebKit::WebPageVisibilityState* override_state); | 218 blink::WebPageVisibilityState* override_state); |
| 219 | 219 |
| 220 // Return true if the GetCookie request will be handled by the embedder. | 220 // Return true if the GetCookie request will be handled by the embedder. |
| 221 // Cookies are returned in the cookie parameter. | 221 // Cookies are returned in the cookie parameter. |
| 222 virtual bool HandleGetCookieRequest(RenderView* sender, | 222 virtual bool HandleGetCookieRequest(RenderView* sender, |
| 223 const GURL& url, | 223 const GURL& url, |
| 224 const GURL& first_party_for_cookies, | 224 const GURL& first_party_for_cookies, |
| 225 std::string* cookies); | 225 std::string* cookies); |
| 226 | 226 |
| 227 // Return true if the SetCookie request will be handled by the embedder. | 227 // Return true if the SetCookie request will be handled by the embedder. |
| 228 // Cookies to be set are passed in the value parameter. | 228 // Cookies to be set are passed in the value parameter. |
| 229 virtual bool HandleSetCookieRequest(RenderView* sender, | 229 virtual bool HandleSetCookieRequest(RenderView* sender, |
| 230 const GURL& url, | 230 const GURL& url, |
| 231 const GURL& first_party_for_cookies, | 231 const GURL& first_party_for_cookies, |
| 232 const std::string& value); | 232 const std::string& value); |
| 233 | 233 |
| 234 // Allows an embedder to return custom PPAPI interfaces. | 234 // Allows an embedder to return custom PPAPI interfaces. |
| 235 virtual const void* CreatePPAPIInterface( | 235 virtual const void* CreatePPAPIInterface( |
| 236 const std::string& interface_name); | 236 const std::string& interface_name); |
| 237 | 237 |
| 238 // Returns true if the given Pepper plugin is external (requiring special | 238 // Returns true if the given Pepper plugin is external (requiring special |
| 239 // startup steps). | 239 // startup steps). |
| 240 virtual bool IsExternalPepperPlugin(const std::string& module_name); | 240 virtual bool IsExternalPepperPlugin(const std::string& module_name); |
| 241 | 241 |
| 242 // Returns true if plugin living in the container can use | 242 // Returns true if plugin living in the container can use |
| 243 // pp::FileIO::RequestOSFileHandle. | 243 // pp::FileIO::RequestOSFileHandle. |
| 244 // TODO(teravest): Remove this when FileIO is moved to the browser. | 244 // TODO(teravest): Remove this when FileIO is moved to the browser. |
| 245 virtual bool IsPluginAllowedToCallRequestOSFileHandle( | 245 virtual bool IsPluginAllowedToCallRequestOSFileHandle( |
| 246 WebKit::WebPluginContainer* container); | 246 blink::WebPluginContainer* container); |
| 247 | 247 |
| 248 // Returns whether BrowserPlugin should be allowed within the |container|. | 248 // Returns whether BrowserPlugin should be allowed within the |container|. |
| 249 virtual bool AllowBrowserPlugin(WebKit::WebPluginContainer* container); | 249 virtual bool AllowBrowserPlugin(blink::WebPluginContainer* container); |
| 250 | 250 |
| 251 // Returns true if the page at |url| can use Pepper MediaStream APIs. | 251 // Returns true if the page at |url| can use Pepper MediaStream APIs. |
| 252 virtual bool AllowPepperMediaStreamAPI(const GURL& url); | 252 virtual bool AllowPepperMediaStreamAPI(const GURL& url); |
| 253 | 253 |
| 254 // Gives the embedder a chance to register the key system(s) it supports by | 254 // Gives the embedder a chance to register the key system(s) it supports by |
| 255 // populating |key_systems|. | 255 // populating |key_systems|. |
| 256 virtual void AddKeySystems(std::vector<KeySystemInfo>* key_systems); | 256 virtual void AddKeySystems(std::vector<KeySystemInfo>* key_systems); |
| 257 | 257 |
| 258 // Returns true if we should report a detailed message (including a stack | 258 // Returns true if we should report a detailed message (including a stack |
| 259 // trace) for console [logs|errors|exceptions]. |source| is the WebKit- | 259 // trace) for console [logs|errors|exceptions]. |source| is the WebKit- |
| 260 // reported source for the error; this can point to a page or a script, | 260 // reported source for the error; this can point to a page or a script, |
| 261 // and can be external or internal. | 261 // and can be external or internal. |
| 262 virtual bool ShouldReportDetailedMessageForSource( | 262 virtual bool ShouldReportDetailedMessageForSource( |
| 263 const base::string16& source) const; | 263 const base::string16& source) const; |
| 264 | 264 |
| 265 // Returns true if we should apply the cross-site document blocking policy to | 265 // Returns true if we should apply the cross-site document blocking policy to |
| 266 // this renderer process. Currently, we apply the policy only to a renderer | 266 // this renderer process. Currently, we apply the policy only to a renderer |
| 267 // process running on a normal page from the web. | 267 // process running on a normal page from the web. |
| 268 virtual bool ShouldEnableSiteIsolationPolicy() const; | 268 virtual bool ShouldEnableSiteIsolationPolicy() const; |
| 269 | 269 |
| 270 // Creates a permission client proxy for in-renderer worker. | 270 // Creates a permission client proxy for in-renderer worker. |
| 271 virtual WebKit::WebWorkerPermissionClientProxy* | 271 virtual blink::WebWorkerPermissionClientProxy* |
| 272 CreateWorkerPermissionClientProxy(RenderView* render_view, | 272 CreateWorkerPermissionClientProxy(RenderView* render_view, |
| 273 WebKit::WebFrame* frame); | 273 blink::WebFrame* frame); |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 } // namespace content | 276 } // namespace content |
| 277 | 277 |
| 278 #endif // CONTENT_PUBLIC_RENDERER_CONTENT_RENDERER_CLIENT_H_ | 278 #endif // CONTENT_PUBLIC_RENDERER_CONTENT_RENDERER_CLIENT_H_ |
| OLD | NEW |