Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / geolocation / geolocation_permission_context_android.cc
blob3a38c254475aa578b997ef70c83e0b608e18c061
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"
11 #include "url/gurl.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,
26 bool user_gesture,
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);
32 return;
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();