Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 8 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
| 9 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 9 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
| 10 #pragma once | 10 #pragma once |
| 11 | 11 |
| 12 #include <map> | 12 #include <map> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 18 #include "base/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/values.h" | |
| 20 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
| 21 #include "chrome/browser/content_settings/content_settings_pattern.h" | 22 #include "chrome/browser/content_settings/content_settings_pattern.h" |
| 22 #include "chrome/browser/content_settings/content_settings_observer.h" | 23 #include "chrome/browser/content_settings/content_settings_observer.h" |
| 23 #include "chrome/browser/prefs/pref_change_registrar.h" | 24 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 24 #include "chrome/common/content_settings.h" | 25 #include "chrome/common/content_settings.h" |
| 25 #include "content/browser/browser_thread.h" | 26 #include "content/browser/browser_thread.h" |
| 26 #include "content/common/notification_observer.h" | 27 #include "content/common/notification_observer.h" |
| 27 #include "content/common/notification_registrar.h" | 28 #include "content/common/notification_registrar.h" |
| 28 | 29 |
| 29 namespace content_settings { | 30 namespace content_settings { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 ContentSetting GetDefaultContentSetting( | 63 ContentSetting GetDefaultContentSetting( |
| 63 ContentSettingsType content_type) const; | 64 ContentSettingsType content_type) const; |
| 64 | 65 |
| 65 // Returns the default settings for all content types. | 66 // Returns the default settings for all content types. |
| 66 // | 67 // |
| 67 // This may be called on any thread. | 68 // This may be called on any thread. |
| 68 ContentSettings GetDefaultContentSettings() const; | 69 ContentSettings GetDefaultContentSettings() const; |
| 69 | 70 |
| 70 // Returns a single ContentSetting which applies to the given URLs. Note that | 71 // Returns a single ContentSetting which applies to the given URLs. Note that |
| 71 // certain internal schemes are whitelisted. For ContentSettingsTypes that | 72 // certain internal schemes are whitelisted. For ContentSettingsTypes that |
| 72 // require an resource identifier to be specified, the |resource_identifier| | 73 // require an resource identifier to be specified, the |resource_identifier| |
|
wtc
2011/09/02 18:53:22
Nit: an resource => a resource
markusheintz_
2011/09/02 19:39:12
Done.
| |
| 73 // must be non-empty. | 74 // must be non-empty. |
| 74 // | 75 // |
| 75 // This may be called on any thread. | 76 // This may be called on any thread. |
| 76 ContentSetting GetContentSetting( | 77 ContentSetting GetContentSetting( |
| 77 const GURL& primary_url, | 78 const GURL& primary_url, |
| 78 const GURL& secondary_url, | 79 const GURL& secondary_url, |
| 79 ContentSettingsType content_type, | 80 ContentSettingsType content_type, |
| 80 const std::string& resource_identifier) const; | 81 const std::string& resource_identifier) const; |
| 81 | 82 |
| 83 // Returns a content setting |Value| which applies to the given URLs. Note | |
| 84 // that certain internal schemes are whitelisted. For ContentSettingsTypes | |
| 85 // that require a resource identifier to be specified, the | |
| 86 // |resource_identifier| must be non-empty. Ownership of the returned |Value| | |
| 87 // is transfered to the caller. | |
| 88 // | |
| 89 // This may be called on any thread. | |
| 90 Value* GetContentSettingValue( | |
| 91 const GURL& primary_url, | |
| 92 const GURL& secondary_url, | |
| 93 ContentSettingsType content_type, | |
| 94 const std::string& resource_identifier) const; | |
| 95 | |
| 82 // Gets the content setting for cookies. This takes the third party cookie | 96 // Gets the content setting for cookies. This takes the third party cookie |
| 83 // flag into account, and therefore needs to know whether we read or write a | 97 // flag into account, and therefore needs to know whether we read or write a |
| 84 // cookie. | 98 // cookie. |
| 85 // | 99 // |
| 86 // This may be called on any thread. | 100 // This may be called on any thread. |
| 87 ContentSetting GetCookieContentSetting( | 101 ContentSetting GetCookieContentSetting( |
| 88 const GURL& url, | 102 const GURL& url, |
| 89 const GURL& first_party_url, | 103 const GURL& first_party_url, |
| 90 bool setting_cookie) const; | 104 bool setting_cookie) const; |
| 91 | 105 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 mutable base::Lock lock_; | 259 mutable base::Lock lock_; |
| 246 | 260 |
| 247 // Misc global settings. | 261 // Misc global settings. |
| 248 bool block_third_party_cookies_; | 262 bool block_third_party_cookies_; |
| 249 bool is_block_third_party_cookies_managed_; | 263 bool is_block_third_party_cookies_managed_; |
| 250 | 264 |
| 251 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 265 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
| 252 }; | 266 }; |
| 253 | 267 |
| 254 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 268 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
| OLD | NEW |