OLD | NEW |
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_android.h" | 5 #include "chrome/browser/geolocation/geolocation_permission_context_android.h" |
6 | 6 |
7 #include "chrome/browser/android/app_google_location_settings_helper.h" | 7 #include "chrome/browser/android/location_settings.h" |
8 #include "chrome/browser/android/google_location_settings_helper.h" | 8 #include "chrome/browser/android/location_settings_impl.h" |
9 #include "components/content_settings/core/common/permission_request_id.h" | 9 #include "components/content_settings/core/common/permission_request_id.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 GeolocationPermissionContextAndroid:: | 13 GeolocationPermissionContextAndroid:: |
14 GeolocationPermissionContextAndroid(Profile* profile) | 14 GeolocationPermissionContextAndroid(Profile* profile) |
15 : GeolocationPermissionContext(profile), | 15 : GeolocationPermissionContext(profile), |
16 google_location_settings_helper_(new AppGoogleLocationSettingsHelper()) { | 16 location_settings_(new LocationSettingsImpl()) { |
17 } | 17 } |
18 | 18 |
19 GeolocationPermissionContextAndroid::~GeolocationPermissionContextAndroid() { | 19 GeolocationPermissionContextAndroid::~GeolocationPermissionContextAndroid() { |
20 } | 20 } |
21 | 21 |
22 void GeolocationPermissionContextAndroid::RequestPermission( | 22 void GeolocationPermissionContextAndroid::RequestPermission( |
23 content::WebContents* web_contents, | 23 content::WebContents* web_contents, |
24 const PermissionRequestID& id, | 24 const PermissionRequestID& id, |
25 const GURL& requesting_frame_origin, | 25 const GURL& requesting_frame_origin, |
26 bool user_gesture, | 26 bool user_gesture, |
27 const BrowserPermissionCallback& callback) { | 27 const BrowserPermissionCallback& callback) { |
28 if (!google_location_settings_helper_->IsSystemLocationEnabled()) { | 28 if (!location_settings_->IsLocationEnabled()) { |
29 PermissionDecided(id, requesting_frame_origin, | 29 PermissionDecided(id, requesting_frame_origin, |
30 web_contents->GetLastCommittedURL().GetOrigin(), | 30 web_contents->GetLastCommittedURL().GetOrigin(), |
31 callback, false /* persist */, false /* granted */); | 31 callback, false /* persist */, false /* granted */); |
32 return; | 32 return; |
33 } | 33 } |
34 | 34 |
35 GeolocationPermissionContext::RequestPermission( | 35 GeolocationPermissionContext::RequestPermission( |
36 web_contents, id, requesting_frame_origin, user_gesture, callback); | 36 web_contents, id, requesting_frame_origin, user_gesture, callback); |
37 } | 37 } |
38 | 38 |
39 void GeolocationPermissionContextAndroid:: | 39 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( |
40 SetGoogleLocationSettingsHelperForTesting( | 40 scoped_ptr<LocationSettings> settings) { |
41 scoped_ptr<GoogleLocationSettingsHelper> helper) { | 41 location_settings_ = settings.Pass(); |
42 google_location_settings_helper_ = helper.Pass(); | |
43 } | 42 } |
OLD | NEW |