Chromium Code Reviews| 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 // Maps hostnames to custom content settings. Written on the UI thread and read | 5 // Maps hostnames to custom content settings. Written on the UI thread and read |
| 6 // on any thread. One instance per profile. | 6 // on any thread. One instance per profile. |
| 7 | 7 |
| 8 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 8 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
| 9 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 9 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <set> | |
| 12 #include <string> | 13 #include <string> |
| 13 #include <vector> | 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 17 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 18 #include "base/prefs/pref_change_registrar.h" | 19 #include "base/prefs/pref_change_registrar.h" |
| 19 #include "base/threading/platform_thread.h" | 20 #include "base/threading/platform_thread.h" |
| 20 #include "base/threading/thread_checker.h" | 21 #include "base/threading/thread_checker.h" |
| 21 #include "components/content_settings/core/browser/content_settings_observer.h" | 22 #include "components/content_settings/core/browser/content_settings_observer.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 const GURL& secondary_url, | 237 const GURL& secondary_url, |
| 237 ContentSettingsType content_type); | 238 ContentSettingsType content_type); |
| 238 | 239 |
| 239 // Returns the last time the pattern has requested permission for the | 240 // Returns the last time the pattern has requested permission for the |
| 240 // |content_type| setting. | 241 // |content_type| setting. |
| 241 base::Time GetLastUsageByPattern( | 242 base::Time GetLastUsageByPattern( |
| 242 const ContentSettingsPattern& primary_pattern, | 243 const ContentSettingsPattern& primary_pattern, |
| 243 const ContentSettingsPattern& secondary_pattern, | 244 const ContentSettingsPattern& secondary_pattern, |
| 244 ContentSettingsType content_type); | 245 ContentSettingsType content_type); |
| 245 | 246 |
| 247 void SetShouldDisplay(const GURL& url, ContentSettingsType content_type); | |
| 248 bool ShouldDisplay(const GURL& url, ContentSettingsType content_type); | |
| 249 | |
| 246 // Adds/removes an observer for content settings changes. | 250 // Adds/removes an observer for content settings changes. |
| 247 void AddObserver(content_settings::Observer* observer); | 251 void AddObserver(content_settings::Observer* observer); |
| 248 void RemoveObserver(content_settings::Observer* observer); | 252 void RemoveObserver(content_settings::Observer* observer); |
| 249 | 253 |
| 250 // Schedules any pending lossy website settings to be written to disk. | 254 // Schedules any pending lossy website settings to be written to disk. |
| 251 void FlushLossyWebsiteSettings(); | 255 void FlushLossyWebsiteSettings(); |
| 252 | 256 |
| 253 // Passes ownership of |clock|. | 257 // Passes ownership of |clock|. |
| 254 void SetPrefClockForTesting(scoped_ptr<base::Clock> clock); | 258 void SetPrefClockForTesting(scoped_ptr<base::Clock> clock); |
| 255 | 259 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 // immutable). | 329 // immutable). |
| 326 mutable base::PlatformThreadId used_from_thread_id_; | 330 mutable base::PlatformThreadId used_from_thread_id_; |
| 327 #endif | 331 #endif |
| 328 | 332 |
| 329 // Weak; owned by the Profile. | 333 // Weak; owned by the Profile. |
| 330 PrefService* prefs_; | 334 PrefService* prefs_; |
| 331 | 335 |
| 332 // Whether this settings map is for an OTR session. | 336 // Whether this settings map is for an OTR session. |
| 333 bool is_off_the_record_; | 337 bool is_off_the_record_; |
| 334 | 338 |
| 339 std::map<GURL, std::set<ContentSettingsType>> display_map_; | |
|
Bernhard Bauer
2015/12/17 11:56:03
This should not live in the HostContentSettingsMap
svaldez
2015/12/17 15:25:42
Done.
Bernhard Bauer
2015/12/17 15:51:05
Sorry, I should have been a bit more detailed. Tab
| |
| 340 | |
| 335 // Content setting providers. This is only modified at construction | 341 // Content setting providers. This is only modified at construction |
| 336 // time and by RegisterExtensionService, both of which should happen | 342 // time and by RegisterExtensionService, both of which should happen |
| 337 // before any other uses of it. | 343 // before any other uses of it. |
| 338 ProviderMap content_settings_providers_; | 344 ProviderMap content_settings_providers_; |
| 339 | 345 |
| 340 base::ThreadChecker thread_checker_; | 346 base::ThreadChecker thread_checker_; |
| 341 | 347 |
| 342 base::ObserverList<content_settings::Observer> observers_; | 348 base::ObserverList<content_settings::Observer> observers_; |
| 343 | 349 |
| 344 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 350 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
| 345 }; | 351 }; |
| 346 | 352 |
| 347 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 353 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
| OLD | NEW |