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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 const PermissionResponseCallback& callback, | 192 const PermissionResponseCallback& callback, |
193 bool allowed_by_default); | 193 bool allowed_by_default); |
194 | 194 |
195 // Requests Geolocation Permission from the embedder. | 195 // Requests Geolocation Permission from the embedder. |
196 void RequestGeolocationPermission(int bridge_id, | 196 void RequestGeolocationPermission(int bridge_id, |
197 const GURL& requesting_frame, | 197 const GURL& requesting_frame, |
198 bool user_gesture, | 198 bool user_gesture, |
199 const base::Callback<void(bool)>& callback); | 199 const base::Callback<void(bool)>& callback); |
200 void CancelGeolocationPermissionRequest(int bridge_id); | 200 void CancelGeolocationPermissionRequest(int bridge_id); |
201 | 201 |
| 202 // Called when file system access is requested by the guest content using the |
| 203 // HTML5 file system API in main thread, or a worker thread. |
| 204 // The request is plumbed through the <webview> permission request API. The |
| 205 // request will be: |
| 206 // - Allowed if the embedder explicitly allowed it. |
| 207 // - Denied if the embedder explicitly denied. |
| 208 // - Determined by the guest's content settings if the embedder does not |
| 209 // perform an explicit action. |
202 void RequestFileSystemPermission(const GURL& url, | 210 void RequestFileSystemPermission(const GURL& url, |
203 bool allowed_by_default, | 211 bool allowed_by_default, |
204 const base::Callback<void(bool)>& callback); | 212 const base::Callback<void(bool)>& callback); |
205 | 213 |
206 enum PermissionResponseAction { | 214 enum PermissionResponseAction { |
207 DENY, | 215 DENY, |
208 ALLOW, | 216 ALLOW, |
209 DEFAULT | 217 DEFAULT |
210 }; | 218 }; |
211 | 219 |
(...skipping 25 matching lines...) Expand all Loading... |
237 // Partition data that are newer than |removal_since| will be removed. | 245 // Partition data that are newer than |removal_since| will be removed. |
238 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. | 246 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. |
239 bool ClearData(const base::Time remove_since, | 247 bool ClearData(const base::Time remove_since, |
240 uint32 removal_mask, | 248 uint32 removal_mask, |
241 const base::Closure& callback); | 249 const base::Closure& callback); |
242 | 250 |
243 extensions::ScriptExecutor* script_executor() { | 251 extensions::ScriptExecutor* script_executor() { |
244 return script_executor_.get(); | 252 return script_executor_.get(); |
245 } | 253 } |
246 | 254 |
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 | |
249 // <webview> permission request API. The request will be: | |
250 // - Allowed if the embedder explicitly allowed it. | |
251 // - Denied if the embedder explicitly denied. | |
252 // - Determined by the guest's content settings if the embedder does not | |
253 // perform an explicit action. | |
254 // If access was blocked due to the page's content settings, | |
255 // |blocked_by_policy| should be true, and this function should invoke | |
256 // OnContentBlocked. | |
257 static void FileSystemAccessedAsync(int render_process_id, | |
258 int render_frame_id, | |
259 int request_id, | |
260 const GURL& url, | |
261 bool blocked_by_policy); | |
262 | |
263 // 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 // request is plumbed through the <webview> permission request API. The | |
266 // request will be: | |
267 // - Allowed if the embedder explicitly allowed it. | |
268 // - Denied if the embedder explicitly denied. | |
269 // - Determined by the guest's content settings if the embedder does not | |
270 // perform an explicit action. | |
271 // If access was blocked due to the page's content settings, | |
272 // |blocked_by_policy| should be true, and this function should invoke | |
273 // OnContentBlocked. | |
274 static void FileSystemAccessedSync(int render_process_id, | |
275 int render_frame_id, | |
276 const GURL& url, | |
277 bool blocked_by_policy, | |
278 IPC::Message* reply_msg); | |
279 | |
280 private: | 255 private: |
281 virtual ~WebViewGuest(); | 256 virtual ~WebViewGuest(); |
282 | 257 |
283 // A map to store the callback for a request keyed by the request's id. | 258 // A map to store the callback for a request keyed by the request's id. |
284 struct PermissionResponseInfo { | 259 struct PermissionResponseInfo { |
285 PermissionResponseCallback callback; | 260 PermissionResponseCallback callback; |
286 WebViewPermissionType permission_type; | 261 WebViewPermissionType permission_type; |
287 bool allowed_by_default; | 262 bool allowed_by_default; |
288 PermissionResponseInfo(); | 263 PermissionResponseInfo(); |
289 PermissionResponseInfo(const PermissionResponseCallback& callback, | 264 PermissionResponseInfo(const PermissionResponseCallback& callback, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 299 |
325 void OnWebViewPointerLockPermissionResponse( | 300 void OnWebViewPointerLockPermissionResponse( |
326 const base::Callback<void(bool)>& callback, | 301 const base::Callback<void(bool)>& callback, |
327 bool allow, | 302 bool allow, |
328 const std::string& user_input); | 303 const std::string& user_input); |
329 | 304 |
330 void OnWebViewNewWindowResponse(int new_window_instance_id, | 305 void OnWebViewNewWindowResponse(int new_window_instance_id, |
331 bool allow, | 306 bool allow, |
332 const std::string& user_input); | 307 const std::string& user_input); |
333 | 308 |
334 static void FileSystemAccessedAsyncResponse(int render_process_id, | |
335 int render_frame_id, | |
336 int request_id, | |
337 const GURL& url, | |
338 bool allowed); | |
339 | |
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 | |
346 // WebContentsObserver implementation. | 309 // WebContentsObserver implementation. |
347 virtual void DidCommitProvisionalLoadForFrame( | 310 virtual void DidCommitProvisionalLoadForFrame( |
348 content::RenderFrameHost* render_frame_host, | 311 content::RenderFrameHost* render_frame_host, |
349 const GURL& url, | 312 const GURL& url, |
350 content::PageTransition transition_type) OVERRIDE; | 313 content::PageTransition transition_type) OVERRIDE; |
351 virtual void DidFailProvisionalLoad( | 314 virtual void DidFailProvisionalLoad( |
352 content::RenderFrameHost* render_frame_host, | 315 content::RenderFrameHost* render_frame_host, |
353 const GURL& validated_url, | 316 const GURL& validated_url, |
354 int error_code, | 317 int error_code, |
355 const base::string16& error_description) OVERRIDE; | 318 const base::string16& error_description) OVERRIDE; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 changed(false) {} | 458 changed(false) {} |
496 }; | 459 }; |
497 | 460 |
498 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 461 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
499 PendingWindowMap pending_new_windows_; | 462 PendingWindowMap pending_new_windows_; |
500 | 463 |
501 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 464 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
502 }; | 465 }; |
503 | 466 |
504 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 467 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
OLD | NEW |