Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: chrome/browser/sync/glue/preference_change_processor.cc

Issue 1120006: detect preferences errors (Closed)
Patch Set: changes from review Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/sync/glue/preference_change_processor.h" 5 #include "chrome/browser/sync/glue/preference_change_processor.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 Value* PreferenceChangeProcessor::ReadPreference( 155 Value* PreferenceChangeProcessor::ReadPreference(
156 sync_api::ReadNode* node, 156 sync_api::ReadNode* node,
157 std::wstring* name) { 157 std::wstring* name) {
158 const sync_pb::PreferenceSpecifics& preference( 158 const sync_pb::PreferenceSpecifics& preference(
159 node->GetPreferenceSpecifics()); 159 node->GetPreferenceSpecifics());
160 base::JSONReader reader; 160 base::JSONReader reader;
161 scoped_ptr<Value> value(reader.JsonToValue(preference.value(), false, false)); 161 scoped_ptr<Value> value(reader.JsonToValue(preference.value(), false, false));
162 if (!value.get()) { 162 if (!value.get()) {
163 LOG(ERROR) << "Failed to deserialize preference value: " 163 LOG(ERROR) << "Failed to deserialize preference value: "
164 << reader.error_message(); 164 << reader.GetErrorMessage();
165 error_handler()->OnUnrecoverableError(); 165 error_handler()->OnUnrecoverableError();
166 return NULL; 166 return NULL;
167 } 167 }
168 *name = UTF8ToWide(preference.name()); 168 *name = UTF8ToWide(preference.name());
169 return value.release(); 169 return value.release();
170 } 170 }
171 171
172 void PreferenceChangeProcessor::StartImpl(Profile* profile) { 172 void PreferenceChangeProcessor::StartImpl(Profile* profile) {
173 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 173 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
174 pref_service_ = profile->GetPrefs(); 174 pref_service_ = profile->GetPrefs();
(...skipping 19 matching lines...) Expand all
194 void PreferenceChangeProcessor::StopObserving() { 194 void PreferenceChangeProcessor::StopObserving() {
195 DCHECK(pref_service_); 195 DCHECK(pref_service_);
196 for (std::set<std::wstring>::const_iterator it = 196 for (std::set<std::wstring>::const_iterator it =
197 model_associator_->synced_preferences().begin(); 197 model_associator_->synced_preferences().begin();
198 it != model_associator_->synced_preferences().end(); ++it) { 198 it != model_associator_->synced_preferences().end(); ++it) {
199 pref_service_->RemovePrefObserver((*it).c_str(), this); 199 pref_service_->RemovePrefObserver((*it).c_str(), this);
200 } 200 }
201 } 201 }
202 202
203 } // namespace browser_sync 203 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/pref_service_uitest.cc ('k') | chrome/browser/sync/glue/preference_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698