OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // This frame is about to be closed. This is called after frameDetached, | 145 // This frame is about to be closed. This is called after frameDetached, |
146 // when the document is being unloaded, due to new one committing. | 146 // when the document is being unloaded, due to new one committing. |
147 virtual void willClose(WebFrame*) { } | 147 virtual void willClose(WebFrame*) { } |
148 | 148 |
149 // This frame's name has changed. | 149 // This frame's name has changed. |
150 virtual void didChangeName(WebLocalFrame*, const WebString&) { } | 150 virtual void didChangeName(WebLocalFrame*, const WebString&) { } |
151 | 151 |
152 // Called when a watched CSS selector matches or stops matching. | 152 // Called when a watched CSS selector matches or stops matching. |
153 virtual void didMatchCSS(WebLocalFrame*, const WebVector<WebString>& newlyMa
tchingSelectors, const WebVector<WebString>& stoppedMatchingSelectors) { } | 153 virtual void didMatchCSS(WebLocalFrame*, const WebVector<WebString>& newlyMa
tchingSelectors, const WebVector<WebString>& stoppedMatchingSelectors) { } |
154 | 154 |
| 155 |
155 // Console messages ---------------------------------------------------- | 156 // Console messages ---------------------------------------------------- |
156 | 157 |
157 // Whether or not we should report a detailed message for the given source. | 158 // Whether or not we should report a detailed message for the given source. |
158 virtual bool shouldReportDetailedMessageForSource(const WebString& source) {
return false; } | 159 virtual bool shouldReportDetailedMessageForSource(const WebString& source) {
return false; } |
159 | 160 |
160 // A new message was added to the console. | 161 // A new message was added to the console. |
161 virtual void didAddMessageToConsole(const WebConsoleMessage&, const WebStrin
g& sourceName, unsigned sourceLine, const WebString& stackTrace) { } | 162 virtual void didAddMessageToConsole(const WebConsoleMessage&, const WebStrin
g& sourceName, unsigned sourceLine, const WebString& stackTrace) { } |
162 | 163 |
| 164 |
163 // Load commands ------------------------------------------------------- | 165 // Load commands ------------------------------------------------------- |
164 | 166 |
165 // The client should handle the navigation externally. | 167 // The client should handle the navigation externally. |
166 virtual void loadURLExternally( | 168 virtual void loadURLExternally( |
167 WebLocalFrame*, const WebURLRequest&, WebNavigationPolicy) { } | 169 WebLocalFrame*, const WebURLRequest&, WebNavigationPolicy) { } |
168 virtual void loadURLExternally( | 170 virtual void loadURLExternally( |
169 WebLocalFrame*, const WebURLRequest&, WebNavigationPolicy, const WebStri
ng& downloadName) { } | 171 WebLocalFrame*, const WebURLRequest&, WebNavigationPolicy, const WebStri
ng& downloadName) { } |
170 | 172 |
171 | 173 |
172 // Navigational queries ------------------------------------------------ | 174 // Navigational queries ------------------------------------------------ |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // The navigation resulted in no change to the documents within the page. | 249 // The navigation resulted in no change to the documents within the page. |
248 // For example, the navigation may have just resulted in scrolling to a | 250 // For example, the navigation may have just resulted in scrolling to a |
249 // named anchor or a PopState event may have been dispatched. | 251 // named anchor or a PopState event may have been dispatched. |
250 virtual void didNavigateWithinPage(WebLocalFrame*, bool isNewNavigation) { } | 252 virtual void didNavigateWithinPage(WebLocalFrame*, bool isNewNavigation) { } |
251 | 253 |
252 // Called upon update to scroll position, document state, and other | 254 // Called upon update to scroll position, document state, and other |
253 // non-navigational events related to the data held by WebHistoryItem. | 255 // non-navigational events related to the data held by WebHistoryItem. |
254 // WARNING: This method may be called very frequently. | 256 // WARNING: This method may be called very frequently. |
255 virtual void didUpdateCurrentHistoryItem(WebLocalFrame*) { } | 257 virtual void didUpdateCurrentHistoryItem(WebLocalFrame*) { } |
256 | 258 |
| 259 |
257 // Editing ------------------------------------------------------------- | 260 // Editing ------------------------------------------------------------- |
258 | 261 |
259 // These methods allow the client to intercept and overrule editing | 262 // These methods allow the client to intercept and overrule editing |
260 // operations. | 263 // operations. |
261 virtual void didChangeSelection(bool isSelectionEmpty) { } | 264 virtual void didChangeSelection(bool isSelectionEmpty) { } |
262 | 265 |
263 | 266 |
| 267 // Dialogs ------------------------------------------------------------- |
| 268 |
| 269 // Displays a modal alert dialog containing the given message. Returns |
| 270 // once the user dismisses the dialog. |
| 271 virtual void runModalAlertDialog(const WebString& message) { } |
| 272 |
| 273 // Displays a modal confirmation dialog with the given message as |
| 274 // description and OK/Cancel choices. Returns true if the user selects |
| 275 // 'OK' or false otherwise. |
| 276 virtual bool runModalConfirmDialog(const WebString& message) { return false;
} |
| 277 |
| 278 // Displays a modal input dialog with the given message as description |
| 279 // and OK/Cancel choices. The input field is pre-filled with |
| 280 // defaultValue. Returns true if the user selects 'OK' or false |
| 281 // otherwise. Upon returning true, actualValue contains the value of |
| 282 // the input field. |
| 283 virtual bool runModalPromptDialog( |
| 284 const WebString& message, const WebString& defaultValue, |
| 285 WebString* actualValue) { return false; } |
| 286 |
| 287 // Displays a modal confirmation dialog containing the given message as |
| 288 // description and OK/Cancel choices, where 'OK' means that it is okay |
| 289 // to proceed with closing the view. Returns true if the user selects |
| 290 // 'OK' or false otherwise. |
| 291 virtual bool runModalBeforeUnloadDialog( |
| 292 bool isReload, const WebString& message) { return true; } |
| 293 |
| 294 |
264 // UI ------------------------------------------------------------------ | 295 // UI ------------------------------------------------------------------ |
265 | 296 |
266 // Shows a context menu with commands relevant to a specific element on | 297 // Shows a context menu with commands relevant to a specific element on |
267 // the given frame. Additional context data is supplied. | 298 // the given frame. Additional context data is supplied. |
268 virtual void showContextMenu(const WebContextMenuData&) { } | 299 virtual void showContextMenu(const WebContextMenuData&) { } |
269 | 300 |
270 // Called when the data attached to the currently displayed context menu is | 301 // Called when the data attached to the currently displayed context menu is |
271 // invalidated. The context menu may be closed if possible. | 302 // invalidated. The context menu may be closed if possible. |
272 virtual void clearContextMenu() { } | 303 virtual void clearContextMenu() { } |
273 | 304 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 349 |
319 // A reflected XSS was encountered in the page and suppressed. | 350 // A reflected XSS was encountered in the page and suppressed. |
320 virtual void didDetectXSS(WebLocalFrame*, const WebURL&, bool didBlockEntire
Page) { } | 351 virtual void didDetectXSS(WebLocalFrame*, const WebURL&, bool didBlockEntire
Page) { } |
321 | 352 |
322 // A PingLoader was created, and a request dispatched to a URL. | 353 // A PingLoader was created, and a request dispatched to a URL. |
323 virtual void didDispatchPingLoader(WebLocalFrame*, const WebURL&) { } | 354 virtual void didDispatchPingLoader(WebLocalFrame*, const WebURL&) { } |
324 | 355 |
325 // The loaders in this frame have been stopped. | 356 // The loaders in this frame have been stopped. |
326 virtual void didAbortLoading(WebLocalFrame*) { } | 357 virtual void didAbortLoading(WebLocalFrame*) { } |
327 | 358 |
| 359 |
328 // Script notifications ------------------------------------------------ | 360 // Script notifications ------------------------------------------------ |
329 | 361 |
330 // Notifies that a new script context has been created for this frame. | 362 // Notifies that a new script context has been created for this frame. |
331 // This is similar to didClearWindowObject but only called once per | 363 // This is similar to didClearWindowObject but only called once per |
332 // frame context. | 364 // frame context. |
333 virtual void didCreateScriptContext(WebLocalFrame*, v8::Handle<v8::Context>,
int extensionGroup, int worldId) { } | 365 virtual void didCreateScriptContext(WebLocalFrame*, v8::Handle<v8::Context>,
int extensionGroup, int worldId) { } |
334 | 366 |
335 // WebKit is about to release its reference to a v8 context for a frame. | 367 // WebKit is about to release its reference to a v8 context for a frame. |
336 virtual void willReleaseScriptContext(WebLocalFrame*, v8::Handle<v8::Context
>, int worldId) { } | 368 virtual void willReleaseScriptContext(WebLocalFrame*, v8::Handle<v8::Context
>, int worldId) { } |
337 | 369 |
| 370 |
338 // Geometry notifications ---------------------------------------------- | 371 // Geometry notifications ---------------------------------------------- |
339 | 372 |
340 // The frame's document finished the initial non-empty layout of a page. | 373 // The frame's document finished the initial non-empty layout of a page. |
341 virtual void didFirstVisuallyNonEmptyLayout(WebLocalFrame*) { } | 374 virtual void didFirstVisuallyNonEmptyLayout(WebLocalFrame*) { } |
342 | 375 |
343 // The size of the content area changed. | 376 // The size of the content area changed. |
344 virtual void didChangeContentsSize(WebLocalFrame*, const WebSize&) { } | 377 virtual void didChangeContentsSize(WebLocalFrame*, const WebSize&) { } |
345 | 378 |
346 // The main frame scrolled. | 379 // The main frame scrolled. |
347 virtual void didChangeScrollOffset(WebLocalFrame*) { } | 380 virtual void didChangeScrollOffset(WebLocalFrame*) { } |
348 | 381 |
349 // If the frame is loading an HTML document, this will be called to | 382 // If the frame is loading an HTML document, this will be called to |
350 // notify that the <body> will be attached soon. | 383 // notify that the <body> will be attached soon. |
351 virtual void willInsertBody(WebLocalFrame*) { } | 384 virtual void willInsertBody(WebLocalFrame*) { } |
352 | 385 |
| 386 |
353 // Find-in-page notifications ------------------------------------------ | 387 // Find-in-page notifications ------------------------------------------ |
354 | 388 |
355 // Notifies how many matches have been found so far, for a given | 389 // Notifies how many matches have been found so far, for a given |
356 // identifier. |finalUpdate| specifies whether this is the last update | 390 // identifier. |finalUpdate| specifies whether this is the last update |
357 // (all frames have completed scoping). | 391 // (all frames have completed scoping). |
358 virtual void reportFindInPageMatchCount( | 392 virtual void reportFindInPageMatchCount( |
359 int identifier, int count, bool finalUpdate) { } | 393 int identifier, int count, bool finalUpdate) { } |
360 | 394 |
361 // Notifies what tick-mark rect is currently selected. The given | 395 // Notifies what tick-mark rect is currently selected. The given |
362 // identifier lets the client know which request this message belongs | 396 // identifier lets the client know which request this message belongs |
363 // to, so that it can choose to ignore the message if it has moved on | 397 // to, so that it can choose to ignore the message if it has moved on |
364 // to other things. The selection rect is expected to have coordinates | 398 // to other things. The selection rect is expected to have coordinates |
365 // relative to the top left corner of the web page area and represent | 399 // relative to the top left corner of the web page area and represent |
366 // where on the screen the selection rect is currently located. | 400 // where on the screen the selection rect is currently located. |
367 virtual void reportFindInPageSelection( | 401 virtual void reportFindInPageSelection( |
368 int identifier, int activeMatchOrdinal, const WebRect& selection) { } | 402 int identifier, int activeMatchOrdinal, const WebRect& selection) { } |
369 | 403 |
| 404 |
370 // Quota --------------------------------------------------------- | 405 // Quota --------------------------------------------------------- |
371 | 406 |
372 // Requests a new quota size for the origin's storage. | 407 // Requests a new quota size for the origin's storage. |
373 // |newQuotaInBytes| indicates how much storage space (in bytes) the | 408 // |newQuotaInBytes| indicates how much storage space (in bytes) the |
374 // caller expects to need. | 409 // caller expects to need. |
375 // WebStorageQuotaCallbacks::didGrantStorageQuota will be called when | 410 // WebStorageQuotaCallbacks::didGrantStorageQuota will be called when |
376 // a new quota is granted. WebStorageQuotaCallbacks::didFail | 411 // a new quota is granted. WebStorageQuotaCallbacks::didFail |
377 // is called with an error code otherwise. | 412 // is called with an error code otherwise. |
378 // Note that the requesting quota size may not always be granted and | 413 // Note that the requesting quota size may not always be granted and |
379 // a smaller amount of quota than requested might be returned. | 414 // a smaller amount of quota than requested might be returned. |
380 virtual void requestStorageQuota( | 415 virtual void requestStorageQuota( |
381 WebLocalFrame*, WebStorageQuotaType, | 416 WebLocalFrame*, WebStorageQuotaType, |
382 unsigned long long newQuotaInBytes, | 417 unsigned long long newQuotaInBytes, |
383 WebStorageQuotaCallbacks) { } | 418 WebStorageQuotaCallbacks) { } |
384 | 419 |
385 // WebSocket ----------------------------------------------------- | 420 // WebSocket ----------------------------------------------------- |
386 | 421 |
387 // A WebSocket object is going to open new stream connection. | 422 // A WebSocket object is going to open new stream connection. |
388 virtual void willOpenSocketStream(WebSocketStreamHandle*) { } | 423 virtual void willOpenSocketStream(WebSocketStreamHandle*) { } |
389 | 424 |
| 425 |
390 // MediaStream ----------------------------------------------------- | 426 // MediaStream ----------------------------------------------------- |
391 | 427 |
392 // A new WebRTCPeerConnectionHandler is created. | 428 // A new WebRTCPeerConnectionHandler is created. |
393 virtual void willStartUsingPeerConnectionHandler(WebLocalFrame*, WebRTCPeerC
onnectionHandler*) { } | 429 virtual void willStartUsingPeerConnectionHandler(WebLocalFrame*, WebRTCPeerC
onnectionHandler*) { } |
394 | 430 |
| 431 |
395 // Messages ------------------------------------------------------ | 432 // Messages ------------------------------------------------------ |
396 | 433 |
397 // Notifies the embedder that a postMessage was issued on this frame, and | 434 // Notifies the embedder that a postMessage was issued on this frame, and |
398 // gives the embedder a chance to handle it instead of WebKit. Returns true | 435 // gives the embedder a chance to handle it instead of WebKit. Returns true |
399 // if the embedder handled it. | 436 // if the embedder handled it. |
400 virtual bool willCheckAndDispatchMessageEvent( | 437 virtual bool willCheckAndDispatchMessageEvent( |
401 WebLocalFrame* sourceFrame, | 438 WebLocalFrame* sourceFrame, |
402 WebFrame* targetFrame, | 439 WebFrame* targetFrame, |
403 WebSecurityOrigin target, | 440 WebSecurityOrigin target, |
404 WebDOMMessageEvent event) { return false; } | 441 WebDOMMessageEvent event) { return false; } |
405 | 442 |
406 // Asks the embedder if a specific user agent should be used for the given | 443 // Asks the embedder if a specific user agent should be used for the given |
407 // URL. Non-empty strings indicate an override should be used. Otherwise, | 444 // URL. Non-empty strings indicate an override should be used. Otherwise, |
408 // Platform::current()->userAgent() will be called to provide one. | 445 // Platform::current()->userAgent() will be called to provide one. |
409 virtual WebString userAgentOverride(WebLocalFrame*, const WebURL& url) { ret
urn WebString(); } | 446 virtual WebString userAgentOverride(WebLocalFrame*, const WebURL& url) { ret
urn WebString(); } |
410 | 447 |
411 // Asks the embedder what value the network stack will send for the DNT | 448 // Asks the embedder what value the network stack will send for the DNT |
412 // header. An empty string indicates that no DNT header will be send. | 449 // header. An empty string indicates that no DNT header will be send. |
413 virtual WebString doNotTrackValue(WebLocalFrame*) { return WebString(); } | 450 virtual WebString doNotTrackValue(WebLocalFrame*) { return WebString(); } |
414 | 451 |
| 452 |
415 // WebGL ------------------------------------------------------ | 453 // WebGL ------------------------------------------------------ |
416 | 454 |
417 // Asks the embedder whether WebGL is allowed for the given WebFrame. | 455 // Asks the embedder whether WebGL is allowed for the given WebFrame. |
418 // This call is placed here instead of WebPermissionClient because this | 456 // This call is placed here instead of WebPermissionClient because this |
419 // class is implemented in content/, and putting it here avoids adding | 457 // class is implemented in content/, and putting it here avoids adding |
420 // more public content/ APIs. | 458 // more public content/ APIs. |
421 virtual bool allowWebGL(WebLocalFrame*, bool defaultValue) { return defaultV
alue; } | 459 virtual bool allowWebGL(WebLocalFrame*, bool defaultValue) { return defaultV
alue; } |
422 | 460 |
423 // Notifies the client that a WebGL context was lost on this page with the | 461 // Notifies the client that a WebGL context was lost on this page with the |
424 // given reason (one of the GL_ARB_robustness status codes; see | 462 // given reason (one of the GL_ARB_robustness status codes; see |
425 // Extensions3D.h in WebCore/platform/graphics). | 463 // Extensions3D.h in WebCore/platform/graphics). |
426 virtual void didLoseWebGLContext(WebLocalFrame*, int) { } | 464 virtual void didLoseWebGLContext(WebLocalFrame*, int) { } |
427 | 465 |
428 // FIXME: Remove this method once we have input routing in the browser | 466 // FIXME: Remove this method once we have input routing in the browser |
429 // process. See http://crbug.com/339659. | 467 // process. See http://crbug.com/339659. |
430 virtual void forwardInputEvent(const WebInputEvent*) { } | 468 virtual void forwardInputEvent(const WebInputEvent*) { } |
431 | 469 |
432 // Send initial drawing parameters to a child frame that is being rendered o
ut of process. | 470 // Send initial drawing parameters to a child frame that is being rendered o
ut of process. |
433 virtual void initializeChildFrame(const WebRect& frameRect, float scaleFacto
r) { } | 471 virtual void initializeChildFrame(const WebRect& frameRect, float scaleFacto
r) { } |
434 | 472 |
435 protected: | 473 protected: |
436 ~WebFrameClient() { } | 474 ~WebFrameClient() { } |
437 }; | 475 }; |
438 | 476 |
439 } // namespace blink | 477 } // namespace blink |
440 | 478 |
441 #endif | 479 #endif |
OLD | NEW |