| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 10 #include "chrome/common/content_settings.h" | 10 #include "chrome/common/content_settings.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 GetCookieContentSetting(origin, origin, true); | 38 GetCookieContentSetting(origin, origin, true); |
| 39 return (content_setting == CONTENT_SETTING_SESSION_ONLY); | 39 return (content_setting == CONTENT_SETTING_SESSION_ONLY); |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool ExtensionSpecialStoragePolicy::HasSessionOnlyOrigins() { | 42 bool ExtensionSpecialStoragePolicy::HasSessionOnlyOrigins() { |
| 43 if (host_content_settings_map_ == NULL) | 43 if (host_content_settings_map_ == NULL) |
| 44 return false; | 44 return false; |
| 45 if (host_content_settings_map_->GetDefaultContentSetting( | 45 if (host_content_settings_map_->GetDefaultContentSetting( |
| 46 CONTENT_SETTINGS_TYPE_COOKIES, NULL) == CONTENT_SETTING_SESSION_ONLY) | 46 CONTENT_SETTINGS_TYPE_COOKIES, NULL) == CONTENT_SETTING_SESSION_ONLY) |
| 47 return true; | 47 return true; |
| 48 HostContentSettingsMap::SettingsForOneType entries; | 48 ContentSettingsForOneType entries; |
| 49 host_content_settings_map_->GetSettingsForOneType( | 49 host_content_settings_map_->GetSettingsForOneType( |
| 50 CONTENT_SETTINGS_TYPE_COOKIES, "", &entries); | 50 CONTENT_SETTINGS_TYPE_COOKIES, "", &entries); |
| 51 for (size_t i = 0; i < entries.size(); ++i) { | 51 for (size_t i = 0; i < entries.size(); ++i) { |
| 52 if (entries[i].c == CONTENT_SETTING_SESSION_ONLY) | 52 if (entries[i].setting == CONTENT_SETTING_SESSION_ONLY) |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 return false; | 55 return false; |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool ExtensionSpecialStoragePolicy::IsFileHandler( | 58 bool ExtensionSpecialStoragePolicy::IsFileHandler( |
| 59 const std::string& extension_id) { | 59 const std::string& extension_id) { |
| 60 base::AutoLock locker(lock_); | 60 base::AutoLock locker(lock_); |
| 61 return file_handler_extensions_.ContainsExtension(extension_id); | 61 return file_handler_extensions_.ContainsExtension(extension_id); |
| 62 } | 62 } |
| (...skipping 104 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 |