| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. | 238 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. |
| 239 bool ClearData(const base::Time remove_since, | 239 bool ClearData(const base::Time remove_since, |
| 240 uint32 removal_mask, | 240 uint32 removal_mask, |
| 241 const base::Closure& callback); | 241 const base::Closure& callback); |
| 242 | 242 |
| 243 extensions::ScriptExecutor* script_executor() { | 243 extensions::ScriptExecutor* script_executor() { |
| 244 return script_executor_.get(); | 244 return script_executor_.get(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 // Called when file system access is requested by the guest content using the | 247 // Called when file system access is requested by the guest content using the |
| 248 // asynchronous HTML5 file system API. The request is plumbed through the | 248 // HTML5 file system API in main thread, or a worker thread. |
| 249 // <webview> permission request API. The request will be: | 249 // The request is plumbed through the <webview> permission request API. The |
| 250 // request will be: |
| 250 // - Allowed if the embedder explicitly allowed it. | 251 // - Allowed if the embedder explicitly allowed it. |
| 251 // - Denied if the embedder explicitly denied. | 252 // - Denied if the embedder explicitly denied. |
| 252 // - Determined by the guest's content settings if the embedder does not | 253 // - Determined by the guest's content settings if the embedder does not |
| 253 // perform an explicit action. | 254 // perform an explicit action. |
| 254 // If access was blocked due to the page's content settings, | 255 // If access was blocked due to the page's content settings, |
| 255 // |blocked_by_policy| should be true, and this function should invoke | 256 // |blocked_by_policy| should be true, and this function should invoke |
| 256 // OnContentBlocked. | 257 // OnContentBlocked. |
| 257 static void FileSystemAccessedAsync(int render_process_id, | 258 static void FileSystemAccessed(int render_process_id, |
| 258 int render_frame_id, | 259 int render_frame_id, |
| 259 int request_id, | 260 const GURL& url, |
| 260 const GURL& url, | 261 bool blocked_by_policy, |
| 261 bool blocked_by_policy); | 262 base::Callback<void(bool)> callback); |
| 262 | 263 |
| 263 // Called when file system access is requested by the guest content using the | 264 // Called when file system access is requested by the guest content using the |
| 264 // synchronous HTML5 file system API in a worker thread or shared worker. The | 265 // HTML5 file system API from shared workers. |
| 265 // request is plumbed through the <webview> permission request API. The | 266 // The request is plumbed through the <webview> permission request API. The |
| 266 // request will be: | 267 // request will be: |
| 267 // - Allowed if the embedder explicitly allowed it. | 268 // - Allowed if the embedder explicitly allowed it. |
| 268 // - Denied if the embedder explicitly denied. | 269 // - Denied if the embedder explicitly denied. |
| 269 // - Determined by the guest's content settings if the embedder does not | 270 // - Determined by the guest's content settings if the embedder does not |
| 270 // perform an explicit action. | 271 // perform an explicit action. |
| 271 // If access was blocked due to the page's content settings, | 272 // If access was blocked due to the page's content settings, |
| 272 // |blocked_by_policy| should be true, and this function should invoke | 273 // |blocked_by_policy| should be true, and this function should invoke |
| 273 // OnContentBlocked. | 274 // OnContentBlocked. |
| 274 static void FileSystemAccessedSync(int render_process_id, | 275 // Different from FileSystemAccessed, this function will only request |
| 275 int render_frame_id, | 276 // permission, but won't call TabSpecificContentSettings::FileSystemAccessed. |
| 276 const GURL& url, | 277 static void RequestFileSystemAccessPermission( |
| 277 bool blocked_by_policy, | 278 int render_process_id, |
| 278 IPC::Message* reply_msg); | 279 int render_frame_id, |
| 280 const GURL& url, |
| 281 bool blocked_by_policy, |
| 282 base::Callback<void(bool)> callback); |
| 279 | 283 |
| 280 private: | 284 private: |
| 281 virtual ~WebViewGuest(); | 285 virtual ~WebViewGuest(); |
| 282 | 286 |
| 283 // A map to store the callback for a request keyed by the request's id. | 287 // A map to store the callback for a request keyed by the request's id. |
| 284 struct PermissionResponseInfo { | 288 struct PermissionResponseInfo { |
| 285 PermissionResponseCallback callback; | 289 PermissionResponseCallback callback; |
| 286 WebViewPermissionType permission_type; | 290 WebViewPermissionType permission_type; |
| 287 bool allowed_by_default; | 291 bool allowed_by_default; |
| 288 PermissionResponseInfo(); | 292 PermissionResponseInfo(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 328 |
| 325 void OnWebViewPointerLockPermissionResponse( | 329 void OnWebViewPointerLockPermissionResponse( |
| 326 const base::Callback<void(bool)>& callback, | 330 const base::Callback<void(bool)>& callback, |
| 327 bool allow, | 331 bool allow, |
| 328 const std::string& user_input); | 332 const std::string& user_input); |
| 329 | 333 |
| 330 void OnWebViewNewWindowResponse(int new_window_instance_id, | 334 void OnWebViewNewWindowResponse(int new_window_instance_id, |
| 331 bool allow, | 335 bool allow, |
| 332 const std::string& user_input); | 336 const std::string& user_input); |
| 333 | 337 |
| 334 static void FileSystemAccessedAsyncResponse(int render_process_id, | 338 static void FileSystemAccessedResponse( |
| 335 int render_frame_id, | 339 int render_process_id, |
| 336 int request_id, | 340 int render_frame_id, |
| 337 const GURL& url, | 341 const GURL& url, |
| 338 bool allowed); | 342 base::Callback<void(bool)> callback, |
| 339 | 343 bool allowed); |
| 340 static void FileSystemAccessedSyncResponse(int render_process_id, | |
| 341 int render_frame_id, | |
| 342 const GURL& url, | |
| 343 IPC::Message* reply_msg, | |
| 344 bool allowed); | |
| 345 | 344 |
| 346 // WebContentsObserver implementation. | 345 // WebContentsObserver implementation. |
| 347 virtual void DidCommitProvisionalLoadForFrame( | 346 virtual void DidCommitProvisionalLoadForFrame( |
| 348 content::RenderFrameHost* render_frame_host, | 347 content::RenderFrameHost* render_frame_host, |
| 349 const GURL& url, | 348 const GURL& url, |
| 350 content::PageTransition transition_type) OVERRIDE; | 349 content::PageTransition transition_type) OVERRIDE; |
| 351 virtual void DidFailProvisionalLoad( | 350 virtual void DidFailProvisionalLoad( |
| 352 content::RenderFrameHost* render_frame_host, | 351 content::RenderFrameHost* render_frame_host, |
| 353 const GURL& validated_url, | 352 const GURL& validated_url, |
| 354 int error_code, | 353 int error_code, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 changed(false) {} | 494 changed(false) {} |
| 496 }; | 495 }; |
| 497 | 496 |
| 498 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 497 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
| 499 PendingWindowMap pending_new_windows_; | 498 PendingWindowMap pending_new_windows_; |
| 500 | 499 |
| 501 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 500 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
| 502 }; | 501 }; |
| 503 | 502 |
| 504 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 503 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| OLD | NEW |