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.h" | |
jam
2013/08/08 21:22:11
nit: callback_forward is enough?
Fady Samuel
2013/08/08 21:42:49
Done.
| |
8 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
9 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/values.h" | |
10 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/public/common/browser_plugin/browser_plugin_message_enums.h" | |
11 | 14 |
12 namespace content { | 15 namespace content { |
13 | 16 |
14 struct NativeWebKeyboardEvent; | 17 struct NativeWebKeyboardEvent; |
15 | 18 |
16 // Objects implement this interface to get notified about changes in the guest | 19 // Objects implement this interface to get notified about changes in the guest |
17 // WebContents and to provide necessary functionality. | 20 // WebContents and to provide necessary functionality. |
18 class CONTENT_EXPORT BrowserPluginGuestDelegate { | 21 class CONTENT_EXPORT BrowserPluginGuestDelegate { |
19 public: | 22 public: |
23 typedef base::Callback<void(bool /* allow */, | |
24 const std::string& /* user_input */)> | |
jam
2013/08/08 21:22:11
nit: the const should line up with the bool
also,
Fady Samuel
2013/08/08 21:42:49
Done.
jam
2013/08/09 00:07:27
where?
| |
25 PermissionResponseCallback; | |
26 | |
20 virtual ~BrowserPluginGuestDelegate() {} | 27 virtual ~BrowserPluginGuestDelegate() {} |
21 | 28 |
22 // Add a message to the console. | 29 // Add a message to the console. |
23 virtual void AddMessageToConsole(int32 level, | 30 virtual void AddMessageToConsole(int32 level, |
24 const string16& message, | 31 const string16& message, |
25 int32 line_no, | 32 int32 line_no, |
26 const string16& source_id) {} | 33 const string16& source_id) {} |
27 | 34 |
28 // Request the delegate to close this guest, and do whatever cleanup it needs | 35 // Request the delegate to close this guest, and do whatever cleanup it needs |
29 // to do. | 36 // to do. |
30 virtual void Close() {} | 37 virtual void Close() {} |
31 | 38 |
32 // Informs the delegate that the guest render process is gone. |status| | 39 // Informs the delegate that the guest render process is gone. |status| |
33 // indicates whether the guest was killed, crashed, or was terminated | 40 // indicates whether the guest was killed, crashed, or was terminated |
34 // gracefully. | 41 // gracefully. |
35 virtual void GuestProcessGone(base::TerminationStatus status) {} | 42 virtual void GuestProcessGone(base::TerminationStatus status) {} |
36 | 43 |
37 virtual bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 44 virtual bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
38 | 45 |
39 // Notification that the guest is no longer hung. | 46 // Notification that the guest is no longer hung. |
40 virtual void RendererResponsive() {} | 47 virtual void RendererResponsive() {} |
41 | 48 |
42 // Notification that the guest is hung. | 49 // Notification that the guest is hung. |
43 virtual void RendererUnresponsive() {} | 50 virtual void RendererUnresponsive() {} |
51 | |
52 // Request permission from the delegate to perform an action of the provided | |
53 // |permission_type|. Details of the permission request are found in | |
54 // |request_info|. A |callback| is provided to make the decision. | |
55 // Returns whether the delegate has, or will handle the permission request. | |
56 virtual bool RequestPermission( | |
57 BrowserPluginPermissionType permission_type, | |
58 const base::DictionaryValue& request_info, | |
59 const PermissionResponseCallback& callback); | |
44 }; | 60 }; |
45 | 61 |
46 } // namespace content | 62 } // namespace content |
47 | 63 |
48 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 64 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
OLD | NEW |