| 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_namespace.h" | 5 #include "chrome/browser/extensions/settings/settings_namespace.h" |
| 6 #include "chrome/browser/extensions/settings/settings_sync_processor.h" | 6 #include "chrome/browser/extensions/settings/settings_sync_processor.h" |
| 7 #include "chrome/browser/extensions/settings/settings_sync_util.h" | 7 #include "chrome/browser/extensions/settings/settings_sync_util.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "sync/api/sync_change_processor.h" | 9 #include "sync/api/sync_change_processor.h" |
| 10 #include "sync/api/sync_data.h" | 10 #include "sync/api/sync_data.h" |
| 11 #include "sync/protocol/extension_setting_specifics.pb.h" | 11 #include "sync/protocol/extension_setting_specifics.pb.h" |
| 12 | 12 |
| 13 using content::BrowserThread; | 13 using content::BrowserThread; |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 SettingsSyncProcessor::SettingsSyncProcessor( | 17 SettingsSyncProcessor::SettingsSyncProcessor( |
| 18 const std::string& extension_id, | 18 const std::string& extension_id, |
| 19 syncable::ModelType type, | 19 syncer::ModelType type, |
| 20 syncer::SyncChangeProcessor* sync_processor) | 20 syncer::SyncChangeProcessor* sync_processor) |
| 21 : extension_id_(extension_id), | 21 : extension_id_(extension_id), |
| 22 type_(type), | 22 type_(type), |
| 23 sync_processor_(sync_processor), | 23 sync_processor_(sync_processor), |
| 24 initialized_(false) { | 24 initialized_(false) { |
| 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 26 CHECK(type == syncable::EXTENSION_SETTINGS || | 26 CHECK(type == syncer::EXTENSION_SETTINGS || type == syncer::APP_SETTINGS); |
| 27 type == syncable::APP_SETTINGS); | |
| 28 CHECK(sync_processor); | 27 CHECK(sync_processor); |
| 29 } | 28 } |
| 30 | 29 |
| 31 SettingsSyncProcessor::~SettingsSyncProcessor() { | 30 SettingsSyncProcessor::~SettingsSyncProcessor() { |
| 32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 33 } | 32 } |
| 34 | 33 |
| 35 void SettingsSyncProcessor::Init(const DictionaryValue& initial_state) { | 34 void SettingsSyncProcessor::Init(const DictionaryValue& initial_state) { |
| 36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 37 CHECK(!initialized_) << "Init called multiple times"; | 36 CHECK(!initialized_) << "Init called multiple times"; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 for (ValueStoreChangeList::const_iterator i = changes.begin(); | 101 for (ValueStoreChangeList::const_iterator i = changes.begin(); |
| 103 i != changes.end(); ++i) { | 102 i != changes.end(); ++i) { |
| 104 if (i->new_value()) | 103 if (i->new_value()) |
| 105 synced_keys_.insert(i->key()); | 104 synced_keys_.insert(i->key()); |
| 106 else | 105 else |
| 107 synced_keys_.erase(i->key()); | 106 synced_keys_.erase(i->key()); |
| 108 } | 107 } |
| 109 } | 108 } |
| 110 | 109 |
| 111 } // namespace extensions | 110 } // namespace extensions |
| OLD | NEW |