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_namespace.h" | 5 #include "chrome/browser/extensions/api/storage/settings_namespace.h" |
6 #include "chrome/browser/extensions/api/storage/settings_sync_processor.h" | 6 #include "chrome/browser/extensions/api/storage/settings_sync_processor.h" |
7 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" | 7 #include "chrome/browser/extensions/api/storage/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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 initialized_(false) { | 24 initialized_(false) { |
25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
26 CHECK(type == syncer::EXTENSION_SETTINGS || type == syncer::APP_SETTINGS); | 26 CHECK(type == syncer::EXTENSION_SETTINGS || type == syncer::APP_SETTINGS); |
27 CHECK(sync_processor); | 27 CHECK(sync_processor); |
28 } | 28 } |
29 | 29 |
30 SettingsSyncProcessor::~SettingsSyncProcessor() { | 30 SettingsSyncProcessor::~SettingsSyncProcessor() { |
31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
32 } | 32 } |
33 | 33 |
34 void SettingsSyncProcessor::Init(const DictionaryValue& initial_state) { | 34 void SettingsSyncProcessor::Init(const base::DictionaryValue& initial_state) { |
35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
36 CHECK(!initialized_) << "Init called multiple times"; | 36 CHECK(!initialized_) << "Init called multiple times"; |
37 | 37 |
38 for (DictionaryValue::Iterator i(initial_state); !i.IsAtEnd(); i.Advance()) | 38 for (base::DictionaryValue::Iterator i(initial_state); !i.IsAtEnd(); |
| 39 i.Advance()) |
39 synced_keys_.insert(i.key()); | 40 synced_keys_.insert(i.key()); |
40 | 41 |
41 initialized_ = true; | 42 initialized_ = true; |
42 } | 43 } |
43 | 44 |
44 syncer::SyncError SettingsSyncProcessor::SendChanges( | 45 syncer::SyncError SettingsSyncProcessor::SendChanges( |
45 const ValueStoreChangeList& changes) { | 46 const ValueStoreChangeList& changes) { |
46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
47 CHECK(initialized_) << "Init not called"; | 48 CHECK(initialized_) << "Init not called"; |
48 | 49 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 for (ValueStoreChangeList::const_iterator i = changes.begin(); | 102 for (ValueStoreChangeList::const_iterator i = changes.begin(); |
102 i != changes.end(); ++i) { | 103 i != changes.end(); ++i) { |
103 if (i->new_value()) | 104 if (i->new_value()) |
104 synced_keys_.insert(i->key()); | 105 synced_keys_.insert(i->key()); |
105 else | 106 else |
106 synced_keys_.erase(i->key()); | 107 synced_keys_.erase(i->key()); |
107 } | 108 } |
108 } | 109 } |
109 | 110 |
110 } // namespace extensions | 111 } // namespace extensions |
OLD | NEW |