| 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/geolocation/geolocation_permission_context.h" | |
| 28 #include "chrome/browser/infobars/infobar_service.h" | 27 #include "chrome/browser/infobars/infobar_service.h" |
| 29 #include "chrome/browser/permissions/permission_context_base.h" | 28 #include "chrome/browser/permissions/permission_context_base.h" |
| 30 #include "chrome/browser/permissions/permission_manager.h" | 29 #include "chrome/browser/permissions/permission_manager.h" |
| 31 #include "chrome/browser/permissions/permission_request_id.h" | 30 #include "chrome/browser/permissions/permission_request_id.h" |
| 32 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | 31 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" |
| 33 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/features.h" | 33 #include "chrome/common/features.h" |
| 35 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 34 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 36 #include "chrome/test/base/testing_profile.h" | 35 #include "chrome/test/base/testing_profile.h" |
| 37 #include "components/content_settings/core/browser/host_content_settings_map.h" | 36 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 content::NotificationService::AllSources()); | 95 content::NotificationService::AllSources()); |
| 97 } | 96 } |
| 98 | 97 |
| 99 ClosedInfoBarTracker::~ClosedInfoBarTracker() { | 98 ClosedInfoBarTracker::~ClosedInfoBarTracker() { |
| 100 } | 99 } |
| 101 | 100 |
| 102 void ClosedInfoBarTracker::Observe( | 101 void ClosedInfoBarTracker::Observe( |
| 103 int type, | 102 int type, |
| 104 const content::NotificationSource& source, | 103 const content::NotificationSource& source, |
| 105 const content::NotificationDetails& details) { | 104 const content::NotificationDetails& details) { |
| 106 DCHECK(type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED); | 105 DCHECK_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, type); |
| 107 removed_infobars_.insert( | 106 removed_infobars_.insert( |
| 108 content::Details<infobars::InfoBar::RemovedDetails>(details)->first); | 107 content::Details<infobars::InfoBar::RemovedDetails>(details)->first); |
| 109 } | 108 } |
| 110 | 109 |
| 111 bool ClosedInfoBarTracker::Contains(infobars::InfoBar* infobar) const { | 110 bool ClosedInfoBarTracker::Contains(infobars::InfoBar* infobar) const { |
| 112 return removed_infobars_.count(infobar) != 0; | 111 return removed_infobars_.count(infobar) != 0; |
| 113 } | 112 } |
| 114 | 113 |
| 115 void ClosedInfoBarTracker::Clear() { | 114 void ClosedInfoBarTracker::Clear() { |
| 116 removed_infobars_.clear(); | 115 removed_infobars_.clear(); |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 // it is the embedder. | 976 // it is the embedder. |
| 978 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), | 977 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), |
| 979 requesting_frame_0.GetOrigin(), | 978 requesting_frame_0.GetOrigin(), |
| 980 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 979 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
| 981 13); | 980 13); |
| 982 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), | 981 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), |
| 983 requesting_frame_0.GetOrigin(), | 982 requesting_frame_0.GetOrigin(), |
| 984 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 983 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
| 985 11); | 984 11); |
| 986 } | 985 } |
| OLD | NEW |