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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" |
13 #include "base/string16.h" | 14 #include "base/string16.h" |
14 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
15 #include "content/public/browser/navigation_type.h" | 16 #include "content/public/browser/navigation_type.h" |
| 17 #include "content/public/common/media_stream_request.h" |
16 #include "content/public/common/page_transition_types.h" | 18 #include "content/public/common/page_transition_types.h" |
17 #include "content/public/common/window_container_type.h" | 19 #include "content/public/common/window_container_type.h" |
18 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
19 #include "ui/gfx/native_widget_types.h" | 21 #include "ui/gfx/native_widget_types.h" |
20 #include "webkit/glue/window_open_disposition.h" | 22 #include "webkit/glue/window_open_disposition.h" |
21 | 23 |
22 class FilePath; | 24 class FilePath; |
23 class GURL; | 25 class GURL; |
24 class WebContentsImpl; | 26 class WebContentsImpl; |
25 | 27 |
(...skipping 27 matching lines...) Expand all Loading... |
53 | 55 |
54 namespace webkit_glue { | 56 namespace webkit_glue { |
55 struct WebIntentData; | 57 struct WebIntentData; |
56 struct WebIntentServiceData; | 58 struct WebIntentServiceData; |
57 } | 59 } |
58 | 60 |
59 namespace content { | 61 namespace content { |
60 | 62 |
61 struct OpenURLParams; | 63 struct OpenURLParams; |
62 | 64 |
| 65 typedef base::Callback< void(const MediaStreamDevices&) > MediaResponseCallback; |
| 66 |
63 // Objects implement this interface to get notified about changes in the | 67 // Objects implement this interface to get notified about changes in the |
64 // WebContents and to provide necessary functionality. | 68 // WebContents and to provide necessary functionality. |
65 class CONTENT_EXPORT WebContentsDelegate { | 69 class CONTENT_EXPORT WebContentsDelegate { |
66 public: | 70 public: |
67 WebContentsDelegate(); | 71 WebContentsDelegate(); |
68 | 72 |
69 // Opens a new URL inside the passed in WebContents (if source is 0 open | 73 // Opens a new URL inside the passed in WebContents (if source is 0 open |
70 // in the current front-most tab), unless |disposition| indicates the url | 74 // in the current front-most tab), unless |disposition| indicates the url |
71 // should be opened in a new tab or window. | 75 // should be opened in a new tab or window. |
72 // | 76 // |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 virtual void WebUISend(WebContents* web_contents, | 404 virtual void WebUISend(WebContents* web_contents, |
401 const GURL& source_url, | 405 const GURL& source_url, |
402 const std::string& name, | 406 const std::string& name, |
403 const base::ListValue& args) {} | 407 const base::ListValue& args) {} |
404 | 408 |
405 // Requests to lock the mouse. Once the request is approved or rejected, | 409 // Requests to lock the mouse. Once the request is approved or rejected, |
406 // GotResponseToLockMouseRequest() will be called on the requesting tab | 410 // GotResponseToLockMouseRequest() will be called on the requesting tab |
407 // contents. | 411 // contents. |
408 virtual void RequestToLockMouse(WebContents* web_contents, | 412 virtual void RequestToLockMouse(WebContents* web_contents, |
409 bool user_gesture, | 413 bool user_gesture, |
410 bool last_unlocked_by_target) { | 414 bool last_unlocked_by_target) {} |
411 } | |
412 | 415 |
413 // Notification that the page has lost the mouse lock. | 416 // Notification that the page has lost the mouse lock. |
414 virtual void LostMouseLock() {} | 417 virtual void LostMouseLock() {} |
415 | 418 |
| 419 // Asks permission to use the camera and/or microphone. If permission is |
| 420 // granted, a call should be made to |callback| with the devices. If the |
| 421 // request is denied, a call should be made to |callback| with an empty list |
| 422 // of devices. |request| has the details of the request (e.g. which of audio |
| 423 // and/or video devices are requested, and lists of available devices). |
| 424 virtual void RequestMediaAccessPermission( |
| 425 WebContents* web_contents, |
| 426 const MediaStreamRequest* request, |
| 427 const MediaResponseCallback& callback) {} |
| 428 |
416 protected: | 429 protected: |
417 virtual ~WebContentsDelegate(); | 430 virtual ~WebContentsDelegate(); |
418 | 431 |
419 private: | 432 private: |
420 friend class ::WebContentsImpl; | 433 friend class ::WebContentsImpl; |
421 | 434 |
422 // Called when |this| becomes the WebContentsDelegate for |source|. | 435 // Called when |this| becomes the WebContentsDelegate for |source|. |
423 void Attach(WebContents* source); | 436 void Attach(WebContents* source); |
424 | 437 |
425 // Called when |this| is no longer the WebContentsDelegate for |source|. | 438 // Called when |this| is no longer the WebContentsDelegate for |source|. |
426 void Detach(WebContents* source); | 439 void Detach(WebContents* source); |
427 | 440 |
428 // The WebContents that this is currently a delegate for. | 441 // The WebContents that this is currently a delegate for. |
429 std::set<WebContents*> attached_contents_; | 442 std::set<WebContents*> attached_contents_; |
430 }; | 443 }; |
431 | 444 |
432 } // namespace content | 445 } // namespace content |
433 | 446 |
434 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 447 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
OLD | NEW |