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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {} | 82 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {} |
83 | 83 |
84 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) { | 84 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) { |
85 if (origin.SchemeIs(extensions::kExtensionScheme)) | 85 if (origin.SchemeIs(extensions::kExtensionScheme)) |
86 return true; | 86 return true; |
87 base::AutoLock locker(lock_); | 87 base::AutoLock locker(lock_); |
88 return protected_apps_.Contains(origin); | 88 return protected_apps_.Contains(origin); |
89 } | 89 } |
90 | 90 |
91 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) { | 91 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) { |
92 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUnlimitedStorage)) | 92 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 93 switches::kUnlimitedStorage)) |
93 return true; | 94 return true; |
94 | 95 |
95 if (origin.SchemeIs(content::kChromeDevToolsScheme) && | 96 if (origin.SchemeIs(content::kChromeDevToolsScheme) && |
96 origin.host() == chrome::kChromeUIDevToolsHost) | 97 origin.host() == chrome::kChromeUIDevToolsHost) |
97 return true; | 98 return true; |
98 | 99 |
99 base::AutoLock locker(lock_); | 100 base::AutoLock locker(lock_); |
100 return unlimited_extensions_.Contains(origin) || | 101 return unlimited_extensions_.Contains(origin) || |
101 content_capabilities_unlimited_extensions_.GrantsCapabilitiesTo( | 102 content_capabilities_unlimited_extensions_.GrantsCapabilitiesTo( |
102 origin); | 103 origin); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 356 |
356 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { | 357 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { |
357 ClearCache(); | 358 ClearCache(); |
358 extensions_.Clear(); | 359 extensions_.Clear(); |
359 } | 360 } |
360 | 361 |
361 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { | 362 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { |
362 STLDeleteValues(&cached_results_); | 363 STLDeleteValues(&cached_results_); |
363 cached_results_.clear(); | 364 cached_results_.clear(); |
364 } | 365 } |
OLD | NEW |