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/api/storage/settings_backend.h" | 5 #include "chrome/browser/extensions/api/storage/settings_backend.h" |
6 | 6 |
7 #include "base/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/extensions/api/storage/settings_sync_processor.h" | 9 #include "chrome/browser/extensions/api/storage/settings_sync_processor.h" |
10 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" | 10 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // For all extensions, get all their settings. This has the effect | 153 // For all extensions, get all their settings. This has the effect |
154 // of bringing in the entire state of extension settings in memory; sad. | 154 // of bringing in the entire state of extension settings in memory; sad. |
155 syncer::SyncDataList all_sync_data; | 155 syncer::SyncDataList all_sync_data; |
156 std::set<std::string> known_extension_ids(GetKnownExtensionIDs()); | 156 std::set<std::string> known_extension_ids(GetKnownExtensionIDs()); |
157 | 157 |
158 for (std::set<std::string>::const_iterator it = known_extension_ids.begin(); | 158 for (std::set<std::string>::const_iterator it = known_extension_ids.begin(); |
159 it != known_extension_ids.end(); ++it) { | 159 it != known_extension_ids.end(); ++it) { |
160 ValueStore::ReadResult maybe_settings = GetStorage(*it)->Get(); | 160 ValueStore::ReadResult maybe_settings = GetStorage(*it)->Get(); |
161 if (maybe_settings->HasError()) { | 161 if (maybe_settings->HasError()) { |
162 LOG(WARNING) << "Failed to get settings for " << *it << ": " << | 162 LOG(WARNING) << "Failed to get settings for " << *it << ": " << |
163 maybe_settings->error(); | 163 maybe_settings->error().message; |
164 continue; | 164 continue; |
165 } | 165 } |
166 AddAllSyncData(*it, *maybe_settings->settings().get(), | 166 AddAllSyncData(*it, maybe_settings->settings(), type, &all_sync_data); |
167 type, &all_sync_data); | |
168 } | 167 } |
169 | 168 |
170 return all_sync_data; | 169 return all_sync_data; |
171 } | 170 } |
172 | 171 |
173 syncer::SyncMergeResult SettingsBackend::MergeDataAndStartSyncing( | 172 syncer::SyncMergeResult SettingsBackend::MergeDataAndStartSyncing( |
174 syncer::ModelType type, | 173 syncer::ModelType type, |
175 const syncer::SyncDataList& initial_sync_data, | 174 const syncer::SyncDataList& initial_sync_data, |
176 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 175 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
177 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) { | 176 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 scoped_ptr<SettingsSyncProcessor> SettingsBackend::CreateSettingsSyncProcessor( | 281 scoped_ptr<SettingsSyncProcessor> SettingsBackend::CreateSettingsSyncProcessor( |
283 const std::string& extension_id) const { | 282 const std::string& extension_id) const { |
284 CHECK(sync_processor_.get()); | 283 CHECK(sync_processor_.get()); |
285 return scoped_ptr<SettingsSyncProcessor>( | 284 return scoped_ptr<SettingsSyncProcessor>( |
286 new SettingsSyncProcessor(extension_id, | 285 new SettingsSyncProcessor(extension_id, |
287 sync_type_, | 286 sync_type_, |
288 sync_processor_.get())); | 287 sync_processor_.get())); |
289 } | 288 } |
290 | 289 |
291 } // namespace extensions | 290 } // namespace extensions |
OLD | NEW |