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

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

Issue 141063009: Separate access token caching logic from signaling connector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer comments Created 6 years, 10 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 // This file implements a standalone host process for Me2Me. 5 // This file implements a standalone host process for Me2Me.
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 std::string host_owner_; 267 std::string host_owner_;
268 bool use_service_account_; 268 bool use_service_account_;
269 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; 269 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_;
270 bool allow_nat_traversal_; 270 bool allow_nat_traversal_;
271 std::string talkgadget_prefix_; 271 std::string talkgadget_prefix_;
272 bool allow_pairing_; 272 bool allow_pairing_;
273 273
274 bool curtain_required_; 274 bool curtain_required_;
275 ThirdPartyAuthConfig third_party_auth_config_; 275 ThirdPartyAuthConfig third_party_auth_config_;
276 276
277 scoped_ptr<OAuthTokenGetter> oauth_token_getter_;
277 scoped_ptr<XmppSignalStrategy> signal_strategy_; 278 scoped_ptr<XmppSignalStrategy> signal_strategy_;
278 scoped_ptr<SignalingConnector> signaling_connector_; 279 scoped_ptr<SignalingConnector> signaling_connector_;
279 scoped_ptr<HeartbeatSender> heartbeat_sender_; 280 scoped_ptr<HeartbeatSender> heartbeat_sender_;
280 scoped_ptr<HostStatusSender> host_status_sender_; 281 scoped_ptr<HostStatusSender> host_status_sender_;
281 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; 282 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_;
282 scoped_ptr<LogToServer> log_to_server_; 283 scoped_ptr<LogToServer> log_to_server_;
283 scoped_ptr<HostEventLogger> host_event_logger_; 284 scoped_ptr<HostEventLogger> host_event_logger_;
284 285
285 scoped_ptr<ChromotingHost> host_; 286 scoped_ptr<ChromotingHost> host_;
286 287
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 981
981 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker( 982 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker(
982 new DnsBlackholeChecker(context_->url_request_context_getter(), 983 new DnsBlackholeChecker(context_->url_request_context_getter(),
983 talkgadget_prefix_)); 984 talkgadget_prefix_));
984 985
985 // Create a NetworkChangeNotifier for use by the signaling connector. 986 // Create a NetworkChangeNotifier for use by the signaling connector.
986 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 987 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
987 988
988 signaling_connector_.reset(new SignalingConnector( 989 signaling_connector_.reset(new SignalingConnector(
989 signal_strategy_.get(), 990 signal_strategy_.get(),
990 context_->url_request_context_getter(),
991 dns_blackhole_checker.Pass(), 991 dns_blackhole_checker.Pass(),
992 base::Bind(&HostProcess::OnAuthFailed, this))); 992 base::Bind(&HostProcess::OnAuthFailed, this)));
993 993
994 if (!oauth_refresh_token_.empty()) { 994 if (!oauth_refresh_token_.empty()) {
995 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( 995 scoped_ptr<OAuthTokenGetter::OAuthCredentials> oauth_credentials;
996 new SignalingConnector::OAuthCredentials( 996 oauth_credentials.reset(
997 new OAuthTokenGetter::OAuthCredentials(
997 xmpp_server_config_.username, oauth_refresh_token_, 998 xmpp_server_config_.username, oauth_refresh_token_,
998 use_service_account_)); 999 use_service_account_));
999 signaling_connector_->EnableOAuth(oauth_credentials.Pass()); 1000
1001 oauth_token_getter_.reset(new OAuthTokenGetter(
1002 oauth_credentials.Pass(), context_->url_request_context_getter()));
1003
1004 signaling_connector_->EnableOAuth(oauth_token_getter_.get());
1000 } 1005 }
1001 1006
1002 NetworkSettings network_settings( 1007 NetworkSettings network_settings(
1003 allow_nat_traversal_ ? 1008 allow_nat_traversal_ ?
1004 NetworkSettings::NAT_TRAVERSAL_ENABLED : 1009 NetworkSettings::NAT_TRAVERSAL_ENABLED :
1005 NetworkSettings::NAT_TRAVERSAL_DISABLED); 1010 NetworkSettings::NAT_TRAVERSAL_DISABLED);
1006 if (!allow_nat_traversal_) { 1011 if (!allow_nat_traversal_) {
1007 network_settings.min_port = NetworkSettings::kDefaultMinPort; 1012 network_settings.min_port = NetworkSettings::kDefaultMinPort;
1008 network_settings.max_port = NetworkSettings::kDefaultMaxPort; 1013 network_settings.max_port = NetworkSettings::kDefaultMaxPort;
1009 } 1014 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 void HostProcess::ShutdownOnNetworkThread() { 1112 void HostProcess::ShutdownOnNetworkThread() {
1108 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 1113 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
1109 1114
1110 host_.reset(); 1115 host_.reset();
1111 host_event_logger_.reset(); 1116 host_event_logger_.reset();
1112 log_to_server_.reset(); 1117 log_to_server_.reset();
1113 heartbeat_sender_.reset(); 1118 heartbeat_sender_.reset();
1114 host_status_sender_.reset(); 1119 host_status_sender_.reset();
1115 host_change_notification_listener_.reset(); 1120 host_change_notification_listener_.reset();
1116 signaling_connector_.reset(); 1121 signaling_connector_.reset();
1122 oauth_token_getter_.reset();
1117 signal_strategy_.reset(); 1123 signal_strategy_.reset();
1118 network_change_notifier_.reset(); 1124 network_change_notifier_.reset();
1119 1125
1120 if (state_ == HOST_STOPPING_TO_RESTART) { 1126 if (state_ == HOST_STOPPING_TO_RESTART) {
1121 StartHost(); 1127 StartHost();
1122 } else if (state_ == HOST_STOPPING) { 1128 } else if (state_ == HOST_STOPPING) {
1123 state_ = HOST_STOPPED; 1129 state_ = HOST_STOPPED;
1124 1130
1125 if (policy_watcher_.get()) { 1131 if (policy_watcher_.get()) {
1126 base::WaitableEvent done_event(true, false); 1132 base::WaitableEvent done_event(true, false);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 return exit_code; 1195 return exit_code;
1190 } 1196 }
1191 1197
1192 } // namespace remoting 1198 } // namespace remoting
1193 1199
1194 #if !defined(OS_WIN) 1200 #if !defined(OS_WIN)
1195 int main(int argc, char** argv) { 1201 int main(int argc, char** argv) {
1196 return remoting::HostMain(argc, argv); 1202 return remoting::HostMain(argc, argv);
1197 } 1203 }
1198 #endif // !defined(OS_WIN) 1204 #endif // !defined(OS_WIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698