Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/guest_view/web_view/web_view_guest.h

Issue 306473012: Plumb file system permission into WebviewGuest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small changes are made. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 WebViewPermissionType permission_type, 189 WebViewPermissionType permission_type,
190 const base::DictionaryValue& request_info, 190 const base::DictionaryValue& request_info,
191 const PermissionResponseCallback& callback, 191 const PermissionResponseCallback& callback,
192 bool allowed_by_default); 192 bool allowed_by_default);
193 193
194 // Requests Geolocation Permission from the embedder. 194 // Requests Geolocation Permission from the embedder.
195 void RequestGeolocationPermission(int bridge_id, 195 void RequestGeolocationPermission(int bridge_id,
196 const GURL& requesting_frame, 196 const GURL& requesting_frame,
197 bool user_gesture, 197 bool user_gesture,
198 const base::Callback<void(bool)>& callback); 198 const base::Callback<void(bool)>& callback);
199
200 void OnWebViewGeolocationPermissionResponse(
201 int bridge_id,
202 bool user_gesture,
203 const base::Callback<void(bool)>& callback,
204 bool allow,
205 const std::string& user_input);
206
207 void CancelGeolocationPermissionRequest(int bridge_id); 199 void CancelGeolocationPermissionRequest(int bridge_id);
208 200
209 void OnWebViewMediaPermissionResponse( 201 void RequestFileSystemPermission(const GURL& url,
210 const content::MediaStreamRequest& request, 202 bool allowed_by_default,
211 const content::MediaResponseCallback& callback, 203 const base::Callback<void(bool)>& callback);
212 bool allow,
213 const std::string& user_input);
214
215 void OnWebViewDownloadPermissionResponse(
216 const base::Callback<void(bool)>& callback,
217 bool allow,
218 const std::string& user_input);
219
220 void OnWebViewPointerLockPermissionResponse(
221 const base::Callback<void(bool)>& callback,
222 bool allow,
223 const std::string& user_input);
224
225 void OnWebViewNewWindowResponse(int new_window_instance_id,
226 bool allow,
227 const std::string& user_input);
228 204
229 enum PermissionResponseAction { 205 enum PermissionResponseAction {
230 DENY, 206 DENY,
231 ALLOW, 207 ALLOW,
232 DEFAULT 208 DEFAULT
233 }; 209 };
234 210
235 enum SetPermissionResult { 211 enum SetPermissionResult {
236 SET_PERMISSION_INVALID, 212 SET_PERMISSION_INVALID,
237 SET_PERMISSION_ALLOWED, 213 SET_PERMISSION_ALLOWED,
(...skipping 22 matching lines...) Expand all
260 // Partition data that are newer than |removal_since| will be removed. 236 // Partition data that are newer than |removal_since| will be removed.
261 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. 237 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask.
262 bool ClearData(const base::Time remove_since, 238 bool ClearData(const base::Time remove_since,
263 uint32 removal_mask, 239 uint32 removal_mask,
264 const base::Closure& callback); 240 const base::Closure& callback);
265 241
266 extensions::ScriptExecutor* script_executor() { 242 extensions::ScriptExecutor* script_executor() {
267 return script_executor_.get(); 243 return script_executor_.get();
268 } 244 }
269 245
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
248 // <webview> permission request API. The request will be:
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:
266 // - Allowed if the embedder explicitly allowed it.
267 // - Denied if the embedder explicitly denied.
268 // - Determined by the guest's content settings if the embedder does not
269 // perform an explicit action.
270 // If access was blocked due to the page's content settings,
271 // |blocked_by_policy| should be true, and this function should invoke
272 // OnContentBlocked.
273 static void FileSystemAccessedSync(int render_process_id,
274 int render_frame_id,
275 const GURL& url,
276 bool blocked_by_policy,
277 IPC::Message* reply_msg);
278
270 private: 279 private:
271 virtual ~WebViewGuest(); 280 virtual ~WebViewGuest();
272 281
273 // A map to store the callback for a request keyed by the request's id. 282 // A map to store the callback for a request keyed by the request's id.
274 struct PermissionResponseInfo { 283 struct PermissionResponseInfo {
275 PermissionResponseCallback callback; 284 PermissionResponseCallback callback;
276 WebViewPermissionType permission_type; 285 WebViewPermissionType permission_type;
277 bool allowed_by_default; 286 bool allowed_by_default;
278 PermissionResponseInfo(); 287 PermissionResponseInfo();
279 PermissionResponseInfo(const PermissionResponseCallback& callback, 288 PermissionResponseInfo(const PermissionResponseCallback& callback,
280 WebViewPermissionType permission_type, 289 WebViewPermissionType permission_type,
281 bool allowed_by_default); 290 bool allowed_by_default);
282 ~PermissionResponseInfo(); 291 ~PermissionResponseInfo();
283 }; 292 };
284 293
285 static void RecordUserInitiatedUMA(const PermissionResponseInfo& info, 294 static void RecordUserInitiatedUMA(const PermissionResponseInfo& info,
286 bool allow); 295 bool allow);
287 296
288 // Returns the top level items (ignoring submenus) as Value. 297 // Returns the top level items (ignoring submenus) as Value.
289 static scoped_ptr<base::ListValue> MenuModelToValue( 298 static scoped_ptr<base::ListValue> MenuModelToValue(
290 const ui::SimpleMenuModel& menu_model); 299 const ui::SimpleMenuModel& menu_model);
291 300
301 void OnWebViewGeolocationPermissionResponse(
302 int bridge_id,
303 bool user_gesture,
304 const base::Callback<void(bool)>& callback,
305 bool allow,
306 const std::string& user_input);
307
308 void OnWebViewFileSystemPermissionResponse(
309 const base::Callback<void(bool)>& callback,
310 bool allow,
311 const std::string& user_input);
312
313 void OnWebViewMediaPermissionResponse(
314 const content::MediaStreamRequest& request,
315 const content::MediaResponseCallback& callback,
316 bool allow,
317 const std::string& user_input);
318
319 void OnWebViewDownloadPermissionResponse(
320 const base::Callback<void(bool)>& callback,
321 bool allow,
322 const std::string& user_input);
323
324 void OnWebViewPointerLockPermissionResponse(
325 const base::Callback<void(bool)>& callback,
326 bool allow,
327 const std::string& user_input);
328
329 void OnWebViewNewWindowResponse(int new_window_instance_id,
330 bool allow,
331 const std::string& user_input);
332
333 static void FileSystemAccessedAsyncResponse(int render_process_id,
334 int render_frame_id,
335 int request_id,
336 const GURL& url,
337 bool allowed);
338
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
292 // WebContentsObserver implementation. 345 // WebContentsObserver implementation.
293 virtual void DidCommitProvisionalLoadForFrame( 346 virtual void DidCommitProvisionalLoadForFrame(
294 int64 frame_id, 347 int64 frame_id,
295 const base::string16& frame_unique_name, 348 const base::string16& frame_unique_name,
296 bool is_main_frame, 349 bool is_main_frame,
297 const GURL& url, 350 const GURL& url,
298 content::PageTransition transition_type, 351 content::PageTransition transition_type,
299 content::RenderViewHost* render_view_host) OVERRIDE; 352 content::RenderViewHost* render_view_host) OVERRIDE;
300 virtual void DidFailProvisionalLoad( 353 virtual void DidFailProvisionalLoad(
301 int64 frame_id, 354 int64 frame_id,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 name(name) {} 502 name(name) {}
450 }; 503 };
451 504
452 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; 505 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap;
453 PendingWindowMap pending_new_windows_; 506 PendingWindowMap pending_new_windows_;
454 507
455 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); 508 DISALLOW_COPY_AND_ASSIGN(WebViewGuest);
456 }; 509 };
457 510
458 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ 511 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/web_view/web_view_constants.cc ('k') | chrome/browser/guest_view/web_view/web_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698