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_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 // Notification that the tab is hung. | 300 // Notification that the tab is hung. |
301 virtual void RendererUnresponsive(WebContents* source) {} | 301 virtual void RendererUnresponsive(WebContents* source) {} |
302 | 302 |
303 // Notification that the tab is no longer hung. | 303 // Notification that the tab is no longer hung. |
304 virtual void RendererResponsive(WebContents* source) {} | 304 virtual void RendererResponsive(WebContents* source) {} |
305 | 305 |
306 // Notification that a worker associated with this tab has crashed. | 306 // Notification that a worker associated with this tab has crashed. |
307 virtual void WorkerCrashed(WebContents* source) {} | 307 virtual void WorkerCrashed(WebContents* source) {} |
308 | 308 |
309 // Invoked when a main fram navigation occurs. | 309 // Invoked when a main fram navigation occurs. |
310 virtual void DidNavigateMainFramePostCommit(WebContents* tab) {} | 310 virtual void DidNavigateMainFramePostCommit(WebContents* source) {} |
311 | 311 |
312 // Invoked when navigating to a pending entry. When invoked the | 312 // Invoked when navigating to a pending entry. When invoked the |
313 // NavigationController has configured its pending entry, but it has not yet | 313 // NavigationController has configured its pending entry, but it has not yet |
314 // been committed. | 314 // been committed. |
315 virtual void DidNavigateToPendingEntry(WebContents* tab) {} | 315 virtual void DidNavigateToPendingEntry(WebContents* source) {} |
316 | 316 |
317 // Returns a pointer to a service to create JavaScript dialogs. May return | 317 // Returns a pointer to a service to create JavaScript dialogs. May return |
318 // NULL in which case dialogs aren't shown. | 318 // NULL in which case dialogs aren't shown. |
319 virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator(); | 319 virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator(); |
320 | 320 |
321 // Called when color chooser should open. Returns the opened color chooser. | 321 // Called when color chooser should open. Returns the opened color chooser. |
322 virtual content::ColorChooser* OpenColorChooser(WebContents* tab, | 322 virtual content::ColorChooser* OpenColorChooser(WebContents* web_contents, |
323 int color_chooser_id, | 323 int color_chooser_id, |
324 const SkColor& color); | 324 const SkColor& color); |
325 | 325 |
326 virtual void DidEndColorChooser() {} | 326 virtual void DidEndColorChooser() {} |
327 | 327 |
328 // Called when a file selection is to be done. | 328 // Called when a file selection is to be done. |
329 virtual void RunFileChooser(WebContents* tab, | 329 virtual void RunFileChooser(WebContents* web_contents, |
330 const FileChooserParams& params) {} | 330 const FileChooserParams& params) {} |
331 | 331 |
332 // Request to enumerate a directory. This is equivalent to running the file | 332 // Request to enumerate a directory. This is equivalent to running the file |
333 // chooser in directory-enumeration mode and having the user select the given | 333 // chooser in directory-enumeration mode and having the user select the given |
334 // directory. | 334 // directory. |
335 virtual void EnumerateDirectory(WebContents* tab, | 335 virtual void EnumerateDirectory(WebContents* web_contents, |
336 int request_id, | 336 int request_id, |
337 const FilePath& path) {} | 337 const FilePath& path) {} |
338 | 338 |
339 // Called when the renderer puts a tab into or out of fullscreen mode. | 339 // Called when the renderer puts a tab into or out of fullscreen mode. |
340 virtual void ToggleFullscreenModeForTab(WebContents* tab, | 340 virtual void ToggleFullscreenModeForTab(WebContents* web_contents, |
341 bool enter_fullscreen) {} | 341 bool enter_fullscreen) {} |
342 virtual bool IsFullscreenForTabOrPending(const WebContents* tab) const; | 342 virtual bool IsFullscreenForTabOrPending( |
| 343 const WebContents* web_contents) const; |
343 | 344 |
344 // Called when a Javascript out of memory notification is received. | 345 // Called when a Javascript out of memory notification is received. |
345 virtual void JSOutOfMemory(WebContents* tab) {} | 346 virtual void JSOutOfMemory(WebContents* web_contents) {} |
346 | 347 |
347 // Register a new handler for URL requests with the given scheme. | 348 // Register a new handler for URL requests with the given scheme. |
348 virtual void RegisterProtocolHandler(WebContents* tab, | 349 virtual void RegisterProtocolHandler(WebContents* web_contents, |
349 const std::string& protocol, | 350 const std::string& protocol, |
350 const GURL& url, | 351 const GURL& url, |
351 const string16& title) {} | 352 const string16& title) {} |
352 | 353 |
353 // Register a new handler for Intents with the given action and type filter. | 354 // Register a new handler for Intents with the given action and type filter. |
354 virtual void RegisterIntentHandler(WebContents* tab, | 355 virtual void RegisterIntentHandler(WebContents* web_contents, |
355 const string16& action, | 356 const string16& action, |
356 const string16& type, | 357 const string16& type, |
357 const string16& href, | 358 const string16& href, |
358 const string16& title, | 359 const string16& title, |
359 const string16& disposition) {} | 360 const string16& disposition) {} |
360 | 361 |
361 // Web Intents notification handler. See WebIntentsDispatcher for | 362 // Web Intents notification handler. See WebIntentsDispatcher for |
362 // documentation of callee responsibility for the dispatcher. | 363 // documentation of callee responsibility for the dispatcher. |
363 virtual void WebIntentDispatch(WebContents* tab, | 364 virtual void WebIntentDispatch(WebContents* web_contents, |
364 WebIntentsDispatcher* intents_dispatcher); | 365 WebIntentsDispatcher* intents_dispatcher); |
365 | 366 |
366 // Result of string search in the page. This includes the number of matches | 367 // Result of string search in the page. This includes the number of matches |
367 // found and the selection rect (in screen coordinates) for the string found. | 368 // found and the selection rect (in screen coordinates) for the string found. |
368 // If |final_update| is false, it indicates that more results follow. | 369 // If |final_update| is false, it indicates that more results follow. |
369 virtual void FindReply(WebContents* tab, | 370 virtual void FindReply(WebContents* web_contents, |
370 int request_id, | 371 int request_id, |
371 int number_of_matches, | 372 int number_of_matches, |
372 const gfx::Rect& selection_rect, | 373 const gfx::Rect& selection_rect, |
373 int active_match_ordinal, | 374 int active_match_ordinal, |
374 bool final_update) {} | 375 bool final_update) {} |
375 | 376 |
376 // Notification that a plugin has crashed. | 377 // Notification that a plugin has crashed. |
377 virtual void CrashedPlugin(WebContents* tab, const FilePath& plugin_path) {} | 378 virtual void CrashedPlugin(WebContents* web_contents, |
| 379 const FilePath& plugin_path) {} |
378 | 380 |
379 // Notication that the given plugin has hung or become unhung. This | 381 // Notication that the given plugin has hung or become unhung. This |
380 // notification is only for Pepper plugins. | 382 // notification is only for Pepper plugins. |
381 // | 383 // |
382 // The plugin_child_id is the unique child process ID from the plugin. Note | 384 // The plugin_child_id is the unique child process ID from the plugin. Note |
383 // that this ID is supplied by the renderer, so should be validated before | 385 // that this ID is supplied by the renderer, so should be validated before |
384 // it's used for anything in case there's an exploited renderer. | 386 // it's used for anything in case there's an exploited renderer. |
385 virtual void PluginHungStatusChanged(WebContents* tab, | 387 virtual void PluginHungStatusChanged(WebContents* web_contents, |
386 int plugin_child_id, | 388 int plugin_child_id, |
387 const FilePath& plugin_path, | 389 const FilePath& plugin_path, |
388 bool is_hung) {} | 390 bool is_hung) {} |
389 | 391 |
390 // Invoked when the preferred size of the contents has been changed. | 392 // Invoked when the preferred size of the contents has been changed. |
391 virtual void UpdatePreferredSize(WebContents* tab, | 393 virtual void UpdatePreferredSize(WebContents* web_contents, |
392 const gfx::Size& pref_size) {} | 394 const gfx::Size& pref_size) {} |
393 | 395 |
394 // Invoked when the contents auto-resized and the container should match it. | 396 // Invoked when the contents auto-resized and the container should match it. |
395 virtual void ResizeDueToAutoResize(WebContents* tab, | 397 virtual void ResizeDueToAutoResize(WebContents* web_contents, |
396 const gfx::Size& new_size) {} | 398 const gfx::Size& new_size) {} |
397 | 399 |
398 // Notification message from HTML UI. | 400 // Notification message from HTML UI. |
399 virtual void WebUISend(WebContents* tab, | 401 virtual void WebUISend(WebContents* web_contents, |
400 const GURL& source_url, | 402 const GURL& source_url, |
401 const std::string& name, | 403 const std::string& name, |
402 const base::ListValue& args) {} | 404 const base::ListValue& args) {} |
403 | 405 |
404 // Requests to lock the mouse. Once the request is approved or rejected, | 406 // Requests to lock the mouse. Once the request is approved or rejected, |
405 // GotResponseToLockMouseRequest() will be called on the requesting tab | 407 // GotResponseToLockMouseRequest() will be called on the requesting tab |
406 // contents. | 408 // contents. |
407 virtual void RequestToLockMouse(WebContents* tab) {} | 409 virtual void RequestToLockMouse(WebContents* web_contents) {} |
408 | 410 |
409 // Notification that the page has lost the mouse lock. | 411 // Notification that the page has lost the mouse lock. |
410 virtual void LostMouseLock() {} | 412 virtual void LostMouseLock() {} |
411 | 413 |
412 protected: | 414 protected: |
413 virtual ~WebContentsDelegate(); | 415 virtual ~WebContentsDelegate(); |
414 | 416 |
415 private: | 417 private: |
416 friend class ::WebContentsImpl; | 418 friend class ::WebContentsImpl; |
417 | 419 |
418 // Called when |this| becomes the WebContentsDelegate for |source|. | 420 // Called when |this| becomes the WebContentsDelegate for |source|. |
419 void Attach(WebContents* source); | 421 void Attach(WebContents* source); |
420 | 422 |
421 // Called when |this| is no longer the WebContentsDelegate for |source|. | 423 // Called when |this| is no longer the WebContentsDelegate for |source|. |
422 void Detach(WebContents* source); | 424 void Detach(WebContents* source); |
423 | 425 |
424 // The WebContents that this is currently a delegate for. | 426 // The WebContents that this is currently a delegate for. |
425 std::set<WebContents*> attached_contents_; | 427 std::set<WebContents*> attached_contents_; |
426 }; | 428 }; |
427 | 429 |
428 } // namespace content | 430 } // namespace content |
429 | 431 |
430 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 432 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
OLD | NEW |