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

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

Issue 10916131: [Invalidations] Add GetInvalidatorState() to Invalidator{,Frontend} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android Created 8 years, 3 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_invalidator.h" 5 #include "chrome/browser/sync/glue/bridged_invalidator.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 BridgedInvalidator::BridgedInvalidator( 11 BridgedInvalidator::BridgedInvalidator(
12 ChromeSyncNotificationBridge* bridge, 12 ChromeSyncNotificationBridge* bridge,
13 syncer::Invalidator* delegate) 13 syncer::Invalidator* delegate,
14 : bridge_(bridge), delegate_(delegate) { 14 syncer::InvalidatorState default_invalidator_state)
15 : bridge_(bridge),
16 delegate_(delegate),
17 default_invalidator_state_(default_invalidator_state) {
15 DCHECK(bridge_); 18 DCHECK(bridge_);
16 } 19 }
17 20
18 BridgedInvalidator::~BridgedInvalidator() { 21 BridgedInvalidator::~BridgedInvalidator() {
19 } 22 }
20 23
21 void BridgedInvalidator::RegisterHandler( 24 void BridgedInvalidator::RegisterHandler(
22 syncer::InvalidationHandler* handler) { 25 syncer::InvalidationHandler* handler) {
23 if (delegate_.get()) 26 if (delegate_.get())
24 delegate_->RegisterHandler(handler); 27 delegate_->RegisterHandler(handler);
25 bridge_->RegisterHandler(handler); 28 bridge_->RegisterHandler(handler);
26 } 29 }
27 30
28 void BridgedInvalidator::UpdateRegisteredIds( 31 void BridgedInvalidator::UpdateRegisteredIds(
29 syncer::InvalidationHandler* handler, 32 syncer::InvalidationHandler* handler,
30 const syncer::ObjectIdSet& ids) { 33 const syncer::ObjectIdSet& ids) {
31 if (delegate_.get()) 34 if (delegate_.get())
32 delegate_->UpdateRegisteredIds(handler, ids); 35 delegate_->UpdateRegisteredIds(handler, ids);
33 bridge_->UpdateRegisteredIds(handler, ids); 36 bridge_->UpdateRegisteredIds(handler, ids);
34 } 37 }
35 38
39 syncer::InvalidatorState BridgedInvalidator::GetInvalidatorState() const {
40 return
41 delegate_.get() ?
42 delegate_->GetInvalidatorState() :
43 default_invalidator_state_;
44 }
45
36 void BridgedInvalidator::UnregisterHandler( 46 void BridgedInvalidator::UnregisterHandler(
37 syncer::InvalidationHandler* handler) { 47 syncer::InvalidationHandler* handler) {
38 if (delegate_.get()) 48 if (delegate_.get())
39 delegate_->UnregisterHandler(handler); 49 delegate_->UnregisterHandler(handler);
40 bridge_->UnregisterHandler(handler); 50 bridge_->UnregisterHandler(handler);
41 } 51 }
42 52
43 void BridgedInvalidator::SetUniqueId(const std::string& unique_id) { 53 void BridgedInvalidator::SetUniqueId(const std::string& unique_id) {
44 if (delegate_.get()) 54 if (delegate_.get())
45 delegate_->SetUniqueId(unique_id); 55 delegate_->SetUniqueId(unique_id);
46 } 56 }
47 57
48 void BridgedInvalidator::SetStateDeprecated(const std::string& state) { 58 void BridgedInvalidator::SetStateDeprecated(const std::string& state) {
49 if (delegate_.get()) 59 if (delegate_.get())
50 delegate_->SetStateDeprecated(state); 60 delegate_->SetStateDeprecated(state);
51 } 61 }
52 62
53 void BridgedInvalidator::UpdateCredentials( 63 void BridgedInvalidator::UpdateCredentials(
54 const std::string& email, const std::string& token) { 64 const std::string& email, const std::string& token) {
55 if (delegate_.get()) 65 if (delegate_.get())
56 delegate_->UpdateCredentials(email, token); 66 delegate_->UpdateCredentials(email, token);
57 } 67 }
58 68
59 void BridgedInvalidator::SendNotification( 69 void BridgedInvalidator::SendInvalidation(
60 const syncer::ObjectIdStateMap& id_state_map) { 70 const syncer::ObjectIdStateMap& id_state_map) {
61 if (delegate_.get()) 71 if (delegate_.get())
62 delegate_->SendNotification(id_state_map); 72 delegate_->SendInvalidation(id_state_map);
63 } 73 }
64 74
65 } // namespace browser_sync 75 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/bridged_invalidator.h ('k') | chrome/browser/sync/glue/bridged_invalidator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698