OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/storage/local_value_store_cache.h" | 5 #include "extensions/browser/api/storage/local_value_store_cache.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 using content::BrowserThread; | 23 using content::BrowserThread; |
24 | 24 |
25 namespace extensions { | 25 namespace extensions { |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 // Returns the quota limit for local storage, taken from the schema in | 29 // Returns the quota limit for local storage, taken from the schema in |
30 // extensions/common/api/storage.json. | 30 // extensions/common/api/storage.json. |
31 SettingsStorageQuotaEnforcer::Limits GetLocalQuotaLimits() { | 31 SettingsStorageQuotaEnforcer::Limits GetLocalQuotaLimits() { |
32 SettingsStorageQuotaEnforcer::Limits limits = { | 32 SettingsStorageQuotaEnforcer::Limits limits = { |
33 static_cast<size_t>(core_api::storage::local::QUOTA_BYTES), | 33 static_cast<size_t>(api::storage::local::QUOTA_BYTES), |
34 std::numeric_limits<size_t>::max(), | 34 std::numeric_limits<size_t>::max(), std::numeric_limits<size_t>::max()}; |
35 std::numeric_limits<size_t>::max() | |
36 }; | |
37 return limits; | 35 return limits; |
38 } | 36 } |
39 | 37 |
40 } // namespace | 38 } // namespace |
41 | 39 |
42 LocalValueStoreCache::LocalValueStoreCache( | 40 LocalValueStoreCache::LocalValueStoreCache( |
43 const scoped_refptr<SettingsStorageFactory>& factory, | 41 const scoped_refptr<SettingsStorageFactory>& factory, |
44 const base::FilePath& profile_path) | 42 const base::FilePath& profile_path) |
45 : storage_factory_(factory), | 43 : storage_factory_(factory), |
46 extension_base_path_( | 44 extension_base_path_( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 linked_ptr<SettingsStorageQuotaEnforcer> storage( | 88 linked_ptr<SettingsStorageQuotaEnforcer> storage( |
91 new SettingsStorageQuotaEnforcer( | 89 new SettingsStorageQuotaEnforcer( |
92 quota_, storage_factory_->Create(file_path, extension->id()))); | 90 quota_, storage_factory_->Create(file_path, extension->id()))); |
93 DCHECK(storage.get()); | 91 DCHECK(storage.get()); |
94 | 92 |
95 storage_map_[extension->id()] = storage; | 93 storage_map_[extension->id()] = storage; |
96 return storage.get(); | 94 return storage.get(); |
97 } | 95 } |
98 | 96 |
99 } // namespace extensions | 97 } // namespace extensions |
OLD | NEW |