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

Side by Side Diff: chrome/browser/prefs/pref_model_associator.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/prefs/pref_model_associator.h" 5 #include "chrome/browser/prefs/pref_model_associator.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/tracked.h" 10 #include "base/tracked.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/sync/api/sync_change.h" 13 #include "chrome/browser/sync/api/sync_change.h"
14 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" 14 #include "chrome/browser/sync/protocol/preference_specifics.pb.h"
15 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "content/common/json_value_serializer.h" 17 #include "content/common/json_value_serializer.h"
17 #include "content/common/notification_service.h" 18 #include "content/common/notification_service.h"
18 19
19 using syncable::PREFERENCES; 20 using syncable::PREFERENCES;
20 21
21 PrefModelAssociator::PrefModelAssociator() 22 PrefModelAssociator::PrefModelAssociator()
22 : models_associated_(false), 23 : models_associated_(false),
23 processing_syncer_changes_(false), 24 processing_syncer_changes_(false),
24 pref_service_(NULL), 25 pref_service_(NULL),
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 267 }
267 return result; 268 return result;
268 } 269 }
269 270
270 void PrefModelAssociator::SendUpdateNotificationsIfNecessary( 271 void PrefModelAssociator::SendUpdateNotificationsIfNecessary(
271 const std::string& pref_name) { 272 const std::string& pref_name) {
272 // The bookmark bar visibility preference requires a special 273 // The bookmark bar visibility preference requires a special
273 // notification to update the UI. 274 // notification to update the UI.
274 if (0 == pref_name.compare(prefs::kShowBookmarkBar)) { 275 if (0 == pref_name.compare(prefs::kShowBookmarkBar)) {
275 NotificationService::current()->Notify( 276 NotificationService::current()->Notify(
276 NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, 277 chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
277 Source<PrefModelAssociator>(this), 278 Source<PrefModelAssociator>(this),
278 NotificationService::NoDetails()); 279 NotificationService::NoDetails());
279 } 280 }
280 } 281 }
281 282
282 // Note: This will build a model of all preferences registered as syncable 283 // Note: This will build a model of all preferences registered as syncable
283 // with user controlled data. We do not track any information for preferences 284 // with user controlled data. We do not track any information for preferences
284 // not registered locally as syncable and do not inform the syncer of 285 // not registered locally as syncable and do not inform the syncer of
285 // non-user controlled preferences. 286 // non-user controlled preferences.
286 SyncDataList PrefModelAssociator::GetAllSyncData(syncable::ModelType type) 287 SyncDataList PrefModelAssociator::GetAllSyncData(syncable::ModelType type)
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // We are already syncing this preference, just update it's sync node. 427 // We are already syncing this preference, just update it's sync node.
427 SyncData sync_data; 428 SyncData sync_data;
428 if (!CreatePrefSyncData(name, *preference->GetValue(), &sync_data)) { 429 if (!CreatePrefSyncData(name, *preference->GetValue(), &sync_data)) {
429 LOG(ERROR) << "Failed to update preference."; 430 LOG(ERROR) << "Failed to update preference.";
430 return; 431 return;
431 } 432 }
432 changes.push_back(SyncChange(SyncChange::ACTION_UPDATE, sync_data)); 433 changes.push_back(SyncChange(SyncChange::ACTION_UPDATE, sync_data));
433 } 434 }
434 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); 435 sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
435 } 436 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_member_unittest.cc ('k') | chrome/browser/prefs/pref_notifier_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698