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

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

Issue 10824161: [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work around brittle unit test Created 8 years, 4 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/bridged_sync_notifier.h" 5 #include "chrome/browser/sync/glue/bridged_sync_notifier.h"
6 6
7 #include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h" 7 #include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h"
8 8
9 namespace browser_sync { 9 namespace browser_sync {
10 10
11 BridgedSyncNotifier::BridgedSyncNotifier( 11 BridgedSyncNotifier::BridgedSyncNotifier(
12 ChromeSyncNotificationBridge* bridge, 12 ChromeSyncNotificationBridge* bridge,
13 syncer::SyncNotifier* delegate) 13 syncer::SyncNotifier* delegate)
14 : bridge_(bridge), delegate_(delegate) { 14 : bridge_(bridge), delegate_(delegate) {
15 DCHECK(bridge_); 15 DCHECK(bridge_);
16 } 16 }
17 17
18 BridgedSyncNotifier::~BridgedSyncNotifier() { 18 BridgedSyncNotifier::~BridgedSyncNotifier() {
19 } 19 }
20 20
21 void BridgedSyncNotifier::RegisterHandler(
22 syncer::SyncNotifierObserver* handler) {
23 if (delegate_.get())
24 delegate_->RegisterHandler(handler);
25 bridge_->RegisterHandler(handler);
26 }
27
21 void BridgedSyncNotifier::UpdateRegisteredIds( 28 void BridgedSyncNotifier::UpdateRegisteredIds(
22 syncer::SyncNotifierObserver* handler, 29 syncer::SyncNotifierObserver* handler,
23 const syncer::ObjectIdSet& ids) { 30 const syncer::ObjectIdSet& ids) {
24 if (delegate_.get()) 31 if (delegate_.get())
25 delegate_->UpdateRegisteredIds(handler, ids); 32 delegate_->UpdateRegisteredIds(handler, ids);
26 bridge_->UpdateRegisteredIds(handler, ids); 33 bridge_->UpdateRegisteredIds(handler, ids);
27 } 34 }
28 35
36 void BridgedSyncNotifier::UnregisterHandler(
37 syncer::SyncNotifierObserver* handler) {
38 if (delegate_.get())
39 delegate_->UnregisterHandler(handler);
40 bridge_->UnregisterHandler(handler);
41 }
42
29 void BridgedSyncNotifier::SetUniqueId(const std::string& unique_id) { 43 void BridgedSyncNotifier::SetUniqueId(const std::string& unique_id) {
30 if (delegate_.get()) 44 if (delegate_.get())
31 delegate_->SetUniqueId(unique_id); 45 delegate_->SetUniqueId(unique_id);
32 } 46 }
33 47
34 void BridgedSyncNotifier::SetStateDeprecated(const std::string& state) { 48 void BridgedSyncNotifier::SetStateDeprecated(const std::string& state) {
35 if (delegate_.get()) 49 if (delegate_.get())
36 delegate_->SetStateDeprecated(state); 50 delegate_->SetStateDeprecated(state);
37 } 51 }
38 52
39 void BridgedSyncNotifier::UpdateCredentials( 53 void BridgedSyncNotifier::UpdateCredentials(
40 const std::string& email, const std::string& token) { 54 const std::string& email, const std::string& token) {
41 if (delegate_.get()) 55 if (delegate_.get())
42 delegate_->UpdateCredentials(email, token); 56 delegate_->UpdateCredentials(email, token);
43 } 57 }
44 58
45 void BridgedSyncNotifier::SendNotification( 59 void BridgedSyncNotifier::SendNotification(
46 syncer::ModelTypeSet changed_types) { 60 syncer::ModelTypeSet changed_types) {
47 if (delegate_.get()) 61 if (delegate_.get())
48 delegate_->SendNotification(changed_types); 62 delegate_->SendNotification(changed_types);
49 } 63 }
50 64
51 } // namespace browser_sync 65 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/bridged_sync_notifier.h ('k') | chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698