OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/public/common/browser_plugin_permission_type.h" | 13 #include "content/public/common/browser_plugin_permission_type.h" |
14 #include "content/public/common/media_stream_request.h" | 14 #include "content/public/common/media_stream_request.h" |
15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 class JavaScriptDialogManager; | 21 class JavaScriptDialogManager; |
22 struct NativeWebKeyboardEvent; | 22 struct NativeWebKeyboardEvent; |
| 23 class WebContents; |
23 | 24 |
24 // Objects implement this interface to get notified about changes in the guest | 25 // Objects implement this interface to get notified about changes in the guest |
25 // WebContents and to provide necessary functionality. | 26 // WebContents and to provide necessary functionality. |
26 class CONTENT_EXPORT BrowserPluginGuestDelegate { | 27 class CONTENT_EXPORT BrowserPluginGuestDelegate { |
27 public: | 28 public: |
28 virtual ~BrowserPluginGuestDelegate() {} | 29 virtual ~BrowserPluginGuestDelegate() {} |
29 | 30 |
30 // Add a message to the console. | 31 // Add a message to the console. |
31 virtual void AddMessageToConsole(int32 level, | 32 virtual void AddMessageToConsole(int32 level, |
32 const base::string16& message, | 33 const base::string16& message, |
33 int32 line_no, | 34 int32 line_no, |
34 const base::string16& source_id) {} | 35 const base::string16& source_id) {} |
35 | 36 |
36 // Request the delegate to close this guest, and do whatever cleanup it needs | 37 // Request the delegate to close this guest, and do whatever cleanup it needs |
37 // to do. | 38 // to do. |
38 virtual void Close() {} | 39 virtual void Close() {} |
39 | 40 |
40 // Notification that the embedder has completed attachment. | 41 // Notification that the embedder has completed attachment. |
41 virtual void DidAttach() {} | 42 virtual void DidAttach() {} |
42 | 43 |
| 44 // Returns the opener for this guest. |
| 45 // TODO(fsamuel): Remove this once the New Window API is migrated outside of |
| 46 // the content layer. |
| 47 virtual WebContents* GetOpener() const; |
| 48 |
43 // Informs the delegate that the guest render process is gone. |status| | 49 // Informs the delegate that the guest render process is gone. |status| |
44 // indicates whether the guest was killed, crashed, or was terminated | 50 // indicates whether the guest was killed, crashed, or was terminated |
45 // gracefully. | 51 // gracefully. |
46 virtual void GuestProcessGone(base::TerminationStatus status) {} | 52 virtual void GuestProcessGone(base::TerminationStatus status) {} |
47 | 53 |
48 // Informs the delegate that the embedder has been destroyed. | 54 // Informs the delegate that the embedder has been destroyed. |
49 virtual void EmbedderDestroyed() {} | 55 virtual void EmbedderDestroyed() {} |
50 | 56 |
51 // Informs the delegate of a reply to the find request specified by | 57 // Informs the delegate of a reply to the find request specified by |
52 // |request_id|. | 58 // |request_id|. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // |request_info|. A |callback| is provided to make the decision. | 97 // |request_info|. A |callback| is provided to make the decision. |
92 virtual void RequestPermission( | 98 virtual void RequestPermission( |
93 BrowserPluginPermissionType permission_type, | 99 BrowserPluginPermissionType permission_type, |
94 const base::DictionaryValue& request_info, | 100 const base::DictionaryValue& request_info, |
95 const PermissionResponseCallback& callback, | 101 const PermissionResponseCallback& callback, |
96 bool allowed_by_default) {} | 102 bool allowed_by_default) {} |
97 | 103 |
98 // Requests resolution of a potentially relative URL. | 104 // Requests resolution of a potentially relative URL. |
99 virtual GURL ResolveURL(const std::string& src); | 105 virtual GURL ResolveURL(const std::string& src); |
100 | 106 |
| 107 // Informs the delegate of the WebContents that created delegate's associated |
| 108 // WebContents. |
| 109 // TODO(fsamuel): Remove this once the New Window API is migrated outside of |
| 110 // the content layer. |
| 111 virtual void SetOpener(WebContents* opener) {} |
| 112 |
101 // Notifies that the content size of the guest has changed in autosize mode. | 113 // Notifies that the content size of the guest has changed in autosize mode. |
102 virtual void SizeChanged(const gfx::Size& old_size, | 114 virtual void SizeChanged(const gfx::Size& old_size, |
103 const gfx::Size& new_size) {} | 115 const gfx::Size& new_size) {} |
104 | 116 |
105 // Asks permission to use the camera and/or microphone. If permission is | 117 // Asks permission to use the camera and/or microphone. If permission is |
106 // granted, a call should be made to |callback| with the devices. If the | 118 // granted, a call should be made to |callback| with the devices. If the |
107 // request is denied, a call should be made to |callback| with an empty list | 119 // request is denied, a call should be made to |callback| with an empty list |
108 // of devices. |request| has the details of the request (e.g. which of audio | 120 // of devices. |request| has the details of the request (e.g. which of audio |
109 // and/or video devices are requested, and lists of available devices). | 121 // and/or video devices are requested, and lists of available devices). |
110 virtual void RequestMediaAccessPermission( | 122 virtual void RequestMediaAccessPermission( |
(...skipping 14 matching lines...) Expand all Loading... |
125 const base::Callback<void(bool)>& callback) {} | 137 const base::Callback<void(bool)>& callback) {} |
126 | 138 |
127 // Returns a pointer to a service to manage JavaScript dialogs. May return | 139 // Returns a pointer to a service to manage JavaScript dialogs. May return |
128 // NULL in which case dialogs aren't shown. | 140 // NULL in which case dialogs aren't shown. |
129 virtual JavaScriptDialogManager* GetJavaScriptDialogManager(); | 141 virtual JavaScriptDialogManager* GetJavaScriptDialogManager(); |
130 }; | 142 }; |
131 | 143 |
132 } // namespace content | 144 } // namespace content |
133 | 145 |
134 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 146 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
OLD | NEW |