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

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

Issue 2612993002: Make geolocation API and X-Geo header access consistent (Closed)
Patch Set: Fix test / merge error Created 3 years, 11 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.h" 5 #include "chrome/browser/geolocation/geolocation_permission_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/permissions/permission_request_id.h" 9 #include "chrome/browser/permissions/permission_request_id.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/permission_type.h" 12 #include "content/public/browser/permission_type.h"
13 #include "content/public/browser/render_frame_host.h" 13 #include "content/public/browser/render_frame_host.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "device/geolocation/geolocation_provider.h" 15 #include "device/geolocation/geolocation_provider.h"
16 16 #include "url/origin.h"
17 #if defined(OS_ANDROID)
18 #include "chrome/browser/android/search_geolocation/search_geolocation_disclosur e_infobar_delegate.h"
19 #endif
20 17
21 GeolocationPermissionContext::GeolocationPermissionContext(Profile* profile) 18 GeolocationPermissionContext::GeolocationPermissionContext(Profile* profile)
22 : PermissionContextBase(profile, 19 : PermissionContextBase(profile,
23 content::PermissionType::GEOLOCATION, 20 content::PermissionType::GEOLOCATION,
24 CONTENT_SETTINGS_TYPE_GEOLOCATION), 21 CONTENT_SETTINGS_TYPE_GEOLOCATION),
25 extensions_context_(profile) {} 22 extensions_context_(profile) {}
26 23
27 GeolocationPermissionContext::~GeolocationPermissionContext() { 24 GeolocationPermissionContext::~GeolocationPermissionContext() {
28 } 25 }
29 26
(...skipping 17 matching lines...) Expand all
47 NotifyPermissionSet(id, 44 NotifyPermissionSet(id,
48 requesting_origin, 45 requesting_origin,
49 web_contents->GetLastCommittedURL().GetOrigin(), 46 web_contents->GetLastCommittedURL().GetOrigin(),
50 callback, 47 callback,
51 false /* persist */, 48 false /* persist */,
52 content_setting); 49 content_setting);
53 } 50 }
54 return; 51 return;
55 } 52 }
56 53
57 #if defined(OS_ANDROID)
58 // If the search geolocation disclosure is open, don't pop up a permission
59 // request. Treat this as a dismissal instead.
60 if (SearchGeolocationDisclosureInfoBarDelegate::
61 IsSearchGeolocationDisclosureOpen(web_contents)) {
62 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
63 false /* persist */, CONTENT_SETTING_DEFAULT);
64 return;
65 }
66 #endif
67
68 PermissionContextBase::DecidePermission(web_contents, 54 PermissionContextBase::DecidePermission(web_contents,
69 id, 55 id,
70 requesting_origin, 56 requesting_origin,
71 embedding_origin, 57 embedding_origin,
72 user_gesture, 58 user_gesture,
73 callback); 59 callback);
74 } 60 }
75 61
76 void GeolocationPermissionContext::CancelPermissionRequest( 62 void GeolocationPermissionContext::CancelPermissionRequest(
77 content::WebContents* web_contents, 63 content::WebContents* web_contents,
(...skipping 21 matching lines...) Expand all
99 85
100 if (allowed) { 86 if (allowed) {
101 device::GeolocationProvider::GetInstance() 87 device::GeolocationProvider::GetInstance()
102 ->UserDidOptIntoLocationServices(); 88 ->UserDidOptIntoLocationServices();
103 } 89 }
104 } 90 }
105 91
106 bool GeolocationPermissionContext::IsRestrictedToSecureOrigins() const { 92 bool GeolocationPermissionContext::IsRestrictedToSecureOrigins() const {
107 return true; 93 return true;
108 } 94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698