Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / extensions / browser / guest_view / web_view / web_view_permission_helper_delegate.h
blobb43b73a3f74e519563c3588b3234efcd98aa6dc7
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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIWE_PERMISSION_HELPER_DELEGATE_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIWE_PERMISSION_HELPER_DELEGATE_H_
8 #include "content/public/browser/web_contents.h"
9 #include "content/public/browser/web_contents_observer.h"
10 #include "content/public/common/media_stream_request.h"
11 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
13 namespace extensions {
15 // A delegate class of WebViewPermissionHelper to request permissions that are
16 // not a part of extensions.
17 class WebViewPermissionHelperDelegate : public content::WebContentsObserver {
18 public:
19 explicit WebViewPermissionHelperDelegate(
20 WebViewPermissionHelper* web_view_permission_helper);
21 virtual ~WebViewPermissionHelperDelegate();
23 virtual void RequestMediaAccessPermission(
24 content::WebContents* source,
25 const content::MediaStreamRequest& request,
26 const content::MediaResponseCallback& callback) {}
28 virtual void CanDownload(
29 content::RenderViewHost* render_view_host,
30 const GURL& url,
31 const std::string& request_method,
32 const base::Callback<void(bool)>& callback) {}
34 virtual void RequestPointerLockPermission(
35 bool user_gesture,
36 bool last_unlocked_by_target,
37 const base::Callback<void(bool)>& callback) {}
39 // Requests Geolocation Permission from the embedder.
40 virtual void RequestGeolocationPermission(
41 int bridge_id,
42 const GURL& requesting_frame,
43 bool user_gesture,
44 const base::Callback<void(bool)>& callback) {}
46 virtual void CancelGeolocationPermissionRequest(int bridge_id) {}
48 virtual void RequestFileSystemPermission(
49 const GURL& url,
50 bool allowed_by_default,
51 const base::Callback<void(bool)>& callback) {}
53 // Called when file system access is requested by the guest content using the
54 // asynchronous HTML5 file system API. The request is plumbed through the
55 // <webview> permission request API. The request will be:
56 // - Allowed if the embedder explicitly allowed it.
57 // - Denied if the embedder explicitly denied.
58 // - Determined by the guest's content settings if the embedder does not
59 // perform an explicit action.
60 // If access was blocked due to the page's content settings,
61 // |blocked_by_policy| should be true, and this function should invoke
62 // OnContentBlocked.
63 virtual void FileSystemAccessedAsync(
64 int render_process_id,
65 int render_frame_id,
66 int request_id,
67 const GURL& url,
68 bool blocked_by_policy) {}
70 // Called when file system access is requested by the guest content using the
71 // synchronous HTML5 file system API in a worker thread or shared worker. The
72 // request is plumbed through the <webview> permission request API. The
73 // request will be:
74 // - Allowed if the embedder explicitly allowed it.
75 // - Denied if the embedder explicitly denied.
76 // - Determined by the guest's content settings if the embedder does not
77 // perform an explicit action.
78 // If access was blocked due to the page's content settings,
79 // |blocked_by_policy| should be true, and this function should invoke
80 // OnContentBlocked.
81 virtual void FileSystemAccessedSync(
82 int render_process_id,
83 int render_frame_id,
84 const GURL& url,
85 bool blocked_by_policy,
86 IPC::Message* reply_msg) {}
88 WebViewPermissionHelper* web_view_permission_helper() const {
89 return web_view_permission_helper_;
92 private:
93 WebViewPermissionHelper* const web_view_permission_helper_;
95 DISALLOW_COPY_AND_ASSIGN(WebViewPermissionHelperDelegate);
98 } // namespace extensions
100 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIWE_PERMISSION_HELPER_DELEGATE_H_