| 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> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/id_map.h" | 18 #include "base/id_map.h" |
| 19 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/synchronization/waitable_event.h" | 21 #include "base/synchronization/waitable_event.h" |
| 22 #include "base/test/simple_test_clock.h" | 22 #include "base/test/simple_test_clock.h" |
| 23 #include "base/time/clock.h" | 23 #include "base/time/clock.h" |
| 24 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
| 25 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 25 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 26 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 26 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 27 #include "chrome/browser/infobars/infobar_service.h" | 27 #include "chrome/browser/infobars/infobar_service.h" |
| 28 #include "chrome/browser/permissions/permission_context_base.h" | 28 #include "chrome/browser/permissions/permission_context_base.h" |
| 29 #include "chrome/browser/permissions/permission_manager.h" | 29 #include "chrome/browser/permissions/permission_manager.h" |
| 30 #include "chrome/browser/permissions/permission_request.h" |
| 30 #include "chrome/browser/permissions/permission_request_id.h" | 31 #include "chrome/browser/permissions/permission_request_id.h" |
| 31 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/features.h" | 33 #include "chrome/common/features.h" |
| 34 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 34 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 35 #include "chrome/test/base/testing_profile.h" | 35 #include "chrome/test/base/testing_profile.h" |
| 36 #include "components/content_settings/core/browser/host_content_settings_map.h" | 36 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 37 #include "components/infobars/core/confirm_infobar_delegate.h" | 37 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 38 #include "components/infobars/core/infobar.h" | 38 #include "components/infobars/core/infobar.h" |
| 39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/navigation_details.h" | 40 #include "content/public/browser/navigation_details.h" |
| 41 #include "content/public/browser/navigation_entry.h" | 41 #include "content/public/browser/navigation_entry.h" |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 ConfirmInfoBarDelegate* infobar_delegate = | 386 ConfirmInfoBarDelegate* infobar_delegate = |
| 387 infobar->delegate()->AsConfirmInfoBarDelegate(); | 387 infobar->delegate()->AsConfirmInfoBarDelegate(); |
| 388 infobar_delegate->Accept(); | 388 infobar_delegate->Accept(); |
| 389 #endif | 389 #endif |
| 390 } | 390 } |
| 391 | 391 |
| 392 base::string16 GeolocationPermissionContextTests::GetPromptText() { | 392 base::string16 GeolocationPermissionContextTests::GetPromptText() { |
| 393 #if !BUILDFLAG(ANDROID_JAVA_UI) | 393 #if !BUILDFLAG(ANDROID_JAVA_UI) |
| 394 PermissionRequestManager* manager = | 394 PermissionRequestManager* manager = |
| 395 PermissionRequestManager::FromWebContents(web_contents()); | 395 PermissionRequestManager::FromWebContents(web_contents()); |
| 396 PermissionBubbleRequest* request = manager->requests_.front(); | 396 PermissionRequest* request = manager->requests_.front(); |
| 397 return base::ASCIIToUTF16(request->GetOrigin().spec()) + | 397 return base::ASCIIToUTF16(request->GetOrigin().spec()) + |
| 398 request->GetMessageTextFragment(); | 398 request->GetMessageTextFragment(); |
| 399 #else | 399 #else |
| 400 infobars::InfoBar* infobar = infobar_service()->infobar_at(0); | 400 infobars::InfoBar* infobar = infobar_service()->infobar_at(0); |
| 401 ConfirmInfoBarDelegate* infobar_delegate = | 401 ConfirmInfoBarDelegate* infobar_delegate = |
| 402 infobar->delegate()->AsConfirmInfoBarDelegate(); | 402 infobar->delegate()->AsConfirmInfoBarDelegate(); |
| 403 return infobar_delegate->GetMessageText(); | 403 return infobar_delegate->GetMessageText(); |
| 404 #endif | 404 #endif |
| 405 } | 405 } |
| 406 | 406 |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 // it is the embedder. | 999 // it is the embedder. |
| 1000 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), | 1000 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), |
| 1001 requesting_frame_0.GetOrigin(), | 1001 requesting_frame_0.GetOrigin(), |
| 1002 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 1002 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
| 1003 13); | 1003 13); |
| 1004 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), | 1004 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), |
| 1005 requesting_frame_0.GetOrigin(), | 1005 requesting_frame_0.GetOrigin(), |
| 1006 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 1006 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
| 1007 11); | 1007 11); |
| 1008 } | 1008 } |
| OLD | NEW |