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

Side by Side Diff: sync/notifier/invalidation_notifier.cc

Issue 10398051: [Sync] Replace TalkMediator*/MediatorThread* with PushClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments, fix test Created 8 years, 7 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
« no previous file with comments | « sync/notifier/invalidation_notifier.h ('k') | sync/notifier/p2p_notifier.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "sync/notifier/invalidation_notifier.h" 5 #include "sync/notifier/invalidation_notifier.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "jingle/notifier/base/const_communicator.h" 9 #include "jingle/notifier/base/const_communicator.h"
10 #include "jingle/notifier/base/notifier_options_util.h" 10 #include "jingle/notifier/base/notifier_options_util.h"
11 #include "net/url_request/url_request_context.h" 11 #include "net/url_request/url_request_context.h"
12 #include "sync/notifier/sync_notifier_observer.h" 12 #include "sync/notifier/sync_notifier_observer.h"
13 #include "sync/protocol/service_constants.h"
14 #include "sync/syncable/model_type_payload_map.h" 13 #include "sync/syncable/model_type_payload_map.h"
15 #include "talk/xmpp/jid.h" 14 #include "talk/xmpp/jid.h"
16 #include "talk/xmpp/xmppclientsettings.h" 15 #include "talk/xmpp/xmppclientsettings.h"
17 16
18 namespace sync_notifier { 17 namespace sync_notifier {
19 18
20 InvalidationNotifier::InvalidationNotifier( 19 InvalidationNotifier::InvalidationNotifier(
21 const notifier::NotifierOptions& notifier_options, 20 const notifier::NotifierOptions& notifier_options,
22 const InvalidationVersionMap& initial_max_invalidation_versions, 21 const InvalidationVersionMap& initial_max_invalidation_versions,
23 const browser_sync::WeakHandle<InvalidationVersionTracker>& 22 const browser_sync::WeakHandle<InvalidationVersionTracker>&
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 invalidation_state_ = state; 61 invalidation_state_ = state;
63 DVLOG(1) << "Setting new state"; 62 DVLOG(1) << "Setting new state";
64 } 63 }
65 64
66 void InvalidationNotifier::UpdateCredentials( 65 void InvalidationNotifier::UpdateCredentials(
67 const std::string& email, const std::string& token) { 66 const std::string& email, const std::string& token) {
68 DCHECK(non_thread_safe_.CalledOnValidThread()); 67 DCHECK(non_thread_safe_.CalledOnValidThread());
69 CHECK(!invalidation_client_id_.empty()); 68 CHECK(!invalidation_client_id_.empty());
70 DVLOG(1) << "Updating credentials for " << email; 69 DVLOG(1) << "Updating credentials for " << email;
71 buzz::XmppClientSettings xmpp_client_settings = 70 buzz::XmppClientSettings xmpp_client_settings =
72 notifier::MakeXmppClientSettings(notifier_options_, 71 notifier::MakeXmppClientSettings(notifier_options_, email, token);
73 email, token, SYNC_SERVICE_NAME);
74 if (state_ >= CONNECTING) { 72 if (state_ >= CONNECTING) {
75 login_->UpdateXmppSettings(xmpp_client_settings); 73 login_->UpdateXmppSettings(xmpp_client_settings);
76 } else { 74 } else {
77 DVLOG(1) << "First time updating credentials: connecting"; 75 DVLOG(1) << "First time updating credentials: connecting";
78 login_.reset( 76 login_.reset(
79 new notifier::Login(this, 77 new notifier::Login(this,
80 xmpp_client_settings, 78 xmpp_client_settings,
81 notifier_options_.request_context_getter, 79 notifier_options_.request_context_getter,
82 notifier::GetServerList(notifier_options_), 80 notifier::GetServerList(notifier_options_),
83 notifier_options_.try_ssltcp_first, 81 notifier_options_.try_ssltcp_first,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 OnNotificationStateChange(has_session)); 136 OnNotificationStateChange(has_session));
139 } 137 }
140 138
141 void InvalidationNotifier::WriteState(const std::string& state) { 139 void InvalidationNotifier::WriteState(const std::string& state) {
142 DCHECK(non_thread_safe_.CalledOnValidThread()); 140 DCHECK(non_thread_safe_.CalledOnValidThread());
143 DVLOG(1) << "WriteState"; 141 DVLOG(1) << "WriteState";
144 FOR_EACH_OBSERVER(SyncNotifierObserver, observers_, StoreState(state)); 142 FOR_EACH_OBSERVER(SyncNotifierObserver, observers_, StoreState(state));
145 } 143 }
146 144
147 } // namespace sync_notifier 145 } // namespace sync_notifier
OLDNEW
« no previous file with comments | « sync/notifier/invalidation_notifier.h ('k') | sync/notifier/p2p_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698