OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 5 #ifndef CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "chrome/browser/extensions/tab_helper.h" | 11 #include "chrome/browser/extensions/tab_helper.h" |
12 #include "chrome/browser/guest_view/guest_view.h" | 12 #include "chrome/browser/guest_view/guest_view.h" |
13 #include "chrome/browser/guest_view/web_view/javascript_dialog_helper.h" | 13 #include "chrome/browser/guest_view/web_view/javascript_dialog_helper.h" |
14 #include "chrome/browser/guest_view/web_view/web_view_find_helper.h" | 14 #include "chrome/browser/guest_view/web_view/web_view_find_helper.h" |
15 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" | 15 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" |
16 #include "chrome/common/extensions/api/webview.h" | 16 #include "chrome/common/extensions/api/webview.h" |
17 #include "content/public/browser/javascript_dialog_manager.h" | 17 #include "content/public/browser/javascript_dialog_manager.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/render_frame_host.h" | |
19 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
20 #include "third_party/WebKit/public/web/WebFindOptions.h" | 21 #include "third_party/WebKit/public/web/WebFindOptions.h" |
21 | 22 |
22 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
23 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 24 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
24 #endif | 25 #endif |
25 | 26 |
26 namespace webview_api = extensions::api::webview; | 27 namespace webview_api = extensions::api::webview; |
27 | 28 |
28 class RenderViewContextMenu; | 29 class RenderViewContextMenu; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 | 176 |
176 void OnWebViewGeolocationPermissionResponse( | 177 void OnWebViewGeolocationPermissionResponse( |
177 int bridge_id, | 178 int bridge_id, |
178 bool user_gesture, | 179 bool user_gesture, |
179 const base::Callback<void(bool)>& callback, | 180 const base::Callback<void(bool)>& callback, |
180 bool allow, | 181 bool allow, |
181 const std::string& user_input); | 182 const std::string& user_input); |
182 | 183 |
183 void CancelGeolocationPermissionRequest(int bridge_id); | 184 void CancelGeolocationPermissionRequest(int bridge_id); |
184 | 185 |
186 void RequestFileSystemPermission(const GURL& url, | |
187 bool allowed_by_default, | |
188 const base::Callback<void(bool)>& callback); | |
189 | |
190 void OnWebViewFileSystemPermissionResponse( | |
Fady Samuel
2014/05/30 18:26:13
This should actually be private. I misplaced these
Xi Han
2014/05/30 19:35:30
Move all of them to private.
| |
191 const base::Callback<void(bool)>& callback, | |
192 bool allow, | |
193 const std::string& user_input); | |
194 | |
185 void OnWebViewMediaPermissionResponse( | 195 void OnWebViewMediaPermissionResponse( |
186 const content::MediaStreamRequest& request, | 196 const content::MediaStreamRequest& request, |
187 const content::MediaResponseCallback& callback, | 197 const content::MediaResponseCallback& callback, |
188 bool allow, | 198 bool allow, |
189 const std::string& user_input); | 199 const std::string& user_input); |
190 | 200 |
191 void OnWebViewDownloadPermissionResponse( | 201 void OnWebViewDownloadPermissionResponse( |
192 const base::Callback<void(bool)>& callback, | 202 const base::Callback<void(bool)>& callback, |
193 bool allow, | 203 bool allow, |
194 const std::string& user_input); | 204 const std::string& user_input); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 // Partition data that are newer than |removal_since| will be removed. | 246 // Partition data that are newer than |removal_since| will be removed. |
237 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. | 247 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. |
238 bool ClearData(const base::Time remove_since, | 248 bool ClearData(const base::Time remove_since, |
239 uint32 removal_mask, | 249 uint32 removal_mask, |
240 const base::Closure& callback); | 250 const base::Closure& callback); |
241 | 251 |
242 extensions::ScriptExecutor* script_executor() { | 252 extensions::ScriptExecutor* script_executor() { |
243 return script_executor_.get(); | 253 return script_executor_.get(); |
244 } | 254 } |
245 | 255 |
256 static void FileSystemAccessedAsync(int render_process_id, | |
Fady Samuel
2014/05/30 18:26:13
Description of what this is and what it does.
Xi Han
2014/05/30 19:35:30
Done.
| |
257 int render_frame_id, | |
258 int request_id, | |
259 const GURL& url, | |
260 bool blocked_by_policy); | |
261 | |
262 static void FileSystemAccessedSync(int render_process_id, | |
Fady Samuel
2014/05/30 18:26:13
Description of what this is and what it does.
Xi Han
2014/05/30 19:35:30
Done.
| |
263 int render_frame_id, | |
264 const GURL& url, | |
265 IPC::Message* reply_msg, | |
266 bool blocked_by_policy); | |
267 | |
246 private: | 268 private: |
247 virtual ~WebViewGuest(); | 269 virtual ~WebViewGuest(); |
248 | 270 |
249 // A map to store the callback for a request keyed by the request's id. | 271 // A map to store the callback for a request keyed by the request's id. |
250 struct PermissionResponseInfo { | 272 struct PermissionResponseInfo { |
251 PermissionResponseCallback callback; | 273 PermissionResponseCallback callback; |
252 WebViewPermissionType permission_type; | 274 WebViewPermissionType permission_type; |
253 bool allowed_by_default; | 275 bool allowed_by_default; |
254 PermissionResponseInfo(); | 276 PermissionResponseInfo(); |
255 PermissionResponseInfo(const PermissionResponseCallback& callback, | 277 PermissionResponseInfo(const PermissionResponseCallback& callback, |
256 WebViewPermissionType permission_type, | 278 WebViewPermissionType permission_type, |
257 bool allowed_by_default); | 279 bool allowed_by_default); |
258 ~PermissionResponseInfo(); | 280 ~PermissionResponseInfo(); |
259 }; | 281 }; |
260 | 282 |
261 static void RecordUserInitiatedUMA(const PermissionResponseInfo& info, | 283 static void RecordUserInitiatedUMA(const PermissionResponseInfo& info, |
262 bool allow); | 284 bool allow); |
263 | 285 |
264 // Returns the top level items (ignoring submenus) as Value. | 286 // Returns the top level items (ignoring submenus) as Value. |
265 static scoped_ptr<base::ListValue> MenuModelToValue( | 287 static scoped_ptr<base::ListValue> MenuModelToValue( |
266 const ui::SimpleMenuModel& menu_model); | 288 const ui::SimpleMenuModel& menu_model); |
267 | 289 |
290 static void FileSystemAccessedAsyncResponse(int render_process_id, | |
291 int render_frame_id, | |
292 int request_id, | |
293 const GURL& url, | |
294 bool allowed); | |
295 | |
296 static void FileSystemAccessedSyncResponse(int render_process_id, | |
297 int render_frame_id, | |
298 const GURL& url, | |
299 IPC::Message* reply_msg, | |
300 bool allowed); | |
301 | |
268 // WebContentsObserver implementation. | 302 // WebContentsObserver implementation. |
269 virtual void DidCommitProvisionalLoadForFrame( | 303 virtual void DidCommitProvisionalLoadForFrame( |
270 int64 frame_id, | 304 int64 frame_id, |
271 const base::string16& frame_unique_name, | 305 const base::string16& frame_unique_name, |
272 bool is_main_frame, | 306 bool is_main_frame, |
273 const GURL& url, | 307 const GURL& url, |
274 content::PageTransition transition_type, | 308 content::PageTransition transition_type, |
275 content::RenderViewHost* render_view_host) OVERRIDE; | 309 content::RenderViewHost* render_view_host) OVERRIDE; |
276 virtual void DidFailProvisionalLoad( | 310 virtual void DidFailProvisionalLoad( |
277 int64 frame_id, | 311 int64 frame_id, |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 name(name) {} | 461 name(name) {} |
428 }; | 462 }; |
429 | 463 |
430 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 464 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
431 PendingWindowMap pending_new_windows_; | 465 PendingWindowMap pending_new_windows_; |
432 | 466 |
433 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 467 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
434 }; | 468 }; |
435 | 469 |
436 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 470 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
OLD | NEW |