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

Side by Side Diff: remoting/host/signaling_connector.cc

Issue 10116040: Remoting daemon process to support unofficial client ID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed compile error Created 8 years, 8 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 | « remoting/host/signaling_connector.h ('k') | remoting/webapp/build-webapp.py » ('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 "remoting/host/signaling_connector.h" 5 #include "remoting/host/signaling_connector.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "remoting/host/chromoting_host_context.h" 9 #include "remoting/host/chromoting_host_context.h"
10 #include "remoting/host/url_request_context.h" 10 #include "remoting/host/url_request_context.h"
11 11
12 namespace remoting { 12 namespace remoting {
13 13
14 namespace { 14 namespace {
15 15
16 // The delay between reconnect attempts will increase exponentially up 16 // The delay between reconnect attempts will increase exponentially up
17 // to the maximum specified here. 17 // to the maximum specified here.
18 const int kMaxReconnectDelaySeconds = 10 * 60; 18 const int kMaxReconnectDelaySeconds = 10 * 60;
19 19
20 // Time when we we try to update OAuth token before its expiration. 20 // Time when we we try to update OAuth token before its expiration.
21 const int kTokenUpdateTimeBeforeExpirySeconds = 60; 21 const int kTokenUpdateTimeBeforeExpirySeconds = 60;
22 22
23 } // namespace 23 } // namespace
24 24
25 SignalingConnector::OAuthCredentials::OAuthCredentials( 25 SignalingConnector::OAuthCredentials::OAuthCredentials(
26 const std::string& login_value, 26 const std::string& login_value,
27 const std::string& refresh_token_value) 27 const std::string& refresh_token_value,
28 const OAuthClientInfo& client_info_value)
28 : login(login_value), 29 : login(login_value),
29 refresh_token(refresh_token_value) { 30 refresh_token(refresh_token_value),
31 client_info(client_info_value) {
30 } 32 }
31 33
32 SignalingConnector::SignalingConnector(XmppSignalStrategy* signal_strategy) 34 SignalingConnector::SignalingConnector(XmppSignalStrategy* signal_strategy)
33 : signal_strategy_(signal_strategy), 35 : signal_strategy_(signal_strategy),
34 reconnect_attempts_(0), 36 reconnect_attempts_(0),
35 refreshing_oauth_token_(false) { 37 refreshing_oauth_token_(false) {
36 net::NetworkChangeNotifier::AddOnlineStateObserver(this); 38 net::NetworkChangeNotifier::AddOnlineStateObserver(this);
37 net::NetworkChangeNotifier::AddIPAddressObserver(this); 39 net::NetworkChangeNotifier::AddIPAddressObserver(this);
38 signal_strategy_->AddListener(this); 40 signal_strategy_->AddListener(this);
39 ScheduleTryReconnect(); 41 ScheduleTryReconnect();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 LOG(INFO) << "Attempting to connect signaling."; 148 LOG(INFO) << "Attempting to connect signaling.";
147 signal_strategy_->Connect(); 149 signal_strategy_->Connect();
148 } 150 }
149 } 151 }
150 } 152 }
151 153
152 void SignalingConnector::RefreshOAuthToken() { 154 void SignalingConnector::RefreshOAuthToken() {
153 DCHECK(CalledOnValidThread()); 155 DCHECK(CalledOnValidThread());
154 LOG(INFO) << "Refreshing OAuth token."; 156 LOG(INFO) << "Refreshing OAuth token.";
155 DCHECK(!refreshing_oauth_token_); 157 DCHECK(!refreshing_oauth_token_);
156 #ifdef OFFICIAL_BUILD 158
157 OAuthClientInfo client_info = {
158 "440925447803-avn2sj1kc099s0r7v62je5s339mu0am1.apps.googleusercontent.com",
159 "Bgur6DFiOMM1h8x-AQpuTQlK"
160 };
161 #else // OFFICIAL_BUILD
162 OAuthClientInfo client_info = {
163 "440925447803-2pi3v45bff6tp1rde2f7q6lgbor3o5uj.apps.googleusercontent.com",
164 "W2ieEsG-R1gIA4MMurGrgMc_"
165 };
166 #endif // !OFFICIAL_BUILD
167 refreshing_oauth_token_ = true; 159 refreshing_oauth_token_ = true;
168 gaia_oauth_client_->RefreshToken( 160 gaia_oauth_client_->RefreshToken(
169 client_info, oauth_credentials_->refresh_token, this); 161 oauth_credentials_->client_info,
162 oauth_credentials_->refresh_token, this);
170 } 163 }
171 164
172 } // namespace remoting 165 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/signaling_connector.h ('k') | remoting/webapp/build-webapp.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698