| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "chrome/browser/android/location_settings.h" | 10 #include "chrome/browser/android/location_settings.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 GeolocationPermissionContextAndroid::~GeolocationPermissionContextAndroid() { | 25 GeolocationPermissionContextAndroid::~GeolocationPermissionContextAndroid() { |
| 26 } | 26 } |
| 27 | 27 |
| 28 void GeolocationPermissionContextAndroid::RequestPermission( | 28 void GeolocationPermissionContextAndroid::RequestPermission( |
| 29 content::WebContents* web_contents, | 29 content::WebContents* web_contents, |
| 30 const PermissionRequestID& id, | 30 const PermissionRequestID& id, |
| 31 const GURL& requesting_frame_origin, | 31 const GURL& requesting_frame_origin, |
| 32 bool user_gesture, | 32 bool user_gesture, |
| 33 const BrowserPermissionCallback& callback) { | 33 const BrowserPermissionCallback& callback) { |
| 34 if (!location_settings_->CanSitesRequestLocationPermission(web_contents)) { | 34 if (!location_settings_->CanSitesRequestLocationPermission(web_contents)) { |
| 35 PermissionDecided(id, requesting_frame_origin, | 35 NotifyPermissionSet(id, requesting_frame_origin, |
| 36 web_contents->GetLastCommittedURL().GetOrigin(), | 36 web_contents->GetLastCommittedURL().GetOrigin(), |
| 37 callback, false /* persist */, CONTENT_SETTING_BLOCK); | 37 callback, false /* persist */, CONTENT_SETTING_BLOCK); |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 | 40 |
| 41 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); | 41 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); |
| 42 ContentSetting content_setting = | 42 ContentSetting content_setting = |
| 43 GeolocationPermissionContext::GetPermissionStatus(requesting_frame_origin, | 43 GeolocationPermissionContext::GetPermissionStatus(requesting_frame_origin, |
| 44 embedding_origin); | 44 embedding_origin); |
| 45 std::vector<ContentSettingsType> content_settings_types; | 45 std::vector<ContentSettingsType> content_settings_types; |
| 46 content_settings_types.push_back(CONTENT_SETTINGS_TYPE_GEOLOCATION); | 46 content_settings_types.push_back(CONTENT_SETTINGS_TYPE_GEOLOCATION); |
| 47 if (content_setting == CONTENT_SETTING_ALLOW && | 47 if (content_setting == CONTENT_SETTING_ALLOW && |
| (...skipping 24 matching lines...) Expand all Loading... |
| 72 ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 72 ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 73 | 73 |
| 74 NotifyPermissionSet(id, requesting_frame_origin, embedding_origin, callback, | 74 NotifyPermissionSet(id, requesting_frame_origin, embedding_origin, callback, |
| 75 false /* persist */, new_setting); | 75 false /* persist */, new_setting); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( | 78 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( |
| 79 scoped_ptr<LocationSettings> settings) { | 79 scoped_ptr<LocationSettings> settings) { |
| 80 location_settings_ = settings.Pass(); | 80 location_settings_ = settings.Pass(); |
| 81 } | 81 } |
| OLD | NEW |