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

Side by Side Diff: chrome/browser/geolocation/geolocation_permission_context_extensions.cc

Issue 347113002: Refactor PluginPermissionHelper as WebViewPermissionHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests failures. 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 #include "chrome/browser/geolocation/geolocation_permission_context_extensions.h " 5 #include "chrome/browser/geolocation/geolocation_permission_context_extensions.h "
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 8
9 #if defined(ENABLE_EXTENSIONS) 9 #if defined(ENABLE_EXTENSIONS)
10 #include "chrome/browser/content_settings/permission_request_id.h" 10 #include "chrome/browser/content_settings/permission_request_id.h"
11 #include "chrome/browser/extensions/suggest_permission_util.h" 11 #include "chrome/browser/extensions/suggest_permission_util.h"
12 #include "chrome/browser/guest_view/web_view/web_view_guest.h" 12 #include "chrome/browser/guest_view/web_view/web_view_permission_helper.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "extensions/browser/extension_registry.h" 14 #include "extensions/browser/extension_registry.h"
15 #include "extensions/browser/process_map.h" 15 #include "extensions/browser/process_map.h"
16 #include "extensions/browser/view_type_utils.h" 16 #include "extensions/browser/view_type_utils.h"
17 #include "extensions/common/extension.h" 17 #include "extensions/common/extension.h"
18 18
19 using extensions::APIPermission; 19 using extensions::APIPermission;
20 using extensions::ExtensionRegistry; 20 using extensions::ExtensionRegistry;
21 #endif 21 #endif
22 22
(...skipping 11 matching lines...) Expand all
34 const PermissionRequestID& request_id, 34 const PermissionRequestID& request_id,
35 int bridge_id, 35 int bridge_id,
36 const GURL& requesting_frame, 36 const GURL& requesting_frame,
37 bool user_gesture, 37 bool user_gesture,
38 base::Callback<void(bool)> callback, 38 base::Callback<void(bool)> callback,
39 bool* permission_set, 39 bool* permission_set,
40 bool* new_permission) { 40 bool* new_permission) {
41 #if defined(ENABLE_EXTENSIONS) 41 #if defined(ENABLE_EXTENSIONS)
42 GURL requesting_frame_origin = requesting_frame.GetOrigin(); 42 GURL requesting_frame_origin = requesting_frame.GetOrigin();
43 43
44 WebViewGuest* guest = WebViewGuest::FromWebContents(web_contents); 44 WebViewPermissionHelper* web_view_permission_helper =
45 if (guest) { 45 WebViewPermissionHelper::FromWebContents(web_contents);
46 guest->RequestGeolocationPermission(bridge_id, 46 if (web_view_permission_helper) {
47 requesting_frame, 47 web_view_permission_helper->RequestGeolocationPermission(
48 user_gesture, 48 bridge_id, requesting_frame, user_gesture, callback);
49 callback);
50 *permission_set = false; 49 *permission_set = false;
51 *new_permission = false; 50 *new_permission = false;
52 return true; 51 return true;
53 } 52 }
54 53
55 ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); 54 ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_);
56 if (extension_registry) { 55 if (extension_registry) {
57 const extensions::Extension* extension = 56 const extensions::Extension* extension =
58 extension_registry->enabled_extensions().GetExtensionOrAppByURL( 57 extension_registry->enabled_extensions().GetExtensionOrAppByURL(
59 requesting_frame_origin); 58 requesting_frame_origin);
(...skipping 24 matching lines...) Expand all
84 return true; 83 return true;
85 } 84 }
86 #endif // defined(ENABLE_EXTENSIONS) 85 #endif // defined(ENABLE_EXTENSIONS)
87 return false; 86 return false;
88 } 87 }
89 88
90 bool GeolocationPermissionContextExtensions::CancelPermissionRequest( 89 bool GeolocationPermissionContextExtensions::CancelPermissionRequest(
91 content::WebContents* web_contents, 90 content::WebContents* web_contents,
92 int bridge_id) { 91 int bridge_id) {
93 #if defined(ENABLE_EXTENSIONS) 92 #if defined(ENABLE_EXTENSIONS)
94 WebViewGuest* guest = 93 WebViewPermissionHelper* web_view_permission_helper =
95 web_contents ? WebViewGuest::FromWebContents(web_contents) : NULL; 94 web_contents ? WebViewPermissionHelper::FromWebContents(web_contents)
96 if (guest) { 95 : NULL;
97 guest->CancelGeolocationPermissionRequest(bridge_id); 96 if (web_view_permission_helper) {
97 web_view_permission_helper->CancelGeolocationPermissionRequest(bridge_id);
98 return true; 98 return true;
99 } 99 }
100 #endif // defined(ENABLE_EXTENSIONS) 100 #endif // defined(ENABLE_EXTENSIONS)
101 return false; 101 return false;
102 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698