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

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: Move permission requests to WebViewGuest. 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"
11 #include "chrome/browser/extensions/tab_helper.h" 11 #include "chrome/browser/extensions/tab_helper.h"
12 #include "chrome/browser/guest_view/guest_view.h" 12 #include "chrome/browser/guest_view/guest_view.h"
13 #include "chrome/browser/guest_view/web_view/javascript_dialog_helper.h" 13 #include "chrome/browser/guest_view/web_view/javascript_dialog_helper.h"
14 #include "chrome/browser/guest_view/web_view/web_view_find_helper.h" 14 #include "chrome/browser/guest_view/web_view/web_view_find_helper.h"
15 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" 15 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h"
16 #include "chrome/common/extensions/api/webview.h" 16 #include "chrome/common/extensions/api/webview.h"
17 #include "content/public/browser/javascript_dialog_manager.h" 17 #include "content/public/browser/javascript_dialog_manager.h"
18 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
19 #include "content/public/browser/render_frame_host.h"
19 #include "content/public/browser/web_contents_observer.h" 20 #include "content/public/browser/web_contents_observer.h"
20 #include "third_party/WebKit/public/web/WebFindOptions.h" 21 #include "third_party/WebKit/public/web/WebFindOptions.h"
21 22
22 #if defined(OS_CHROMEOS) 23 #if defined(OS_CHROMEOS)
23 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 24 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
24 #endif 25 #endif
25 26
26 namespace webview_api = extensions::api::webview; 27 namespace webview_api = extensions::api::webview;
27 28
28 class RenderViewContextMenu; 29 class RenderViewContextMenu;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 176
176 void OnWebViewGeolocationPermissionResponse( 177 void OnWebViewGeolocationPermissionResponse(
177 int bridge_id, 178 int bridge_id,
178 bool user_gesture, 179 bool user_gesture,
179 const base::Callback<void(bool)>& callback, 180 const base::Callback<void(bool)>& callback,
180 bool allow, 181 bool allow,
181 const std::string& user_input); 182 const std::string& user_input);
182 183
183 void CancelGeolocationPermissionRequest(int bridge_id); 184 void CancelGeolocationPermissionRequest(int bridge_id);
184 185
186 void RequestFileSystemPermission(const GURL& url,
187 const base::Callback<void(bool)>& callback);
188
189 void OnWebViewFileSystemPermissionResponse(
190 const base::Callback<void(bool)>& callback,
191 bool allow,
192 const std::string& user_input);
193
185 void OnWebViewMediaPermissionResponse( 194 void OnWebViewMediaPermissionResponse(
186 const content::MediaStreamRequest& request, 195 const content::MediaStreamRequest& request,
187 const content::MediaResponseCallback& callback, 196 const content::MediaResponseCallback& callback,
188 bool allow, 197 bool allow,
189 const std::string& user_input); 198 const std::string& user_input);
190 199
191 void OnWebViewDownloadPermissionResponse( 200 void OnWebViewDownloadPermissionResponse(
192 const base::Callback<void(bool)>& callback, 201 const base::Callback<void(bool)>& callback,
193 bool allow, 202 bool allow,
194 const std::string& user_input); 203 const std::string& user_input);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // Partition data that are newer than |removal_since| will be removed. 245 // Partition data that are newer than |removal_since| will be removed.
237 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. 246 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask.
238 bool ClearData(const base::Time remove_since, 247 bool ClearData(const base::Time remove_since,
239 uint32 removal_mask, 248 uint32 removal_mask,
240 const base::Closure& callback); 249 const base::Closure& callback);
241 250
242 extensions::ScriptExecutor* script_executor() { 251 extensions::ScriptExecutor* script_executor() {
243 return script_executor_.get(); 252 return script_executor_.get();
244 } 253 }
245 254
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 static void FileSystemAccessedSyncDelayReply(int render_process_id,
262 int render_frame_id,
263 const GURL& url,
264 IPC::Message* reply_msg,
265 bool blocked_by_policy);
266
246 private: 267 private:
247 virtual ~WebViewGuest(); 268 virtual ~WebViewGuest();
248 269
249 // A map to store the callback for a request keyed by the request's id. 270 // A map to store the callback for a request keyed by the request's id.
250 struct PermissionResponseInfo { 271 struct PermissionResponseInfo {
251 PermissionResponseCallback callback; 272 PermissionResponseCallback callback;
252 WebViewPermissionType permission_type; 273 WebViewPermissionType permission_type;
253 bool allowed_by_default; 274 bool allowed_by_default;
254 PermissionResponseInfo(); 275 PermissionResponseInfo();
255 PermissionResponseInfo(const PermissionResponseCallback& callback, 276 PermissionResponseInfo(const PermissionResponseCallback& callback,
256 WebViewPermissionType permission_type, 277 WebViewPermissionType permission_type,
257 bool allowed_by_default); 278 bool allowed_by_default);
258 ~PermissionResponseInfo(); 279 ~PermissionResponseInfo();
259 }; 280 };
260 281
261 static void RecordUserInitiatedUMA(const PermissionResponseInfo& info, 282 static void RecordUserInitiatedUMA(const PermissionResponseInfo& info,
262 bool allow); 283 bool allow);
263 284
264 // Returns the top level items (ignoring submenus) as Value. 285 // Returns the top level items (ignoring submenus) as Value.
265 static scoped_ptr<base::ListValue> MenuModelToValue( 286 static scoped_ptr<base::ListValue> MenuModelToValue(
266 const ui::SimpleMenuModel& menu_model); 287 const ui::SimpleMenuModel& menu_model);
267 288
289 static void FileSystemAccessedAsyncInternal(int render_process_id,
290 int render_frame_id,
291 int request_id,
292 const GURL& url,
293 bool blocked_by_policy);
294
295 static void FileSystemAccessedSyncDelayReplyInternal(int render_process_id,
296 int render_frame_id,
297 const GURL& url,
298 IPC::Message* reply_msg,
299 bool blocked_by_policy);
300
301 static WebViewGuest* GetWebViewGuest(int render_process_id,
302 int render_frame_id);
303
268 // WebContentsObserver implementation. 304 // WebContentsObserver implementation.
269 virtual void DidCommitProvisionalLoadForFrame( 305 virtual void DidCommitProvisionalLoadForFrame(
270 int64 frame_id, 306 int64 frame_id,
271 const base::string16& frame_unique_name, 307 const base::string16& frame_unique_name,
272 bool is_main_frame, 308 bool is_main_frame,
273 const GURL& url, 309 const GURL& url,
274 content::PageTransition transition_type, 310 content::PageTransition transition_type,
275 content::RenderViewHost* render_view_host) OVERRIDE; 311 content::RenderViewHost* render_view_host) OVERRIDE;
276 virtual void DidFailProvisionalLoad( 312 virtual void DidFailProvisionalLoad(
277 int64 frame_id, 313 int64 frame_id,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 name(name) {} 463 name(name) {}
428 }; 464 };
429 465
430 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; 466 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap;
431 PendingWindowMap pending_new_windows_; 467 PendingWindowMap pending_new_windows_;
432 468
433 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); 469 DISALLOW_COPY_AND_ASSIGN(WebViewGuest);
434 }; 470 };
435 471
436 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ 472 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698