| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.h" | 5 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 scoped_feature_list.InitAndEnableFeature( | 1333 scoped_feature_list.InitAndEnableFeature( |
| 1334 features::kConsistentOmniboxGeolocation); | 1334 features::kConsistentOmniboxGeolocation); |
| 1335 | 1335 |
| 1336 GURL requesting_frame(TestSearchEngineDelegate::kDSETestUrl); | 1336 GURL requesting_frame(TestSearchEngineDelegate::kDSETestUrl); |
| 1337 // The DSE Geolocation setting should be used in incognito if it is BLOCK, | 1337 // The DSE Geolocation setting should be used in incognito if it is BLOCK, |
| 1338 // but not if it is ALLOW. | 1338 // but not if it is ALLOW. |
| 1339 SearchGeolocationService* geo_service = | 1339 SearchGeolocationService* geo_service = |
| 1340 SearchGeolocationService::Factory::GetForBrowserContext(profile()); | 1340 SearchGeolocationService::Factory::GetForBrowserContext(profile()); |
| 1341 geo_service->SetSearchEngineDelegateForTest( | 1341 geo_service->SetSearchEngineDelegateForTest( |
| 1342 base::MakeUnique<TestSearchEngineDelegate>()); | 1342 base::MakeUnique<TestSearchEngineDelegate>()); |
| 1343 geo_service->SetLocationSettingsForTest( | |
| 1344 base::MakeUnique<MockLocationSettings>()); | |
| 1345 | 1343 |
| 1346 Profile* otr_profile = profile()->GetOffTheRecordProfile(); | 1344 Profile* otr_profile = profile()->GetOffTheRecordProfile(); |
| 1347 | 1345 |
| 1348 // A DSE setting of ALLOW should not flow through to incognito. | 1346 // A DSE setting of ALLOW should not flow through to incognito. |
| 1349 geo_service->SetDSEGeolocationSetting(true); | 1347 geo_service->SetDSEGeolocationSetting(true); |
| 1350 ASSERT_EQ(CONTENT_SETTING_ASK, | 1348 ASSERT_EQ(CONTENT_SETTING_ASK, |
| 1351 PermissionManager::Get(otr_profile) | 1349 PermissionManager::Get(otr_profile) |
| 1352 ->GetPermissionStatus(CONTENT_SETTINGS_TYPE_GEOLOCATION, | 1350 ->GetPermissionStatus(CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 1353 requesting_frame, requesting_frame) | 1351 requesting_frame, requesting_frame) |
| 1354 .content_setting); | 1352 .content_setting); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 SetGeolocationContentSetting(requesting_frame, requesting_frame, | 1504 SetGeolocationContentSetting(requesting_frame, requesting_frame, |
| 1507 CONTENT_SETTING_BLOCK); | 1505 CONTENT_SETTING_BLOCK); |
| 1508 MockLocationSettings::SetLocationSettingsDialogStatus(true /* enabled */, | 1506 MockLocationSettings::SetLocationSettingsDialogStatus(true /* enabled */, |
| 1509 GRANTED); | 1507 GRANTED); |
| 1510 ASSERT_EQ(blink::mojom::PermissionStatus::DENIED, | 1508 ASSERT_EQ(blink::mojom::PermissionStatus::DENIED, |
| 1511 PermissionManager::Get(profile())->GetPermissionStatus( | 1509 PermissionManager::Get(profile())->GetPermissionStatus( |
| 1512 content::PermissionType::GEOLOCATION, requesting_frame, | 1510 content::PermissionType::GEOLOCATION, requesting_frame, |
| 1513 requesting_frame)); | 1511 requesting_frame)); |
| 1514 } | 1512 } |
| 1515 #endif // defined(OS_ANDROID) | 1513 #endif // defined(OS_ANDROID) |
| OLD | NEW |