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 ContextMenuParams; | 22 struct ContextMenuParams; |
23 struct NativeWebKeyboardEvent; | 23 struct NativeWebKeyboardEvent; |
| 24 class WebContents; |
24 | 25 |
25 // Objects implement this interface to get notified about changes in the guest | 26 // Objects implement this interface to get notified about changes in the guest |
26 // WebContents and to provide necessary functionality. | 27 // WebContents and to provide necessary functionality. |
27 class CONTENT_EXPORT BrowserPluginGuestDelegate { | 28 class CONTENT_EXPORT BrowserPluginGuestDelegate { |
28 public: | 29 public: |
29 virtual ~BrowserPluginGuestDelegate() {} | 30 virtual ~BrowserPluginGuestDelegate() {} |
30 | 31 |
31 // Add a message to the console. | 32 // Add a message to the console. |
32 virtual void AddMessageToConsole(int32 level, | 33 virtual void AddMessageToConsole(int32 level, |
33 const base::string16& message, | 34 const base::string16& message, |
34 int32 line_no, | 35 int32 line_no, |
35 const base::string16& source_id) {} | 36 const base::string16& source_id) {} |
36 | 37 |
37 // Request the delegate to close this guest, and do whatever cleanup it needs | 38 // Request the delegate to close this guest, and do whatever cleanup it needs |
38 // to do. | 39 // to do. |
39 virtual void Close() {} | 40 virtual void Close() {} |
40 | 41 |
41 // Notification that the embedder has completed attachment. | 42 // Notification that the embedder has completed attachment. |
42 virtual void DidAttach() {} | 43 virtual void DidAttach() {} |
43 | 44 |
| 45 // Returns the opener for this guest. |
| 46 // TODO(fsamuel): Remove this once the New Window API is migrated outside of |
| 47 // the content layer. |
| 48 virtual WebContents* GetOpener() const; |
| 49 |
44 // Informs the delegate that the guest render process is gone. |status| | 50 // Informs the delegate that the guest render process is gone. |status| |
45 // indicates whether the guest was killed, crashed, or was terminated | 51 // indicates whether the guest was killed, crashed, or was terminated |
46 // gracefully. | 52 // gracefully. |
47 virtual void GuestProcessGone(base::TerminationStatus status) {} | 53 virtual void GuestProcessGone(base::TerminationStatus status) {} |
48 | 54 |
49 // Informs the delegate that the embedder has been destroyed. | 55 // Informs the delegate that the embedder has been destroyed. |
50 virtual void EmbedderDestroyed() {} | 56 virtual void EmbedderDestroyed() {} |
51 | 57 |
52 // Informs the delegate of a reply to the find request specified by | 58 // Informs the delegate of a reply to the find request specified by |
53 // |request_id|. | 59 // |request_id|. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // |request_info|. A |callback| is provided to make the decision. | 98 // |request_info|. A |callback| is provided to make the decision. |
93 virtual void RequestPermission( | 99 virtual void RequestPermission( |
94 BrowserPluginPermissionType permission_type, | 100 BrowserPluginPermissionType permission_type, |
95 const base::DictionaryValue& request_info, | 101 const base::DictionaryValue& request_info, |
96 const PermissionResponseCallback& callback, | 102 const PermissionResponseCallback& callback, |
97 bool allowed_by_default) {} | 103 bool allowed_by_default) {} |
98 | 104 |
99 // Requests resolution of a potentially relative URL. | 105 // Requests resolution of a potentially relative URL. |
100 virtual GURL ResolveURL(const std::string& src); | 106 virtual GURL ResolveURL(const std::string& src); |
101 | 107 |
| 108 // Informs the delegate of the WebContents that created delegate's associated |
| 109 // WebContents. |
| 110 // TODO(fsamuel): Remove this once the New Window API is migrated outside of |
| 111 // the content layer. |
| 112 virtual void SetOpener(WebContents* opener) {} |
| 113 |
102 // Notifies that the content size of the guest has changed in autosize mode. | 114 // Notifies that the content size of the guest has changed in autosize mode. |
103 virtual void SizeChanged(const gfx::Size& old_size, | 115 virtual void SizeChanged(const gfx::Size& old_size, |
104 const gfx::Size& new_size) {} | 116 const gfx::Size& new_size) {} |
105 | 117 |
106 // Asks permission to use the camera and/or microphone. If permission is | 118 // Asks permission to use the camera and/or microphone. If permission is |
107 // granted, a call should be made to |callback| with the devices. If the | 119 // granted, a call should be made to |callback| with the devices. If the |
108 // request is denied, a call should be made to |callback| with an empty list | 120 // request is denied, a call should be made to |callback| with an empty list |
109 // of devices. |request| has the details of the request (e.g. which of audio | 121 // of devices. |request| has the details of the request (e.g. which of audio |
110 // and/or video devices are requested, and lists of available devices). | 122 // and/or video devices are requested, and lists of available devices). |
111 virtual void RequestMediaAccessPermission( | 123 virtual void RequestMediaAccessPermission( |
(...skipping 17 matching lines...) Expand all Loading... |
129 // NULL in which case dialogs aren't shown. | 141 // NULL in which case dialogs aren't shown. |
130 virtual JavaScriptDialogManager* GetJavaScriptDialogManager(); | 142 virtual JavaScriptDialogManager* GetJavaScriptDialogManager(); |
131 | 143 |
132 // Returns true if the context menu operation was handled by the delegate. | 144 // Returns true if the context menu operation was handled by the delegate. |
133 virtual bool HandleContextMenu(const ContextMenuParams& params); | 145 virtual bool HandleContextMenu(const ContextMenuParams& params); |
134 }; | 146 }; |
135 | 147 |
136 } // namespace content | 148 } // namespace content |
137 | 149 |
138 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 150 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
OLD | NEW |