| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // WebCore provides hooks for several kinds of functionality, allowing separate | 5 // WebCore provides hooks for several kinds of functionality, allowing separate |
| 6 // classes termed "delegates" to receive notifications (in the form of direct | 6 // classes termed "delegates" to receive notifications (in the form of direct |
| 7 // function calls) when certain events are about to occur or have just occurred. | 7 // function calls) when certain events are about to occur or have just occurred. |
| 8 // In some cases, the delegate implements the needed functionality; in others, | 8 // In some cases, the delegate implements the needed functionality; in others, |
| 9 // the delegate has some control over the behavior but doesn't actually | 9 // the delegate has some control over the behavior but doesn't actually |
| 10 // implement it. For example, the UI delegate is responsible for showing a | 10 // implement it. For example, the UI delegate is responsible for showing a |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // of ChromeClient and FrameLoaderClient not delegated in the WebKit | 23 // of ChromeClient and FrameLoaderClient not delegated in the WebKit |
| 24 // implementation; and some WebView additions. | 24 // implementation; and some WebView additions. |
| 25 | 25 |
| 26 #ifndef WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 26 #ifndef WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
| 27 #define WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 27 #define WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
| 28 | 28 |
| 29 #include <vector> | 29 #include <vector> |
| 30 | 30 |
| 31 #include "webkit/api/public/WebDragOperation.h" | 31 #include "webkit/api/public/WebDragOperation.h" |
| 32 #include "webkit/api/public/WebFrame.h" | 32 #include "webkit/api/public/WebFrame.h" |
| 33 #include "webkit/api/public/WebNavigationPolicy.h" | |
| 34 #include "webkit/api/public/WebNavigationType.h" | |
| 35 #include "webkit/api/public/WebTextDirection.h" | 33 #include "webkit/api/public/WebTextDirection.h" |
| 36 #include "webkit/api/public/WebWidgetClient.h" | 34 #include "webkit/api/public/WebWidgetClient.h" |
| 37 #include "webkit/glue/context_menu.h" | 35 #include "webkit/glue/context_menu.h" |
| 38 | 36 |
| 39 namespace webkit_glue { | |
| 40 class WebMediaPlayerDelegate; | |
| 41 struct WebPluginGeometry; | |
| 42 } | |
| 43 | |
| 44 namespace WebCore { | 37 namespace WebCore { |
| 45 class AccessibilityObject; | 38 class AccessibilityObject; |
| 46 } | 39 } |
| 47 | 40 |
| 48 namespace WebKit { | 41 namespace WebKit { |
| 49 class WebDataSource; | |
| 50 class WebDragData; | 42 class WebDragData; |
| 51 class WebForm; | |
| 52 class WebWorker; | |
| 53 class WebWorkerClient; | |
| 54 class WebMediaPlayer; | |
| 55 class WebMediaPlayerClient; | |
| 56 class WebNode; | |
| 57 class WebNotificationPresenter; | 43 class WebNotificationPresenter; |
| 58 class WebPlugin; | |
| 59 class WebURLRequest; | |
| 60 class WebURLResponse; | |
| 61 class WebWidget; | 44 class WebWidget; |
| 62 struct WebPluginParams; | 45 struct WebPopupMenuInfo; |
| 63 struct WebPoint; | 46 struct WebPoint; |
| 64 struct WebPopupMenuInfo; | |
| 65 struct WebRect; | 47 struct WebRect; |
| 66 struct WebURLError; | |
| 67 } | 48 } |
| 68 | 49 |
| 69 class FilePath; | 50 class FilePath; |
| 70 class SkBitmap; | 51 class SkBitmap; |
| 71 class WebDevToolsAgentDelegate; | 52 class WebDevToolsAgentDelegate; |
| 72 class WebMediaPlayerDelegate; | |
| 73 class WebView; | 53 class WebView; |
| 74 struct ContextMenuMediaParams; | 54 struct ContextMenuMediaParams; |
| 75 struct WebPreferences; | |
| 76 | |
| 77 enum NavigationGesture { | |
| 78 NavigationGestureUser, // User initiated navigation/load. This is not | |
| 79 // currently used due to the untrustworthy nature | |
| 80 // of userGestureHint (wasRunByUserGesture). See | |
| 81 // bug 1051891. | |
| 82 NavigationGestureAuto, // Non-user initiated navigation / load. For example | |
| 83 // onload or setTimeout triggered document.location | |
| 84 // changes, and form.submits. See bug 1046841 for | |
| 85 // some cases that should be treated this way but | |
| 86 // aren't yet. | |
| 87 NavigationGestureUnknown, // What we assign when userGestureHint returns true | |
| 88 // because we can't trust it. | |
| 89 }; | |
| 90 | |
| 91 | 55 |
| 92 // Interface passed in to the WebViewDelegate to receive notification of the | 56 // Interface passed in to the WebViewDelegate to receive notification of the |
| 93 // result of an open file dialog. | 57 // result of an open file dialog. |
| 94 class WebFileChooserCallback { | 58 class WebFileChooserCallback { |
| 95 public: | 59 public: |
| 96 WebFileChooserCallback() {} | 60 WebFileChooserCallback() {} |
| 97 virtual ~WebFileChooserCallback() {} | 61 virtual ~WebFileChooserCallback() {} |
| 98 virtual void OnFileChoose(const std::vector<FilePath>& file_names) { } | 62 virtual void OnFileChoose(const std::vector<FilePath>& file_names) { } |
| 99 | 63 |
| 100 private: | 64 private: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 130 } | 94 } |
| 131 | 95 |
| 132 // Like CreatePopupWidget, except the actual widget is rendered by the | 96 // Like CreatePopupWidget, except the actual widget is rendered by the |
| 133 // embedder using the supplied info. | 97 // embedder using the supplied info. |
| 134 virtual WebKit::WebWidget* CreatePopupWidgetWithInfo( | 98 virtual WebKit::WebWidget* CreatePopupWidgetWithInfo( |
| 135 WebView* webview, | 99 WebView* webview, |
| 136 const WebKit::WebPopupMenuInfo& info) { | 100 const WebKit::WebPopupMenuInfo& info) { |
| 137 return NULL; | 101 return NULL; |
| 138 } | 102 } |
| 139 | 103 |
| 140 virtual WebKit::WebPlugin* CreatePlugin( | |
| 141 WebKit::WebFrame* parent_frame, | |
| 142 const WebKit::WebPluginParams& params) { | |
| 143 return NULL; | |
| 144 } | |
| 145 | |
| 146 // This method is called when the renderer creates a worker object. | |
| 147 virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client) { | |
| 148 return NULL; | |
| 149 } | |
| 150 | |
| 151 // Called when a WebMediaPlayer is needed. | |
| 152 virtual WebKit::WebMediaPlayer* CreateWebMediaPlayer( | |
| 153 WebKit::WebMediaPlayerClient* client) { | |
| 154 return NULL; | |
| 155 } | |
| 156 | |
| 157 // This method is called to open a URL in the specified manner. | |
| 158 virtual void OpenURL(WebView* webview, const GURL& url, | |
| 159 const GURL& referrer, | |
| 160 WebKit::WebNavigationPolicy policy) { | |
| 161 } | |
| 162 | |
| 163 // Notifies how many matches have been found so far, for a given request_id. | 104 // Notifies how many matches have been found so far, for a given request_id. |
| 164 // |final_update| specifies whether this is the last update (all frames have | 105 // |final_update| specifies whether this is the last update (all frames have |
| 165 // completed scoping). | 106 // completed scoping). |
| 166 virtual void ReportFindInPageMatchCount(int count, int request_id, | 107 virtual void ReportFindInPageMatchCount(int count, int request_id, |
| 167 bool final_update) { | 108 bool final_update) { |
| 168 } | 109 } |
| 169 | 110 |
| 170 // Notifies the browser what tick-mark rect is currently selected. Parameter | 111 // Notifies the browser what tick-mark rect is currently selected. Parameter |
| 171 // |request_id| lets the recipient know which request this message belongs to, | 112 // |request_id| lets the recipient know which request this message belongs to, |
| 172 // so that it can choose to ignore the message if it has moved on to other | 113 // so that it can choose to ignore the message if it has moved on to other |
| (...skipping 26 matching lines...) Expand all Loading... |
| 199 } | 140 } |
| 200 | 141 |
| 201 // Notifies the delegate that a load has begun. | 142 // Notifies the delegate that a load has begun. |
| 202 virtual void DidStartLoading(WebView* webview) { | 143 virtual void DidStartLoading(WebView* webview) { |
| 203 } | 144 } |
| 204 | 145 |
| 205 // Notifies the delegate that all loads are finished. | 146 // Notifies the delegate that all loads are finished. |
| 206 virtual void DidStopLoading(WebView* webview) { | 147 virtual void DidStopLoading(WebView* webview) { |
| 207 } | 148 } |
| 208 | 149 |
| 209 // The original version of this is WindowScriptObjectAvailable, below. This | |
| 210 // is a Chrome-specific version that serves the same purpose, but has been | |
| 211 // renamed since we haven't implemented WebScriptObject. Our embedding | |
| 212 // implementation binds native objects to the window via the webframe instead. | |
| 213 // TODO(pamg): If we do implement WebScriptObject, we may wish to switch to | |
| 214 // using the original version of this function. | |
| 215 virtual void WindowObjectCleared(WebKit::WebFrame* webframe) { | |
| 216 } | |
| 217 | |
| 218 // Notifies that the documentElement for the document in a webframe has been | |
| 219 // created. This is called before anything else is parsed or executed for the | |
| 220 // document. | |
| 221 virtual void DocumentElementAvailable(WebKit::WebFrame* webframe) { | |
| 222 } | |
| 223 | |
| 224 // Notifies that a new script context has been created for this frame. | 150 // Notifies that a new script context has been created for this frame. |
| 225 // This is similar to WindowObjectCleared but only called once per frame | 151 // This is similar to WindowObjectCleared but only called once per frame |
| 226 // context. | 152 // context. |
| 227 virtual void DidCreateScriptContextForFrame(WebKit::WebFrame* webframe) { | 153 virtual void DidCreateScriptContextForFrame(WebKit::WebFrame* webframe) { |
| 228 } | 154 } |
| 229 | 155 |
| 230 // Notifies that this frame's script context has been destroyed. | 156 // Notifies that this frame's script context has been destroyed. |
| 231 virtual void DidDestroyScriptContextForFrame(WebKit::WebFrame* webframe) { | 157 virtual void DidDestroyScriptContextForFrame(WebKit::WebFrame* webframe) { |
| 232 } | 158 } |
| 233 | 159 |
| 234 // Notifies that a garbage-collected context was created - content scripts. | 160 // Notifies that a garbage-collected context was created - content scripts. |
| 235 virtual void DidCreateIsolatedScriptContext(WebKit::WebFrame* webframe) { | 161 virtual void DidCreateIsolatedScriptContext(WebKit::WebFrame* webframe) { |
| 236 } | 162 } |
| 237 | 163 |
| 238 // PolicyDelegate ---------------------------------------------------------- | |
| 239 | |
| 240 // This method is called to notify the delegate, and let it modify a | |
| 241 // proposed navigation. It will be called before loading starts, and | |
| 242 // on every redirect. | |
| 243 // | |
| 244 // default_policy specifies what should normally happen for this | |
| 245 // navigation (open in current tab, start a new tab, start a new | |
| 246 // window, etc). This method can return an altered policy, and | |
| 247 // take any additional separate action it wants to. | |
| 248 // | |
| 249 // is_redirect is true if this is a redirect rather than user action. | |
| 250 virtual WebKit::WebNavigationPolicy PolicyForNavigationAction( | |
| 251 WebView* webview, | |
| 252 WebKit::WebFrame* frame, | |
| 253 const WebKit::WebURLRequest& request, | |
| 254 WebKit::WebNavigationType type, | |
| 255 WebKit::WebNavigationPolicy default_policy, | |
| 256 bool is_redirect) { | |
| 257 return default_policy; | |
| 258 } | |
| 259 | |
| 260 // FrameLoadDelegate ------------------------------------------------------- | |
| 261 | |
| 262 // A datasource has been created for a new navigation. The given datasource | |
| 263 // will become the provisional datasource for the frame. | |
| 264 virtual void DidCreateDataSource(WebKit::WebFrame* frame, | |
| 265 WebKit::WebDataSource* ds) { | |
| 266 } | |
| 267 | |
| 268 // Notifies the delegate that the provisional load of a specified frame in a | |
| 269 // given WebView has started. By the time the provisional load for a frame has | |
| 270 // started, we know whether or not the current load is due to a client | |
| 271 // redirect or not, so we pass this information through to allow us to set | |
| 272 // the referrer properly in those cases. The consumed_client_redirect_src is | |
| 273 // an empty invalid GURL in other cases. | |
| 274 virtual void DidStartProvisionalLoadForFrame( | |
| 275 WebView* webview, | |
| 276 WebKit::WebFrame* frame, | |
| 277 NavigationGesture gesture) { | |
| 278 } | |
| 279 | |
| 280 // Called when a provisional load is redirected (see GetProvisionalDataSource | |
| 281 // for more info on provisional loads). This happens when the server sends | |
| 282 // back any type of redirect HTTP response. | |
| 283 // | |
| 284 // The redirect information can be retrieved from the provisional data | |
| 285 // source's redirect chain, which will be updated prior to this callback. | |
| 286 // The last element in that vector will be the new URL (which will be the | |
| 287 // same as the provisional data source's current URL), and the next-to-last | |
| 288 // element will be the referring URL. | |
| 289 virtual void DidReceiveProvisionalLoadServerRedirect(WebView* webview, | |
| 290 WebKit::WebFrame* frame)
{ | |
| 291 } | |
| 292 | |
| 293 // @method webView:didFailProvisionalLoadWithError:forFrame: | |
| 294 // @abstract Notifies the delegate that the provisional load has failed | |
| 295 // @param webView The WebView sending the message | |
| 296 // @param error The error that occurred | |
| 297 // @param frame The frame for which the error occurred | |
| 298 // @discussion This method is called after the provisional data source has | |
| 299 // failed to load. The frame will continue to display the contents of the | |
| 300 // committed data source if there is one. | |
| 301 // This notification is only received for errors like network errors. | |
| 302 virtual void DidFailProvisionalLoadWithError(WebView* webview, | |
| 303 const WebKit::WebURLError& error, | |
| 304 WebKit::WebFrame* frame) { | |
| 305 } | |
| 306 | |
| 307 // Notifies the delegate to commit data for the given frame. The delegate | |
| 308 // may optionally convert the data before calling CommitDocumentData or | |
| 309 // suppress a call to CommitDocumentData. For example, if CommitDocumentData | |
| 310 // is never called, then an empty document will be created. | |
| 311 virtual void DidReceiveDocumentData(WebKit::WebFrame* frame, | |
| 312 const char* data, | |
| 313 size_t data_len) { | |
| 314 frame->commitDocumentData(data, data_len); | |
| 315 } | |
| 316 | |
| 317 // Notifies the delegate that the load has changed from provisional to | |
| 318 // committed. This method is called after the provisional data source has | |
| 319 // become the committed data source. | |
| 320 // | |
| 321 // In some cases, a single load may be committed more than once. This | |
| 322 // happens in the case of multipart/x-mixed-replace, also known as "server | |
| 323 // push". In this case, a single location change leads to multiple documents | |
| 324 // that are loaded in sequence. When this happens, a new commit will be sent | |
| 325 // for each document. | |
| 326 // | |
| 327 // The "is_new_navigation" flag will be true when a new session history entry | |
| 328 // was created for the load. The frame's GetHistoryState method can be used | |
| 329 // to get the corresponding session history state. | |
| 330 virtual void DidCommitLoadForFrame(WebView* webview, WebKit::WebFrame* frame, | |
| 331 bool is_new_navigation) { | |
| 332 } | |
| 333 | |
| 334 // | |
| 335 // @method webView:didReceiveTitle:forFrame: | |
| 336 // @abstract Notifies the delegate that the page title for a frame has been r
eceived | |
| 337 // @param webView The WebView sending the message | |
| 338 // @param title The new page title | |
| 339 // @param frame The frame for which the title has been received | |
| 340 // @discussion The title may update during loading; clients should be prepare
d for this. | |
| 341 // - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFra
me:(WebFrame *)frame; | |
| 342 virtual void DidReceiveTitle(WebView* webview, | |
| 343 const std::wstring& title, | |
| 344 WebKit::WebFrame* frame) { | |
| 345 } | |
| 346 | |
| 347 // | |
| 348 // @method webView:didFinishLoadForFrame: | |
| 349 // @abstract Notifies the delegate that the committed load of a frame has com
pleted | |
| 350 // @param webView The WebView sending the message | |
| 351 // @param frame The frame that finished loading | |
| 352 // @discussion This method is called after the committed data source of a fra
me has successfully loaded | |
| 353 // and will only be called when all subresources such as images and styleshee
ts are done loading. | |
| 354 // Plug-In content and JavaScript-requested loads may occur after this method
is called. | |
| 355 // - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame; | |
| 356 virtual void DidFinishLoadForFrame(WebView* webview, | |
| 357 WebKit::WebFrame* frame) { | |
| 358 } | |
| 359 | |
| 360 // | |
| 361 // @method webView:didFailLoadWithError:forFrame: | |
| 362 // @abstract Notifies the delegate that the committed load of a frame has fai
led | |
| 363 // @param webView The WebView sending the message | |
| 364 // @param error The error that occurred | |
| 365 // @param frame The frame that failed to load | |
| 366 // @discussion This method is called after a data source has committed but fa
iled to completely load. | |
| 367 // - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error fo
rFrame:(WebFrame *)frame; | |
| 368 virtual void DidFailLoadWithError(WebView* webview, | |
| 369 const WebKit::WebURLError& error, | |
| 370 WebKit::WebFrame* forFrame) { | |
| 371 } | |
| 372 | |
| 373 // Notifies the delegate of a DOMContentLoaded event. | |
| 374 // This is called when the html resource has been loaded, but | |
| 375 // not necessarily all subresources (images, stylesheets). So, this is called | |
| 376 // before DidFinishLoadForFrame. | |
| 377 virtual void DidFinishDocumentLoadForFrame(WebView* webview, WebKit::WebFrame*
frame) { | |
| 378 } | |
| 379 | |
| 380 // This method is called when we load a resource from an in-memory cache. | |
| 381 // A return value of |false| indicates the load should proceed, but WebCore | |
| 382 // appears to largely ignore the return value. | |
| 383 virtual bool DidLoadResourceFromMemoryCache( | |
| 384 WebView* webview, | |
| 385 const WebKit::WebURLRequest& request, | |
| 386 const WebKit::WebURLResponse& response, | |
| 387 WebKit::WebFrame* frame) { | |
| 388 return false; | |
| 389 } | |
| 390 | |
| 391 // This is called after javascript onload handlers have been fired. | |
| 392 virtual void DidHandleOnloadEventsForFrame(WebView* webview, WebKit::WebFrame*
frame) { | |
| 393 } | |
| 394 | |
| 395 // This method is called when anchors within a page have been clicked. | |
| 396 // It is very similar to DidCommitLoadForFrame. | |
| 397 virtual void DidChangeLocationWithinPageForFrame(WebView* webview, | |
| 398 WebKit::WebFrame* frame, | |
| 399 bool is_new_navigation) { | |
| 400 } | |
| 401 | |
| 402 // This is called when the favicon for a frame has been received. | 164 // This is called when the favicon for a frame has been received. |
| 403 virtual void DidReceiveIconForFrame(WebView* webview, WebKit::WebFrame* frame)
{ | 165 virtual void DidReceiveIconForFrame(WebView* webview, WebKit::WebFrame* frame)
{ |
| 404 } | 166 } |
| 405 | 167 |
| 406 // Notifies the delegate that a frame will start a client-side redirect. When | |
| 407 // this function is called, the redirect has not yet been started (it may | |
| 408 // not even be scheduled to happen until some point in the future). When the | |
| 409 // redirect has been cancelled or has succeeded, DidStopClientRedirect will | |
| 410 // be called. | |
| 411 // | |
| 412 // WebKit considers meta refreshes, and setting document.location (regardless | |
| 413 // of when called) as client redirects (possibly among others). | |
| 414 // | |
| 415 // This function is intended to continue progress feedback while a | |
| 416 // client-side redirect is pending. Watch out: WebKit seems to call us twice | |
| 417 // for client redirects, resulting in two calls of this function. | |
| 418 virtual void WillPerformClientRedirect(WebView* webview, | |
| 419 WebKit::WebFrame* frame, | |
| 420 const GURL& src_url, | |
| 421 const GURL& dest_url, | |
| 422 unsigned int delay_seconds, | |
| 423 unsigned int fire_date) { | |
| 424 } | |
| 425 | |
| 426 // Notifies the delegate that a pending client-side redirect has been | |
| 427 // cancelled (for example, if the frame changes before the timeout) or has | |
| 428 // completed successfully. A client-side redirect is the result of setting | |
| 429 // document.location, for example, as opposed to a server side redirect | |
| 430 // which is the result of HTTP headers (see DidReceiveServerRedirect). | |
| 431 // | |
| 432 // On success, this will be called when the provisional load that the client | |
| 433 // side redirect initiated is committed. | |
| 434 // | |
| 435 // See the implementation of FrameLoader::clientRedirectCancelledOrFinished. | |
| 436 virtual void DidCancelClientRedirect(WebView* webview, | |
| 437 WebKit::WebFrame* frame) { | |
| 438 } | |
| 439 | |
| 440 // Notifies the delegate that the load about to be committed for the specified | |
| 441 // webview and frame was due to a client redirect originating from source URL. | |
| 442 // The information/notification obtained from this method is relevant until | |
| 443 // the next provisional load is started, at which point it becomes obsolete. | |
| 444 virtual void DidCompleteClientRedirect(WebView* webview, | |
| 445 WebKit::WebFrame* frame, | |
| 446 const GURL& source) { | |
| 447 } | |
| 448 | |
| 449 // Notifies the delegate that a form is about to be submitted. | |
| 450 virtual void WillSubmitForm(WebView* webview, WebKit::WebFrame* frame, | |
| 451 const WebKit::WebForm& form) { | |
| 452 } | |
| 453 | |
| 454 // | |
| 455 // @method webView:willCloseFrame: | |
| 456 // @abstract Notifies the delegate that a frame will be closed | |
| 457 // @param webView The WebView sending the message | |
| 458 // @param frame The frame that will be closed | |
| 459 // @discussion This method is called right before WebKit is done with the fra
me | |
| 460 // and the objects that it contains. | |
| 461 // - (void)webView:(WebView *)sender willCloseFrame:(WebFrame *)frame; | |
| 462 virtual void WillCloseFrame(WebView* webview, WebKit::WebFrame* frame) { | |
| 463 } | |
| 464 | |
| 465 // ResourceLoadDelegate ---------------------------------------------------- | |
| 466 | |
| 467 // Associates the given identifier with the initial resource request. | |
| 468 // Resource load callbacks will use the identifier throughout the life of the | |
| 469 // request. | |
| 470 virtual void AssignIdentifierToRequest( | |
| 471 WebKit::WebFrame* webframe, | |
| 472 uint32 identifier, | |
| 473 const WebKit::WebURLRequest& request) { | |
| 474 } | |
| 475 | |
| 476 // Notifies the delegate that a request is about to be sent out, giving the | |
| 477 // delegate the opportunity to modify the request. Note that request is | |
| 478 // writable here, and changes to the URL, for example, will change the request | |
| 479 // made. If this request is the result of a redirect, then redirect_response | |
| 480 // will be non-null and contain the response that triggered the redirect. | |
| 481 virtual void WillSendRequest( | |
| 482 WebKit::WebFrame* webframe, | |
| 483 uint32 identifier, | |
| 484 WebKit::WebURLRequest* request, | |
| 485 const WebKit::WebURLResponse& redirect_response) { | |
| 486 } | |
| 487 | |
| 488 virtual void DidReceiveResponse(WebKit::WebFrame* webframe, | |
| 489 uint32 identifier, | |
| 490 const WebKit::WebURLResponse& response) { | |
| 491 } | |
| 492 | |
| 493 // Notifies the delegate that a subresource load has succeeded. | |
| 494 virtual void DidFinishLoading(WebKit::WebFrame* webframe, uint32 identifier) { | |
| 495 } | |
| 496 | |
| 497 // Notifies the delegate that a subresource load has failed, and why. | |
| 498 virtual void DidFailLoadingWithError(WebKit::WebFrame* webframe, | |
| 499 uint32 identifier, | |
| 500 const WebKit::WebURLError& error) { | |
| 501 } | |
| 502 | |
| 503 // ChromeClient ------------------------------------------------------------ | 168 // ChromeClient ------------------------------------------------------------ |
| 504 | 169 |
| 505 // Appends a line to the application's error console. The message contains | 170 // Appends a line to the application's error console. The message contains |
| 506 // an error description or other information, the line_no provides a line | 171 // an error description or other information, the line_no provides a line |
| 507 // number (e.g. for a JavaScript error report), and the source_id contains | 172 // number (e.g. for a JavaScript error report), and the source_id contains |
| 508 // a URL or other description of the source of the message. | 173 // a URL or other description of the source of the message. |
| 509 virtual void AddMessageToConsole(WebView* webview, | 174 virtual void AddMessageToConsole(WebView* webview, |
| 510 const std::wstring& message, | 175 const std::wstring& message, |
| 511 unsigned int line_no, | 176 unsigned int line_no, |
| 512 const std::wstring& source_id) { | 177 const std::wstring& source_id) { |
| 513 } | 178 } |
| 514 | 179 |
| 515 // Queries the browser for suggestions to be shown for the form text field | 180 // Queries the browser for suggestions to be shown for the form text field |
| 516 // named |field_name|. |text| is the text entered by the user so far and | 181 // named |field_name|. |text| is the text entered by the user so far and |
| 517 // |node_id| is the id of the node of the input field. | 182 // |node_id| is the id of the node of the input field. |
| 518 virtual void QueryFormFieldAutofill(const std::wstring& field_name, | 183 virtual void QueryFormFieldAutofill(const std::wstring& field_name, |
| 519 const std::wstring& text, | 184 const std::wstring& text, |
| 520 int64 node_id) { | 185 int64 node_id) { |
| 521 } | 186 } |
| 522 | 187 |
| 523 // Instructs the browser to remove the autofill entry specified from it DB. | 188 // Instructs the browser to remove the autofill entry specified from it DB. |
| 524 virtual void RemoveStoredAutofillEntry(const std::wstring& name, | 189 virtual void RemoveStoredAutofillEntry(const std::wstring& name, |
| 525 const std::wstring& value) { | 190 const std::wstring& value) { |
| 526 } | 191 } |
| 527 | 192 |
| 528 virtual void DidContentsSizeChange(WebKit::WebWidget* webwidget, | |
| 529 int new_width, int new_height) { | |
| 530 } | |
| 531 | |
| 532 // Called to retrieve the provider of desktop notifications. Pointer | 193 // Called to retrieve the provider of desktop notifications. Pointer |
| 533 // is owned by the implementation of WebViewDelegate. | 194 // is owned by the implementation of WebViewDelegate. |
| 534 virtual WebKit::WebNotificationPresenter* GetNotificationPresenter() { | 195 virtual WebKit::WebNotificationPresenter* GetNotificationPresenter() { |
| 535 return NULL; | 196 return NULL; |
| 536 } | 197 } |
| 537 | 198 |
| 538 // UIDelegate -------------------------------------------------------------- | 199 // UIDelegate -------------------------------------------------------------- |
| 539 | 200 |
| 540 // Displays a JavaScript alert panel associated with the given view. Clients | 201 // Displays a JavaScript alert panel associated with the given view. Clients |
| 541 // should visually indicate that this panel comes from JavaScript and some | 202 // should visually indicate that this panel comes from JavaScript and some |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 const WebKit::WebDragData& drag_data, | 310 const WebKit::WebDragData& drag_data, |
| 650 WebKit::WebDragOperationsMask operations_mask) { | 311 WebKit::WebDragOperationsMask operations_mask) { |
| 651 } | 312 } |
| 652 | 313 |
| 653 // Returns the focus to the client. | 314 // Returns the focus to the client. |
| 654 // reverse: Whether the focus should go to the previous (if true) or the next | 315 // reverse: Whether the focus should go to the previous (if true) or the next |
| 655 // focusable element. | 316 // focusable element. |
| 656 virtual void TakeFocus(WebView* webview, bool reverse) { | 317 virtual void TakeFocus(WebView* webview, bool reverse) { |
| 657 } | 318 } |
| 658 | 319 |
| 659 // Displays JS out-of-memory warning in the infobar | |
| 660 virtual void JSOutOfMemory() { | |
| 661 } | |
| 662 | |
| 663 // Notification that a user metric has occurred. | 320 // Notification that a user metric has occurred. |
| 664 virtual void UserMetricsRecordAction(const std::wstring& action) { } | 321 virtual void UserMetricsRecordAction(const std::wstring& action) { } |
| 665 | 322 |
| 666 // ------------------------------------------------------------------------- | 323 // ------------------------------------------------------------------------- |
| 667 | 324 |
| 668 // Notification that a request to download an image has completed. |errored| | 325 // Notification that a request to download an image has completed. |errored| |
| 669 // indicates if there was a network error. The image is empty if there was | 326 // indicates if there was a network error. The image is empty if there was |
| 670 // a network error, the contents of the page couldn't by converted to an | 327 // a network error, the contents of the page couldn't by converted to an |
| 671 // image, or the response from the host was not 200. | 328 // image, or the response from the host was not 200. |
| 672 // NOTE: image is empty if the response didn't contain image data. | 329 // NOTE: image is empty if the response didn't contain image data. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 return std::wstring(); | 397 return std::wstring(); |
| 741 } | 398 } |
| 742 | 399 |
| 743 // Asks the user to print the page or a specific frame. Called in response to | 400 // Asks the user to print the page or a specific frame. Called in response to |
| 744 // a window.print() call. | 401 // a window.print() call. |
| 745 virtual void ScriptedPrint(WebKit::WebFrame* frame) { } | 402 virtual void ScriptedPrint(WebKit::WebFrame* frame) { } |
| 746 | 403 |
| 747 // Called when an item was added to the history | 404 // Called when an item was added to the history |
| 748 virtual void DidAddHistoryItem() { } | 405 virtual void DidAddHistoryItem() { } |
| 749 | 406 |
| 750 WebViewDelegate() { } | |
| 751 | |
| 752 protected: | 407 protected: |
| 753 ~WebViewDelegate() { } | 408 ~WebViewDelegate() { } |
| 754 }; | 409 }; |
| 755 | 410 |
| 756 #endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 411 #endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |