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