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/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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 return true; | 129 return true; |
130 } | 130 } |
131 return false; | 131 return false; |
132 } | 132 } |
133 | 133 |
134 bool ExtensionSpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) { | 134 bool ExtensionSpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) { |
135 base::AutoLock locker(lock_); | 135 base::AutoLock locker(lock_); |
136 return isolated_extensions_.Contains(origin); | 136 return isolated_extensions_.Contains(origin); |
137 } | 137 } |
138 | 138 |
| 139 bool ExtensionSpecialStoragePolicy::IsStorageDurable(const GURL& origin) { |
| 140 ContentSettingsForOneType entries; |
| 141 cookie_settings_->GetDurableSettings(&entries); |
| 142 for (size_t i = 0; i < entries.size(); ++i) { |
| 143 if (!entries[i].primary_pattern.Matches(origin)) |
| 144 continue; |
| 145 // TODO(dgrogan): How should this use secondary_pattern? |
| 146 return entries[i].setting == CONTENT_SETTING_ALLOW; |
| 147 } |
| 148 return false; |
| 149 } |
| 150 |
139 bool ExtensionSpecialStoragePolicy::NeedsProtection( | 151 bool ExtensionSpecialStoragePolicy::NeedsProtection( |
140 const extensions::Extension* extension) { | 152 const extensions::Extension* extension) { |
141 return extension->is_hosted_app() && !extension->from_bookmark(); | 153 return extension->is_hosted_app() && !extension->from_bookmark(); |
142 } | 154 } |
143 | 155 |
144 const extensions::ExtensionSet* | 156 const extensions::ExtensionSet* |
145 ExtensionSpecialStoragePolicy::ExtensionsProtectingOrigin( | 157 ExtensionSpecialStoragePolicy::ExtensionsProtectingOrigin( |
146 const GURL& origin) { | 158 const GURL& origin) { |
147 base::AutoLock locker(lock_); | 159 base::AutoLock locker(lock_); |
148 return protected_apps_.ExtensionsContaining(origin); | 160 return protected_apps_.ExtensionsContaining(origin); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 363 } |
352 | 364 |
353 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { | 365 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { |
354 ClearCache(); | 366 ClearCache(); |
355 extensions_.Clear(); | 367 extensions_.Clear(); |
356 } | 368 } |
357 | 369 |
358 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { | 370 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { |
359 STLDeleteValues(&cached_results_); | 371 STLDeleteValues(&cached_results_); |
360 } | 372 } |
OLD | NEW |