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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 content::StoragePartition* partition = | 62 content::StoragePartition* partition = |
63 browser_context ? // |browser_context| can be NULL in unittests. | 63 browser_context ? // |browser_context| can be NULL in unittests. |
64 content::BrowserContext::GetStoragePartitionForSite(browser_context, | 64 content::BrowserContext::GetStoragePartitionForSite(browser_context, |
65 launch_url) : | 65 launch_url) : |
66 NULL; | 66 NULL; |
67 if (partition) { | 67 if (partition) { |
68 // We only have to query for kStorageTypePersistent data usage, because apps | 68 // We only have to query for kStorageTypePersistent data usage, because apps |
69 // cannot ask for any more temporary storage, according to | 69 // cannot ask for any more temporary storage, according to |
70 // https://developers.google.com/chrome/whitepapers/storage. | 70 // https://developers.google.com/chrome/whitepapers/storage. |
71 BrowserThread::PostAfterStartupTask( | 71 BrowserThread::PostAfterStartupTask( |
72 FROM_HERE, | 72 FROM_HERE, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
73 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | |
74 base::Bind(&storage::QuotaManager::GetUsageAndQuotaForWebApps, | 73 base::Bind(&storage::QuotaManager::GetUsageAndQuotaForWebApps, |
75 partition->GetQuotaManager(), | 74 partition->GetQuotaManager(), launch_url, |
76 launch_url, | |
77 storage::kStorageTypePersistent, | 75 storage::kStorageTypePersistent, |
78 base::Bind(&ReportQuotaUsage))); | 76 base::Bind(&ReportQuotaUsage))); |
79 } | 77 } |
80 } | 78 } |
81 | 79 |
82 } // namespace | 80 } // namespace |
83 | 81 |
84 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy( | 82 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy( |
85 content_settings::CookieSettings* cookie_settings) | 83 content_settings::CookieSettings* cookie_settings) |
86 : cookie_settings_(cookie_settings) { | 84 : cookie_settings_(cookie_settings) { |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 358 } |
361 | 359 |
362 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { | 360 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { |
363 ClearCache(); | 361 ClearCache(); |
364 extensions_.Clear(); | 362 extensions_.Clear(); |
365 } | 363 } |
366 | 364 |
367 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { | 365 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { |
368 STLDeleteValues(&cached_results_); | 366 STLDeleteValues(&cached_results_); |
369 } | 367 } |
OLD | NEW |