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
3 // found in the LICENSE file.
5 #include "chrome/browser/geolocation/geolocation_permission_context_android.h"
7 #include "chrome/browser/android/location_settings.h"
8 #include "chrome/browser/android/location_settings_impl.h"
9 #include "components/content_settings/core/common/permission_request_id.h"
10 #include "content/public/browser/web_contents.h"
13 GeolocationPermissionContextAndroid::
14 GeolocationPermissionContextAndroid(Profile
* profile
)
15 : GeolocationPermissionContext(profile
),
16 location_settings_(new LocationSettingsImpl()) {
19 GeolocationPermissionContextAndroid::~GeolocationPermissionContextAndroid() {
22 void GeolocationPermissionContextAndroid::RequestPermission(
23 content::WebContents
* web_contents
,
24 const PermissionRequestID
& id
,
25 const GURL
& requesting_frame_origin
,
27 const BrowserPermissionCallback
& callback
) {
28 if (!location_settings_
->IsLocationEnabled()) {
29 PermissionDecided(id
, requesting_frame_origin
,
30 web_contents
->GetLastCommittedURL().GetOrigin(),
31 callback
, false /* persist */, CONTENT_SETTING_BLOCK
);
35 GeolocationPermissionContext::RequestPermission(
36 web_contents
, id
, requesting_frame_origin
, user_gesture
, callback
);
39 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting(
40 scoped_ptr
<LocationSettings
> settings
) {
41 location_settings_
= settings
.Pass();