Chromium Code Reviews| 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" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. | 237 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. |
| 238 bool ClearData(const base::Time remove_since, | 238 bool ClearData(const base::Time remove_since, |
| 239 uint32 removal_mask, | 239 uint32 removal_mask, |
| 240 const base::Closure& callback); | 240 const base::Closure& callback); |
| 241 | 241 |
| 242 extensions::ScriptExecutor* script_executor() { | 242 extensions::ScriptExecutor* script_executor() { |
| 243 return script_executor_.get(); | 243 return script_executor_.get(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 // Called when file system access is requested by the guest content using the | 246 // Called when file system access is requested by the guest content using the |
| 247 // asynchronous HTML5 file system API. The request is plumbed through the | 247 // HTML5 file system API in main thread, or a worker thread or shared worker. |
| 248 // <webview> permission request API. The request will be: | 248 // The request is plumbed through the <webview> permission request API. The |
| 249 // - Allowed if the embedder explicitly allowed it. | |
| 250 // - Denied if the embedder explicitly denied. | |
| 251 // - Determined by the guest's content settings if the embedder does not | |
| 252 // perform an explicit action. | |
| 253 // If access was blocked due to the page's content settings, | |
| 254 // |blocked_by_policy| should be true, and this function should invoke | |
| 255 // OnContentBlocked. | |
| 256 static void FileSystemAccessedAsync(int render_process_id, | |
| 257 int render_frame_id, | |
| 258 int request_id, | |
| 259 const GURL& url, | |
| 260 bool blocked_by_policy); | |
| 261 | |
| 262 // Called when file system access is requested by the guest content using the | |
| 263 // synchronous HTML5 file system API in a worker thread or shared worker. The | |
| 264 // request is plumbed through the <webview> permission request API. The | |
| 265 // request will be: | 249 // request will be: |
| 266 // - Allowed if the embedder explicitly allowed it. | 250 // - Allowed if the embedder explicitly allowed it. |
| 267 // - Denied if the embedder explicitly denied. | 251 // - Denied if the embedder explicitly denied. |
| 268 // - Determined by the guest's content settings if the embedder does not | 252 // - Determined by the guest's content settings if the embedder does not |
| 269 // perform an explicit action. | 253 // perform an explicit action. |
| 270 // If access was blocked due to the page's content settings, | 254 // If access was blocked due to the page's content settings, |
| 271 // |blocked_by_policy| should be true, and this function should invoke | 255 // |blocked_by_policy| should be true, and this function should invoke |
| 272 // OnContentBlocked. | 256 // OnContentBlocked. |
| 273 static void FileSystemAccessedSync(int render_process_id, | 257 static void FileSystemAccessed(int render_process_id, |
|
Xi Han
2014/06/23 20:43:34
Code clean up is done here: use the same code for
| |
| 274 int render_frame_id, | 258 int render_frame_id, |
| 275 const GURL& url, | 259 const GURL& url, |
| 276 bool blocked_by_policy, | 260 bool blocked_by_policy, |
| 277 IPC::Message* reply_msg); | 261 base::Callback<void(bool)> callback); |
| 278 | 262 |
| 279 private: | 263 private: |
| 280 virtual ~WebViewGuest(); | 264 virtual ~WebViewGuest(); |
| 281 | 265 |
| 282 // A map to store the callback for a request keyed by the request's id. | 266 // A map to store the callback for a request keyed by the request's id. |
| 283 struct PermissionResponseInfo { | 267 struct PermissionResponseInfo { |
| 284 PermissionResponseCallback callback; | 268 PermissionResponseCallback callback; |
| 285 WebViewPermissionType permission_type; | 269 WebViewPermissionType permission_type; |
| 286 bool allowed_by_default; | 270 bool allowed_by_default; |
| 287 PermissionResponseInfo(); | 271 PermissionResponseInfo(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 | 307 |
| 324 void OnWebViewPointerLockPermissionResponse( | 308 void OnWebViewPointerLockPermissionResponse( |
| 325 const base::Callback<void(bool)>& callback, | 309 const base::Callback<void(bool)>& callback, |
| 326 bool allow, | 310 bool allow, |
| 327 const std::string& user_input); | 311 const std::string& user_input); |
| 328 | 312 |
| 329 void OnWebViewNewWindowResponse(int new_window_instance_id, | 313 void OnWebViewNewWindowResponse(int new_window_instance_id, |
| 330 bool allow, | 314 bool allow, |
| 331 const std::string& user_input); | 315 const std::string& user_input); |
| 332 | 316 |
| 333 static void FileSystemAccessedAsyncResponse(int render_process_id, | 317 static void FileSystemAccessedResponse( |
| 334 int render_frame_id, | 318 int render_process_id, |
| 335 int request_id, | 319 int render_frame_id, |
| 336 const GURL& url, | 320 const GURL& url, |
| 337 bool allowed); | 321 base::Callback<void(bool)> callback, |
| 338 | 322 bool allowed); |
| 339 static void FileSystemAccessedSyncResponse(int render_process_id, | |
| 340 int render_frame_id, | |
| 341 const GURL& url, | |
| 342 IPC::Message* reply_msg, | |
| 343 bool allowed); | |
| 344 | 323 |
| 345 // WebContentsObserver implementation. | 324 // WebContentsObserver implementation. |
| 346 virtual void DidCommitProvisionalLoadForFrame( | 325 virtual void DidCommitProvisionalLoadForFrame( |
| 347 int64 frame_id, | 326 int64 frame_id, |
| 348 const base::string16& frame_unique_name, | 327 const base::string16& frame_unique_name, |
| 349 bool is_main_frame, | 328 bool is_main_frame, |
| 350 const GURL& url, | 329 const GURL& url, |
| 351 content::PageTransition transition_type, | 330 content::PageTransition transition_type, |
| 352 content::RenderViewHost* render_view_host) OVERRIDE; | 331 content::RenderViewHost* render_view_host) OVERRIDE; |
| 353 virtual void DidFailProvisionalLoad( | 332 virtual void DidFailProvisionalLoad( |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 502 name(name) {} | 481 name(name) {} |
| 503 }; | 482 }; |
| 504 | 483 |
| 505 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 484 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
| 506 PendingWindowMap pending_new_windows_; | 485 PendingWindowMap pending_new_windows_; |
| 507 | 486 |
| 508 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 487 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
| 509 }; | 488 }; |
| 510 | 489 |
| 511 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 490 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| OLD | NEW |