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

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

Issue 10048003: The Chromoting service should not start automatically unless it was configured from the webapp to d… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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, which is currently 5 // This file implements a standalone host process for Me2Me, which is currently
6 // used for the Linux-only Virtual Me2Me build. 6 // used for the Linux-only Virtual Me2Me build.
7 7
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include <windows.h> 9 #include <windows.h>
10 #endif 10 #endif
(...skipping 30 matching lines...) Expand all
41 #include "remoting/host/signaling_connector.h" 41 #include "remoting/host/signaling_connector.h"
42 #include "remoting/jingle_glue/xmpp_signal_strategy.h" 42 #include "remoting/jingle_glue/xmpp_signal_strategy.h"
43 #include "remoting/protocol/me2me_host_authenticator_factory.h" 43 #include "remoting/protocol/me2me_host_authenticator_factory.h"
44 44
45 #if defined(TOOLKIT_GTK) 45 #if defined(TOOLKIT_GTK)
46 #include "ui/gfx/gtk_util.h" 46 #include "ui/gfx/gtk_util.h"
47 #endif 47 #endif
48 48
49 namespace { 49 namespace {
50 50
51 // The process exit codes.
Wez 2012/04/10 21:26:20 nit: This comment doesn't really add anything.
alexeypa (please no reviews) 2012/04/10 22:18:16 Done.
52 const int kSuccessExitCode = 0;
53 const int kInvalidHostConfigurationExitCode = 1;
54
51 // This is used for tagging system event logs. 55 // This is used for tagging system event logs.
52 const char kApplicationName[] = "chromoting"; 56 const char kApplicationName[] = "chromoting";
53 57
54 // These are used for parsing the config-file locations from the command line, 58 // These are used for parsing the config-file locations from the command line,
55 // and for defining the default locations if the switches are not present. 59 // and for defining the default locations if the switches are not present.
56 const char kAuthConfigSwitchName[] = "auth-config"; 60 const char kAuthConfigSwitchName[] = "auth-config";
57 const char kHostConfigSwitchName[] = "host-config"; 61 const char kHostConfigSwitchName[] = "host-config";
58 62
59 const FilePath::CharType kDefaultAuthConfigFile[] = 63 const FilePath::CharType kDefaultAuthConfigFile[] =
60 FILE_PATH_LITERAL("auth.json"); 64 FILE_PATH_LITERAL("auth.json");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 104 }
101 105
102 #if defined(OS_LINUX) 106 #if defined(OS_LINUX)
103 Capturer::EnableXDamage(true); 107 Capturer::EnableXDamage(true);
104 #endif 108 #endif
105 } 109 }
106 110
107 int Run() { 111 int Run() {
108 bool tokens_pending = false; 112 bool tokens_pending = false;
109 if (!LoadConfig(file_io_thread_.message_loop_proxy(), &tokens_pending)) { 113 if (!LoadConfig(file_io_thread_.message_loop_proxy(), &tokens_pending)) {
110 return 1; 114 return kInvalidHostConfigurationExitCode;
111 } 115 }
112 if (tokens_pending) { 116 if (tokens_pending) {
113 // If we have an OAuth refresh token, then XmppSignalStrategy can't 117 // If we have an OAuth refresh token, then XmppSignalStrategy can't
114 // handle it directly, so refresh it asynchronously. A task will be 118 // handle it directly, so refresh it asynchronously. A task will be
115 // posted on the message loop to start watching the NAT policy when 119 // posted on the message loop to start watching the NAT policy when
116 // the access token is available. 120 // the access token is available.
117 oauth_client_.Start(oauth_refresh_token_, this, 121 oauth_client_.Start(oauth_refresh_token_, this,
118 message_loop_.message_loop_proxy()); 122 message_loop_.message_loop_proxy());
119 } else { 123 } else {
120 StartWatchingNatPolicy(); 124 StartWatchingNatPolicy();
121 } 125 }
122 126
123 message_loop_.Run(); 127 message_loop_.Run();
124 128
125 return 0; 129 return kSuccessExitCode;
126 } 130 }
127 131
128 // Overridden from OAuthClient::Delegate 132 // Overridden from OAuthClient::Delegate
129 virtual void OnRefreshTokenResponse(const std::string& access_token, 133 virtual void OnRefreshTokenResponse(const std::string& access_token,
130 int expires) OVERRIDE { 134 int expires) OVERRIDE {
131 xmpp_auth_token_ = access_token; 135 xmpp_auth_token_ = access_token;
132 // If there's already a signal strategy object, update it ready for the 136 // If there's already a signal strategy object, update it ready for the
133 // next time it calls Connect. If not, then this is the initial token 137 // next time it calls Connect. If not, then this is the initial token
134 // exchange, so proceed to the next stage of connection. 138 // exchange, so proceed to the next stage of connection.
135 if (signal_strategy_.get()) { 139 if (signal_strategy_.get()) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 int CALLBACK WinMain(HINSTANCE instance, 380 int CALLBACK WinMain(HINSTANCE instance,
377 HINSTANCE previous_instance, 381 HINSTANCE previous_instance,
378 LPSTR command_line, 382 LPSTR command_line,
379 int show_command) { 383 int show_command) {
380 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting 384 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting
381 // the command line from GetCommandLineW(), so we can safely pass NULL here. 385 // the command line from GetCommandLineW(), so we can safely pass NULL here.
382 return main(0, NULL); 386 return main(0, NULL);
383 } 387 }
384 388
385 #endif 389 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698