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

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

Issue 9512005: [Sync] Move BridgedSyncNotifier and ChromeSyncNotificationBridge to glue/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 8 years, 9 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/notifier/chrome_sync_notification_bridge.h" 5 #include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h"
6 6
7 #include "chrome/browser/sync/notifier/sync_notifier_observer.h" 7 #include "chrome/browser/sync/notifier/sync_notifier_observer.h"
8 #include "chrome/common/chrome_notification_types.h" 8 #include "chrome/common/chrome_notification_types.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
11 11
12 using content::BrowserThread; 12 using content::BrowserThread;
13 13
14 namespace sync_notifier { 14 namespace browser_sync {
15 15
16 ChromeSyncNotificationBridge::ChromeSyncNotificationBridge( 16 ChromeSyncNotificationBridge::ChromeSyncNotificationBridge(
17 const Profile* profile) 17 const Profile* profile)
18 : observers_(new ObserverListThreadSafe<SyncNotifierObserver>()) { 18 : observers_(
19 new ObserverListThreadSafe<sync_notifier::SyncNotifierObserver>()) {
19 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 20 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
20 DCHECK(profile); 21 DCHECK(profile);
21 registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH, 22 registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH,
22 content::Source<Profile>(profile)); 23 content::Source<Profile>(profile));
23 } 24 }
24 25
25 ChromeSyncNotificationBridge::~ChromeSyncNotificationBridge() {} 26 ChromeSyncNotificationBridge::~ChromeSyncNotificationBridge() {}
26 27
27 void ChromeSyncNotificationBridge::AddObserver(SyncNotifierObserver* observer) { 28 void ChromeSyncNotificationBridge::AddObserver(
29 sync_notifier::SyncNotifierObserver* observer) {
28 observers_->AddObserver(observer); 30 observers_->AddObserver(observer);
29 } 31 }
30 32
31 void ChromeSyncNotificationBridge::RemoveObserver( 33 void ChromeSyncNotificationBridge::RemoveObserver(
32 SyncNotifierObserver* observer) { 34 sync_notifier::SyncNotifierObserver* observer) {
33 observers_->RemoveObserver(observer); 35 observers_->RemoveObserver(observer);
34 } 36 }
35 37
36 void ChromeSyncNotificationBridge::Observe( 38 void ChromeSyncNotificationBridge::Observe(
37 int type, 39 int type,
38 const content::NotificationSource& source, 40 const content::NotificationSource& source,
39 const content::NotificationDetails& details) { 41 const content::NotificationDetails& details) {
40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
41 DCHECK_EQ(type, chrome::NOTIFICATION_SYNC_REFRESH); 43 DCHECK_EQ(type, chrome::NOTIFICATION_SYNC_REFRESH);
42 content::Details<const syncable::ModelType> model_type_details(details); 44 content::Details<const syncable::ModelType> model_type_details(details);
43 const syncable::ModelType model_type = *(model_type_details.ptr()); 45 const syncable::ModelType model_type = *(model_type_details.ptr());
44 46
45 // Currently, we only expect SESSIONS to trigger this notification. 47 // Currently, we only expect SESSIONS to trigger this notification.
46 DCHECK_EQ(syncable::SESSIONS, model_type); 48 DCHECK_EQ(syncable::SESSIONS, model_type);
47 syncable::ModelTypePayloadMap payload_map; 49 syncable::ModelTypePayloadMap payload_map;
48 payload_map[model_type] = ""; 50 payload_map[model_type] = "";
49 observers_->Notify(&SyncNotifierObserver::OnIncomingNotification, 51 observers_->Notify(
50 payload_map, LOCAL_NOTIFICATION); 52 &sync_notifier::SyncNotifierObserver::OnIncomingNotification,
53 payload_map, sync_notifier::LOCAL_NOTIFICATION);
51 } 54 }
52 55
53 } // namespace sync_notifier 56 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698