| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 void GeolocationPermissionContextAndroid::RequestPermission( | 31 void GeolocationPermissionContextAndroid::RequestPermission( |
| 32 content::WebContents* web_contents, | 32 content::WebContents* web_contents, |
| 33 const PermissionRequestID& id, | 33 const PermissionRequestID& id, |
| 34 const GURL& requesting_frame_origin, | 34 const GURL& requesting_frame_origin, |
| 35 bool user_gesture, | 35 bool user_gesture, |
| 36 const BrowserPermissionCallback& callback) { | 36 const BrowserPermissionCallback& callback) { |
| 37 if (!location_settings_->CanSitesRequestLocationPermission(web_contents)) { | 37 if (!location_settings_->CanSitesRequestLocationPermission(web_contents)) { |
| 38 PermissionDecided(id, requesting_frame_origin, | 38 PermissionDecided(id, requesting_frame_origin, |
| 39 web_contents->GetLastCommittedURL().GetOrigin(), | 39 web_contents->GetLastCommittedURL().GetOrigin(), |
| 40 callback, false /* persist */, CONTENT_SETTING_BLOCK); | 40 user_gesture, callback, false /* persist */, |
| 41 CONTENT_SETTING_BLOCK); |
| 41 return; | 42 return; |
| 42 } | 43 } |
| 43 | 44 |
| 44 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); | 45 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); |
| 45 ContentSetting content_setting = | 46 ContentSetting content_setting = |
| 46 GeolocationPermissionContext::GetPermissionStatus(requesting_frame_origin, | 47 GeolocationPermissionContext::GetPermissionStatus(requesting_frame_origin, |
| 47 embedding_origin); | 48 embedding_origin); |
| 48 std::vector<ContentSettingsType> content_settings_types; | 49 std::vector<ContentSettingsType> content_settings_types; |
| 49 content_settings_types.push_back(CONTENT_SETTINGS_TYPE_GEOLOCATION); | 50 content_settings_types.push_back(CONTENT_SETTINGS_TYPE_GEOLOCATION); |
| 50 if (content_setting == CONTENT_SETTING_ALLOW && | 51 if (content_setting == CONTENT_SETTING_ALLOW && |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 90 ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 90 | 91 |
| 91 NotifyPermissionSet(id, requesting_frame_origin, embedding_origin, callback, | 92 NotifyPermissionSet(id, requesting_frame_origin, embedding_origin, callback, |
| 92 false /* persist */, new_setting); | 93 false /* persist */, new_setting); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( | 96 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( |
| 96 std::unique_ptr<LocationSettings> settings) { | 97 std::unique_ptr<LocationSettings> settings) { |
| 97 location_settings_ = std::move(settings); | 98 location_settings_ = std::move(settings); |
| 98 } | 99 } |
| OLD | NEW |