| 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 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 namespace history { | 51 namespace history { |
| 52 class HistoryAddPageArgs; | 52 class HistoryAddPageArgs; |
| 53 } | 53 } |
| 54 | 54 |
| 55 namespace webkit_glue { | 55 namespace webkit_glue { |
| 56 struct WebIntentData; | 56 struct WebIntentData; |
| 57 struct WebIntentServiceData; | 57 struct WebIntentServiceData; |
| 58 } | 58 } |
| 59 | 59 |
| 60 namespace WebKit { |
| 61 class WebLayer; |
| 62 } |
| 63 |
| 60 namespace content { | 64 namespace content { |
| 61 | 65 |
| 62 struct OpenURLParams; | 66 struct OpenURLParams; |
| 63 | 67 |
| 64 typedef base::Callback< void(const MediaStreamDevices&) > MediaResponseCallback; | 68 typedef base::Callback< void(const MediaStreamDevices&) > MediaResponseCallback; |
| 65 | 69 |
| 66 // Objects implement this interface to get notified about changes in the | 70 // Objects implement this interface to get notified about changes in the |
| 67 // WebContents and to provide necessary functionality. | 71 // WebContents and to provide necessary functionality. |
| 68 class CONTENT_EXPORT WebContentsDelegate { | 72 class CONTENT_EXPORT WebContentsDelegate { |
| 69 public: | 73 public: |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // typically happens when popups are created. | 304 // typically happens when popups are created. |
| 301 virtual void WebContentsCreated(WebContents* source_contents, | 305 virtual void WebContentsCreated(WebContents* source_contents, |
| 302 int64 source_frame_id, | 306 int64 source_frame_id, |
| 303 const GURL& target_url, | 307 const GURL& target_url, |
| 304 WebContents* new_contents) {} | 308 WebContents* new_contents) {} |
| 305 | 309 |
| 306 // Notifies the delegate that the content restrictions for this tab has | 310 // Notifies the delegate that the content restrictions for this tab has |
| 307 // changed. | 311 // changed. |
| 308 virtual void ContentRestrictionsChanged(WebContents* source) {} | 312 virtual void ContentRestrictionsChanged(WebContents* source) {} |
| 309 | 313 |
| 310 #if defined(OS_ANDROID) | |
| 311 // Returns true if the delegate wants to handle the url instead. Default | |
| 312 // returns false. | |
| 313 virtual bool ShouldOverrideLoading(const GURL& url); | |
| 314 #endif | |
| 315 | |
| 316 // Notification that the tab is hung. | 314 // Notification that the tab is hung. |
| 317 virtual void RendererUnresponsive(WebContents* source) {} | 315 virtual void RendererUnresponsive(WebContents* source) {} |
| 318 | 316 |
| 319 // Notification that the tab is no longer hung. | 317 // Notification that the tab is no longer hung. |
| 320 virtual void RendererResponsive(WebContents* source) {} | 318 virtual void RendererResponsive(WebContents* source) {} |
| 321 | 319 |
| 322 // Notification that a worker associated with this tab has crashed. | 320 // Notification that a worker associated with this tab has crashed. |
| 323 virtual void WorkerCrashed(WebContents* source) {} | 321 virtual void WorkerCrashed(WebContents* source) {} |
| 324 | 322 |
| 325 // Invoked when a main fram navigation occurs. | 323 // Invoked when a main fram navigation occurs. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 // Asks permission to use the camera and/or microphone. If permission is | 419 // Asks permission to use the camera and/or microphone. If permission is |
| 422 // granted, a call should be made to |callback| with the devices. If the | 420 // granted, a call should be made to |callback| with the devices. If the |
| 423 // request is denied, a call should be made to |callback| with an empty list | 421 // request is denied, a call should be made to |callback| with an empty list |
| 424 // of devices. |request| has the details of the request (e.g. which of audio | 422 // of devices. |request| has the details of the request (e.g. which of audio |
| 425 // and/or video devices are requested, and lists of available devices). | 423 // and/or video devices are requested, and lists of available devices). |
| 426 virtual void RequestMediaAccessPermission( | 424 virtual void RequestMediaAccessPermission( |
| 427 WebContents* web_contents, | 425 WebContents* web_contents, |
| 428 const MediaStreamRequest* request, | 426 const MediaStreamRequest* request, |
| 429 const MediaResponseCallback& callback) {} | 427 const MediaResponseCallback& callback) {} |
| 430 | 428 |
| 429 #if defined(OS_ANDROID) |
| 430 // Returns true if the delegate wants to handle the url instead. Default |
| 431 // returns false. |
| 432 virtual bool ShouldOverrideLoading(const GURL& url); |
| 433 |
| 434 // Called when a compositing layer becomes available for this web contents |
| 435 // so the delegate can add it to the layer tree. |
| 436 virtual void AttachLayer(WebContents* web_contents, |
| 437 WebKit::WebLayer* layer) {} |
| 438 |
| 439 // Called before a compositing layer becomes invalid so the delegate can |
| 440 // remove it from the layer tree. |
| 441 virtual void RemoveLayer(WebContents* web_contents, |
| 442 WebKit::WebLayer* layer) {} |
| 443 #endif |
| 444 |
| 431 protected: | 445 protected: |
| 432 virtual ~WebContentsDelegate(); | 446 virtual ~WebContentsDelegate(); |
| 433 | 447 |
| 434 private: | 448 private: |
| 435 friend class ::WebContentsImpl; | 449 friend class ::WebContentsImpl; |
| 436 | 450 |
| 437 // Called when |this| becomes the WebContentsDelegate for |source|. | 451 // Called when |this| becomes the WebContentsDelegate for |source|. |
| 438 void Attach(WebContents* source); | 452 void Attach(WebContents* source); |
| 439 | 453 |
| 440 // Called when |this| is no longer the WebContentsDelegate for |source|. | 454 // Called when |this| is no longer the WebContentsDelegate for |source|. |
| 441 void Detach(WebContents* source); | 455 void Detach(WebContents* source); |
| 442 | 456 |
| 443 // The WebContents that this is currently a delegate for. | 457 // The WebContents that this is currently a delegate for. |
| 444 std::set<WebContents*> attached_contents_; | 458 std::set<WebContents*> attached_contents_; |
| 445 }; | 459 }; |
| 446 | 460 |
| 447 } // namespace content | 461 } // namespace content |
| 448 | 462 |
| 449 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 463 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
| OLD | NEW |