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/settings/settings_backend.h" | 5 #include "chrome/browser/extensions/settings/settings_backend.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 if (maybe_storage != storage_objs_.end()) { | 56 if (maybe_storage != storage_objs_.end()) { |
57 return maybe_storage->second.get(); | 57 return maybe_storage->second.get(); |
58 } | 58 } |
59 | 59 |
60 ValueStore* storage = storage_factory_->Create(base_path_, extension_id); | 60 ValueStore* storage = storage_factory_->Create(base_path_, extension_id); |
61 if (storage) { | 61 if (storage) { |
62 // It's fine to create the quota enforcer underneath the sync layer, since | 62 // It's fine to create the quota enforcer underneath the sync layer, since |
63 // sync will only go ahead if each underlying storage operation succeeds. | 63 // sync will only go ahead if each underlying storage operation succeeds. |
64 storage = new SettingsStorageQuotaEnforcer(quota_, storage); | 64 storage = new SettingsStorageQuotaEnforcer(quota_, storage); |
65 } else { | 65 } else { |
66 storage = new FailingSettingsStorage(); | 66 storage = new FailingValueStore(); |
67 } | 67 } |
68 | 68 |
69 linked_ptr<SyncableSettingsStorage> syncable_storage( | 69 linked_ptr<SyncableSettingsStorage> syncable_storage( |
70 new SyncableSettingsStorage( | 70 new SyncableSettingsStorage( |
71 observers_, | 71 observers_, |
72 extension_id, | 72 extension_id, |
73 storage)); | 73 storage)); |
74 storage_objs_[extension_id] = syncable_storage; | 74 storage_objs_[extension_id] = syncable_storage; |
75 | 75 |
76 if (sync_processor_.get()) { | 76 if (sync_processor_.get()) { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 scoped_ptr<SettingsSyncProcessor> SettingsBackend::CreateSettingsSyncProcessor( | 286 scoped_ptr<SettingsSyncProcessor> SettingsBackend::CreateSettingsSyncProcessor( |
287 const std::string& extension_id) const { | 287 const std::string& extension_id) const { |
288 CHECK(sync_processor_.get()); | 288 CHECK(sync_processor_.get()); |
289 return scoped_ptr<SettingsSyncProcessor>( | 289 return scoped_ptr<SettingsSyncProcessor>( |
290 new SettingsSyncProcessor(extension_id, | 290 new SettingsSyncProcessor(extension_id, |
291 sync_type_, | 291 sync_type_, |
292 sync_processor_.get())); | 292 sync_processor_.get())); |
293 } | 293 } |
294 | 294 |
295 } // namespace extensions | 295 } // namespace extensions |
OLD | NEW |