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/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) { | 40 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) { |
41 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUnlimitedStorage)) | 41 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUnlimitedStorage)) |
42 return true; | 42 return true; |
43 | 43 |
44 base::AutoLock locker(lock_); | 44 base::AutoLock locker(lock_); |
45 return unlimited_extensions_.Contains(origin); | 45 return unlimited_extensions_.Contains(origin); |
46 } | 46 } |
47 | 47 |
48 bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) { | 48 bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) { |
49 if (cookie_settings_ == NULL) | 49 if (cookie_settings_.get() == NULL) |
50 return false; | 50 return false; |
51 return cookie_settings_->IsCookieSessionOnly(origin); | 51 return cookie_settings_->IsCookieSessionOnly(origin); |
52 } | 52 } |
53 | 53 |
54 bool ExtensionSpecialStoragePolicy::CanQueryDiskSize(const GURL& origin) { | 54 bool ExtensionSpecialStoragePolicy::CanQueryDiskSize(const GURL& origin) { |
55 return installed_apps_.Contains(origin); | 55 return installed_apps_.Contains(origin); |
56 } | 56 } |
57 | 57 |
58 bool ExtensionSpecialStoragePolicy::HasSessionOnlyOrigins() { | 58 bool ExtensionSpecialStoragePolicy::HasSessionOnlyOrigins() { |
59 if (cookie_settings_ == NULL) | 59 if (cookie_settings_.get() == NULL) |
60 return false; | 60 return false; |
61 if (cookie_settings_->GetDefaultCookieSetting(NULL) == | 61 if (cookie_settings_->GetDefaultCookieSetting(NULL) == |
62 CONTENT_SETTING_SESSION_ONLY) | 62 CONTENT_SETTING_SESSION_ONLY) |
63 return true; | 63 return true; |
64 ContentSettingsForOneType entries; | 64 ContentSettingsForOneType entries; |
65 cookie_settings_->GetCookieSettings(&entries); | 65 cookie_settings_->GetCookieSettings(&entries); |
66 for (size_t i = 0; i < entries.size(); ++i) { | 66 for (size_t i = 0; i < entries.size(); ++i) { |
67 if (entries[i].setting == CONTENT_SETTING_SESSION_ONLY) | 67 if (entries[i].setting == CONTENT_SETTING_SESSION_ONLY) |
68 return true; | 68 return true; |
69 } | 69 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { | 266 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { |
267 ClearCache(); | 267 ClearCache(); |
268 extensions_.Clear(); | 268 extensions_.Clear(); |
269 } | 269 } |
270 | 270 |
271 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { | 271 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { |
272 STLDeleteValues(&cached_results_); | 272 STLDeleteValues(&cached_results_); |
273 cached_results_.clear(); | 273 cached_results_.clear(); |
274 } | 274 } |
OLD | NEW |