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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 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) 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/sync/glue/chrome_sync_notification_bridge.h" 5 #include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h"
6 6
7 #include "chrome/common/chrome_notification_types.h" 7 #include "chrome/common/chrome_notification_types.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/notification_service.h" 9 #include "content/public/browser/notification_service.h"
10 #include "sync/notifier/sync_notifier_observer.h" 10 #include "sync/notifier/sync_notifier_observer.h"
(...skipping 10 matching lines...) Expand all
21 DCHECK(profile); 21 DCHECK(profile);
22 registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH_LOCAL, 22 registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH_LOCAL,
23 content::Source<Profile>(profile)); 23 content::Source<Profile>(profile));
24 registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH_REMOTE, 24 registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH_REMOTE,
25 content::Source<Profile>(profile)); 25 content::Source<Profile>(profile));
26 } 26 }
27 27
28 ChromeSyncNotificationBridge::~ChromeSyncNotificationBridge() {} 28 ChromeSyncNotificationBridge::~ChromeSyncNotificationBridge() {}
29 29
30 void ChromeSyncNotificationBridge::UpdateEnabledTypes( 30 void ChromeSyncNotificationBridge::UpdateEnabledTypes(
31 const syncable::ModelTypeSet types) { 31 const syncer::ModelTypeSet types) {
32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
33 enabled_types_ = types; 33 enabled_types_ = types;
34 } 34 }
35 35
36 void ChromeSyncNotificationBridge::AddObserver( 36 void ChromeSyncNotificationBridge::AddObserver(
37 syncer::SyncNotifierObserver* observer) { 37 syncer::SyncNotifierObserver* observer) {
38 observers_->AddObserver(observer); 38 observers_->AddObserver(observer);
39 } 39 }
40 40
41 void ChromeSyncNotificationBridge::RemoveObserver( 41 void ChromeSyncNotificationBridge::RemoveObserver(
(...skipping 10 matching lines...) Expand all
52 syncer::IncomingNotificationSource notification_source; 52 syncer::IncomingNotificationSource notification_source;
53 if (type == chrome::NOTIFICATION_SYNC_REFRESH_LOCAL) { 53 if (type == chrome::NOTIFICATION_SYNC_REFRESH_LOCAL) {
54 notification_source = syncer::LOCAL_NOTIFICATION; 54 notification_source = syncer::LOCAL_NOTIFICATION;
55 } else if (type == chrome::NOTIFICATION_SYNC_REFRESH_REMOTE) { 55 } else if (type == chrome::NOTIFICATION_SYNC_REFRESH_REMOTE) {
56 notification_source = syncer::REMOTE_NOTIFICATION; 56 notification_source = syncer::REMOTE_NOTIFICATION;
57 } else { 57 } else {
58 NOTREACHED() << "Unexpected notification type:" << type; 58 NOTREACHED() << "Unexpected notification type:" << type;
59 return; 59 return;
60 } 60 }
61 61
62 content::Details<const syncable::ModelTypePayloadMap> 62 content::Details<const syncer::ModelTypePayloadMap>
63 payload_details(details); 63 payload_details(details);
64 syncable::ModelTypePayloadMap payload_map = *(payload_details.ptr()); 64 syncer::ModelTypePayloadMap payload_map = *(payload_details.ptr());
65 65
66 if (payload_map.empty()) { 66 if (payload_map.empty()) {
67 // No model types to invalidate, invalidating all enabled types. 67 // No model types to invalidate, invalidating all enabled types.
68 payload_map = 68 payload_map =
69 syncable::ModelTypePayloadMapFromEnumSet(enabled_types_, std::string()); 69 syncer::ModelTypePayloadMapFromEnumSet(enabled_types_, std::string());
70 } 70 }
71 71
72 observers_->Notify( 72 observers_->Notify(
73 &syncer::SyncNotifierObserver::OnIncomingNotification, 73 &syncer::SyncNotifierObserver::OnIncomingNotification,
74 payload_map, notification_source); 74 payload_map, notification_source);
75 } 75 }
76 76
77 } // namespace browser_sync 77 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698