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 CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ | 5 #ifndef CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ |
6 #define CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ | 6 #define CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ |
7 | 7 |
8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
9 #include "chrome/browser/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
10 #include "chrome/browser/guestview/guestview.h" | 10 #include "chrome/browser/guestview/guestview.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 virtual void AddMessageToConsole(int32 level, | 42 virtual void AddMessageToConsole(int32 level, |
43 const string16& message, | 43 const string16& message, |
44 int32 line_no, | 44 int32 line_no, |
45 const string16& source_id) OVERRIDE; | 45 const string16& source_id) OVERRIDE; |
46 virtual void Close() OVERRIDE; | 46 virtual void Close() OVERRIDE; |
47 virtual void GuestProcessGone(base::TerminationStatus status) OVERRIDE; | 47 virtual void GuestProcessGone(base::TerminationStatus status) OVERRIDE; |
48 virtual bool HandleKeyboardEvent( | 48 virtual bool HandleKeyboardEvent( |
49 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 49 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
50 virtual void RendererResponsive() OVERRIDE; | 50 virtual void RendererResponsive() OVERRIDE; |
51 virtual void RendererUnresponsive() OVERRIDE; | 51 virtual void RendererUnresponsive() OVERRIDE; |
| 52 virtual bool RequestPermission( |
| 53 BrowserPluginPermissionType permission_type, |
| 54 const base::DictionaryValue& request_info, |
| 55 const PermissionResponseCallback& callback) OVERRIDE; |
52 | 56 |
53 // NotificationObserver implementation. | 57 // NotificationObserver implementation. |
54 virtual void Observe(int type, | 58 virtual void Observe(int type, |
55 const content::NotificationSource& source, | 59 const content::NotificationSource& source, |
56 const content::NotificationDetails& details) OVERRIDE; | 60 const content::NotificationDetails& details) OVERRIDE; |
57 | 61 |
58 // If possible, navigate the guest to |relative_index| entries away from the | 62 // If possible, navigate the guest to |relative_index| entries away from the |
59 // current navigation entry. | 63 // current navigation entry. |
60 void Go(int relative_index); | 64 void Go(int relative_index); |
61 | 65 |
62 // Reload the guest. | 66 // Reload the guest. |
63 void Reload(); | 67 void Reload(); |
64 | 68 |
| 69 // Responds to the permission request |request_id| with |should_allow| and |
| 70 // |user_input|. Returns whether there was a pending request for the provided |
| 71 // |request_id|. |
| 72 bool SetPermission(int request_id, |
| 73 bool should_allow, |
| 74 const std::string& user_input); |
| 75 |
65 // Stop loading the guest. | 76 // Stop loading the guest. |
66 void Stop(); | 77 void Stop(); |
67 | 78 |
68 // Kill the guest process. | 79 // Kill the guest process. |
69 void Terminate(); | 80 void Terminate(); |
70 | 81 |
71 extensions::ScriptExecutor* script_executor() { | 82 extensions::ScriptExecutor* script_executor() { |
72 return script_executor_.get(); | 83 return script_executor_.get(); |
73 } | 84 } |
74 | 85 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void AddWebViewToExtensionRendererState(); | 124 void AddWebViewToExtensionRendererState(); |
114 static void RemoveWebViewFromExtensionRendererState( | 125 static void RemoveWebViewFromExtensionRendererState( |
115 content::WebContents* web_contents); | 126 content::WebContents* web_contents); |
116 | 127 |
117 ObserverList<extensions::TabHelper::ScriptExecutionObserver> | 128 ObserverList<extensions::TabHelper::ScriptExecutionObserver> |
118 script_observers_; | 129 script_observers_; |
119 scoped_ptr<extensions::ScriptExecutor> script_executor_; | 130 scoped_ptr<extensions::ScriptExecutor> script_executor_; |
120 | 131 |
121 content::NotificationRegistrar notification_registrar_; | 132 content::NotificationRegistrar notification_registrar_; |
122 | 133 |
| 134 // A counter to generate a unique request id for a permission request. |
| 135 // We only need the ids to be unique for a given WebViewGuest. |
| 136 int next_permission_request_id_; |
| 137 |
| 138 // A map to store the callback for a request keyed by the request's id. |
| 139 typedef std::map<int, PermissionResponseCallback> RequestMap; |
| 140 RequestMap pending_permission_requests_; |
| 141 |
123 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 142 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
124 }; | 143 }; |
125 | 144 |
126 #endif // CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ | 145 #endif // CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ |
OLD | NEW |