| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_model_associator.h" | 5 #include "chrome/browser/sync/glue/preference_model_associator.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 ProfileSyncService* sync_service) | 25 ProfileSyncService* sync_service) |
| 26 : sync_service_(sync_service), | 26 : sync_service_(sync_service), |
| 27 preferences_node_id_(sync_api::kInvalidId) { | 27 preferences_node_id_(sync_api::kInvalidId) { |
| 28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 29 DCHECK(sync_service_); | 29 DCHECK(sync_service_); |
| 30 | 30 |
| 31 // Add the list of kSynchronizedPreferences to our local | 31 // Add the list of kSynchronizedPreferences to our local |
| 32 // synced_preferences set, taking care to filter out any preferences | 32 // synced_preferences set, taking care to filter out any preferences |
| 33 // that are not registered. | 33 // that are not registered. |
| 34 PrefService* pref_service = sync_service_->profile()->GetPrefs(); | 34 PrefService* pref_service = sync_service_->profile()->GetPrefs(); |
| 35 for (size_t i = 0; | 35 for (size_t i = 0; i < arraysize(kSynchronizedPreferences); ++i) { |
| 36 i < static_cast<size_t>(arraysize(kSynchronizedPreferences)); ++i) { | |
| 37 if (pref_service->FindPreference(kSynchronizedPreferences[i])) | 36 if (pref_service->FindPreference(kSynchronizedPreferences[i])) |
| 38 synced_preferences_.insert(kSynchronizedPreferences[i]); | 37 synced_preferences_.insert(kSynchronizedPreferences[i]); |
| 39 } | 38 } |
| 40 } | 39 } |
| 41 | 40 |
| 42 PreferenceModelAssociator::~PreferenceModelAssociator() { | 41 PreferenceModelAssociator::~PreferenceModelAssociator() { |
| 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 44 } | 43 } |
| 45 | 44 |
| 46 bool PreferenceModelAssociator::InitPrefNodeAndAssociate( | 45 bool PreferenceModelAssociator::InitPrefNodeAndAssociate( |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // notification to update the UI. | 313 // notification to update the UI. |
| 315 if (0 == pref_name.compare(prefs::kShowBookmarkBar)) { | 314 if (0 == pref_name.compare(prefs::kShowBookmarkBar)) { |
| 316 NotificationService::current()->Notify( | 315 NotificationService::current()->Notify( |
| 317 NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, | 316 NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, |
| 318 Source<PreferenceModelAssociator>(this), | 317 Source<PreferenceModelAssociator>(this), |
| 319 NotificationService::NoDetails()); | 318 NotificationService::NoDetails()); |
| 320 } | 319 } |
| 321 } | 320 } |
| 322 | 321 |
| 323 } // namespace browser_sync | 322 } // namespace browser_sync |
| OLD | NEW |