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 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 5 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
9 #include "chrome/common/content_settings.h" | 9 #include "chrome/common/content_settings.h" |
10 #include "chrome/common/content_settings_types.h" | 10 #include "chrome/common/content_settings_types.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 GetCookieContentSetting(origin, origin, true); | 37 GetCookieContentSetting(origin, origin, true); |
38 return (content_setting == CONTENT_SETTING_SESSION_ONLY); | 38 return (content_setting == CONTENT_SETTING_SESSION_ONLY); |
39 } | 39 } |
40 | 40 |
41 bool ExtensionSpecialStoragePolicy::HasSessionOnlyOrigins() { | 41 bool ExtensionSpecialStoragePolicy::HasSessionOnlyOrigins() { |
42 if (host_content_settings_map_ == NULL) | 42 if (host_content_settings_map_ == NULL) |
43 return false; | 43 return false; |
44 if (host_content_settings_map_->GetDefaultContentSetting( | 44 if (host_content_settings_map_->GetDefaultContentSetting( |
45 CONTENT_SETTINGS_TYPE_COOKIES) == CONTENT_SETTING_SESSION_ONLY) | 45 CONTENT_SETTINGS_TYPE_COOKIES) == CONTENT_SETTING_SESSION_ONLY) |
46 return true; | 46 return true; |
47 HostContentSettingsMap::SettingsForOneType entries; | 47 ContentSettingsForOneType entries; |
48 host_content_settings_map_->GetSettingsForOneType( | 48 host_content_settings_map_->GetSettingsForOneType( |
49 CONTENT_SETTINGS_TYPE_COOKIES, "", &entries); | 49 CONTENT_SETTINGS_TYPE_COOKIES, "", &entries); |
50 for (size_t i = 0; i < entries.size(); ++i) { | 50 for (size_t i = 0; i < entries.size(); ++i) { |
51 if (entries[i].c == CONTENT_SETTING_SESSION_ONLY) | 51 if (entries[i].c == CONTENT_SETTING_SESSION_ONLY) |
52 return true; | 52 return true; |
53 } | 53 } |
54 return false; | 54 return false; |
55 } | 55 } |
56 | 56 |
57 bool ExtensionSpecialStoragePolicy::IsFileHandler( | 57 bool ExtensionSpecialStoragePolicy::IsFileHandler( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 void ExtensionSpecialStoragePolicy::SpecialCollection::Remove( | 167 void ExtensionSpecialStoragePolicy::SpecialCollection::Remove( |
168 const Extension* extension) { | 168 const Extension* extension) { |
169 cached_results_.clear(); | 169 cached_results_.clear(); |
170 extensions_.erase(extension->id()); | 170 extensions_.erase(extension->id()); |
171 } | 171 } |
172 | 172 |
173 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { | 173 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { |
174 cached_results_.clear(); | 174 cached_results_.clear(); |
175 extensions_.clear(); | 175 extensions_.clear(); |
176 } | 176 } |
OLD | NEW |