| 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 "chrome/browser/extensions/api/storage/sync_value_store_cache.h" | 5 #include "chrome/browser/extensions/api/storage/sync_value_store_cache.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| 11 #include "chrome/browser/extensions/api/storage/sync_storage_backend.h" | 11 #include "chrome/browser/extensions/api/storage/sync_storage_backend.h" |
| 12 #include "chrome/browser/sync/glue/sync_start_util.h" | 12 #include "chrome/browser/sync/glue/sync_start_util.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "extensions/browser/api/storage/settings_storage_quota_enforcer.h" | 14 #include "extensions/browser/api/storage/settings_storage_quota_enforcer.h" |
| 15 #include "extensions/browser/api/storage/storage_frontend.h" | 15 #include "extensions/browser/api/storage/storage_frontend.h" |
| 16 #include "extensions/common/api/storage.h" | 16 #include "extensions/common/api/storage.h" |
| 17 #include "extensions/common/constants.h" | 17 #include "extensions/common/constants.h" |
| 18 #include "extensions/common/extension.h" | 18 #include "extensions/common/extension.h" |
| 19 | 19 |
| 20 using content::BrowserThread; | 20 using content::BrowserThread; |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 // Returns the quota limit for sync storage, taken from the schema in | 26 // Returns the quota limit for sync storage, taken from the schema in |
| 27 // extensions/common/api/storage.json. | 27 // extensions/common/api/storage.json. |
| 28 SettingsStorageQuotaEnforcer::Limits GetSyncQuotaLimits() { | 28 SettingsStorageQuotaEnforcer::Limits GetSyncQuotaLimits() { |
| 29 SettingsStorageQuotaEnforcer::Limits limits = { | 29 SettingsStorageQuotaEnforcer::Limits limits = { |
| 30 static_cast<size_t>(core_api::storage::sync::QUOTA_BYTES), | 30 static_cast<size_t>(api::storage::sync::QUOTA_BYTES), |
| 31 static_cast<size_t>(core_api::storage::sync::QUOTA_BYTES_PER_ITEM), | 31 static_cast<size_t>(api::storage::sync::QUOTA_BYTES_PER_ITEM), |
| 32 static_cast<size_t>(core_api::storage::sync::MAX_ITEMS) | 32 static_cast<size_t>(api::storage::sync::MAX_ITEMS)}; |
| 33 }; | |
| 34 return limits; | 33 return limits; |
| 35 } | 34 } |
| 36 | 35 |
| 37 } // namespace | 36 } // namespace |
| 38 | 37 |
| 39 SyncValueStoreCache::SyncValueStoreCache( | 38 SyncValueStoreCache::SyncValueStoreCache( |
| 40 const scoped_refptr<SettingsStorageFactory>& factory, | 39 const scoped_refptr<SettingsStorageFactory>& factory, |
| 41 const scoped_refptr<SettingsObserverList>& observers, | 40 const scoped_refptr<SettingsObserverList>& observers, |
| 42 const base::FilePath& profile_path) | 41 const base::FilePath& profile_path) |
| 43 : initialized_(false) { | 42 : initialized_(false) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 factory, | 105 factory, |
| 107 profile_path.AppendASCII(kSyncExtensionSettingsDirectoryName), | 106 profile_path.AppendASCII(kSyncExtensionSettingsDirectoryName), |
| 108 GetSyncQuotaLimits(), | 107 GetSyncQuotaLimits(), |
| 109 observers, | 108 observers, |
| 110 syncer::EXTENSION_SETTINGS, | 109 syncer::EXTENSION_SETTINGS, |
| 111 sync_start_util::GetFlareForSyncableService(profile_path))); | 110 sync_start_util::GetFlareForSyncableService(profile_path))); |
| 112 initialized_ = true; | 111 initialized_ = true; |
| 113 } | 112 } |
| 114 | 113 |
| 115 } // namespace extensions | 114 } // namespace extensions |
| OLD | NEW |