OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 is an application of a minimal host process in a Chromoting | 5 // This is an application of a minimal host process in a Chromoting |
6 // system. It serves the purpose of gluing different pieces together | 6 // system. It serves the purpose of gluing different pieces together |
7 // to make a functional host process for testing. | 7 // to make a functional host process for testing. |
8 // | 8 // |
9 // It peforms the following functionality: | 9 // It peforms the following functionality: |
10 // 1. Connect to the GTalk network and register the machine as a host. | 10 // 1. Connect to the GTalk network and register the machine as a host. |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "base/command_line.h" | 25 #include "base/command_line.h" |
26 #include "base/environment.h" | 26 #include "base/environment.h" |
27 #include "base/file_path.h" | 27 #include "base/file_path.h" |
28 #include "base/logging.h" | 28 #include "base/logging.h" |
29 #include "base/mac/scoped_nsautorelease_pool.h" | 29 #include "base/mac/scoped_nsautorelease_pool.h" |
30 #include "base/path_service.h" | 30 #include "base/path_service.h" |
31 #include "base/test/mock_chrome_application_mac.h" | 31 #include "base/test/mock_chrome_application_mac.h" |
32 #include "base/threading/thread.h" | 32 #include "base/threading/thread.h" |
33 #include "crypto/nss_util.h" | 33 #include "crypto/nss_util.h" |
34 #include "media/base/media.h" | 34 #include "media/base/media.h" |
| 35 #include "remoting/base/constants.h" |
35 #include "remoting/base/tracer.h" | 36 #include "remoting/base/tracer.h" |
36 #include "remoting/host/capturer_fake.h" | 37 #include "remoting/host/capturer_fake.h" |
37 #include "remoting/host/chromoting_host.h" | 38 #include "remoting/host/chromoting_host.h" |
38 #include "remoting/host/chromoting_host_context.h" | 39 #include "remoting/host/chromoting_host_context.h" |
39 #include "remoting/host/curtain.h" | 40 #include "remoting/host/curtain.h" |
40 #include "remoting/host/desktop_environment.h" | 41 #include "remoting/host/desktop_environment.h" |
41 #include "remoting/host/event_executor.h" | 42 #include "remoting/host/event_executor.h" |
42 #include "remoting/host/heartbeat_sender.h" | 43 #include "remoting/host/heartbeat_sender.h" |
43 #include "remoting/host/json_host_config.h" | 44 #include "remoting/host/json_host_config.h" |
44 #include "remoting/host/register_support_host_request.h" | 45 #include "remoting/host/register_support_host_request.h" |
45 #include "remoting/host/self_access_verifier.h" | 46 #include "remoting/host/self_access_verifier.h" |
46 #include "remoting/host/support_access_verifier.h" | 47 #include "remoting/host/support_access_verifier.h" |
47 #include "remoting/proto/video.pb.h" | 48 #include "remoting/proto/video.pb.h" |
48 | 49 |
49 #if defined(TOOLKIT_USES_GTK) | 50 #if defined(TOOLKIT_USES_GTK) |
50 #include "ui/gfx/gtk_util.h" | 51 #include "ui/gfx/gtk_util.h" |
51 #endif | 52 #endif |
52 | 53 |
53 using remoting::ChromotingHost; | 54 using remoting::ChromotingHost; |
54 using remoting::DesktopEnvironment; | 55 using remoting::DesktopEnvironment; |
| 56 using remoting::kChromotingTokenDefaultServiceName; |
| 57 using remoting::kXmppAuthServiceConfigPath; |
55 using remoting::protocol::CandidateSessionConfig; | 58 using remoting::protocol::CandidateSessionConfig; |
56 using remoting::protocol::ChannelConfig; | 59 using remoting::protocol::ChannelConfig; |
57 using std::string; | 60 using std::string; |
58 using std::wstring; | 61 using std::wstring; |
59 | 62 |
60 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
61 const wchar_t kDefaultConfigPath[] = L".ChromotingConfig.json"; | 64 const wchar_t kDefaultConfigPath[] = L".ChromotingConfig.json"; |
62 const wchar_t kHomeDrive[] = L"HOMEDRIVE"; | 65 const wchar_t kHomeDrive[] = L"HOMEDRIVE"; |
63 const wchar_t kHomePath[] = L"HOMEPATH"; | 66 const wchar_t kHomePath[] = L"HOMEPATH"; |
64 // TODO(sergeyu): Use environment utils from base/environment.h. | 67 // TODO(sergeyu): Use environment utils from base/environment.h. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 scoped_refptr<remoting::JsonHostConfig> config = | 118 scoped_refptr<remoting::JsonHostConfig> config = |
116 new remoting::JsonHostConfig( | 119 new remoting::JsonHostConfig( |
117 config_path, file_io_thread.message_loop_proxy()); | 120 config_path, file_io_thread.message_loop_proxy()); |
118 if (!config->Read()) { | 121 if (!config->Read()) { |
119 LOG(ERROR) << "Failed to read configuration file " | 122 LOG(ERROR) << "Failed to read configuration file " |
120 << config_path.value(); | 123 << config_path.value(); |
121 context.Stop(); | 124 context.Stop(); |
122 return 1; | 125 return 1; |
123 } | 126 } |
124 | 127 |
| 128 // For the simple host, we assume we always use the ClientLogin token for |
| 129 // chromiumsync because we do not have an HTTP stack with which we can |
| 130 // easily request an OAuth2 access token even if we had a RefreshToken for |
| 131 // the account. |
| 132 config->SetString(kXmppAuthServiceConfigPath, |
| 133 kChromotingTokenDefaultServiceName); |
| 134 |
125 // Initialize AccessVerifier. | 135 // Initialize AccessVerifier. |
126 // TODO(jamiewalch): For the Me2Mom case, the access verifier is passed to | 136 // TODO(jamiewalch): For the Me2Mom case, the access verifier is passed to |
127 // RegisterSupportHostRequest::Init, so transferring ownership of it to the | 137 // RegisterSupportHostRequest::Init, so transferring ownership of it to the |
128 // ChromotingHost could cause a crash condition if SetMe2MomAccessCode is | 138 // ChromotingHost could cause a crash condition if SetMe2MomAccessCode is |
129 // called after the ChromotingHost is destroyed (for example, at shutdown). | 139 // called after the ChromotingHost is destroyed (for example, at shutdown). |
130 // Fix this. | 140 // Fix this. |
131 scoped_ptr<remoting::AccessVerifier> access_verifier; | 141 scoped_ptr<remoting::AccessVerifier> access_verifier; |
132 scoped_refptr<remoting::RegisterSupportHostRequest> register_request; | 142 scoped_refptr<remoting::RegisterSupportHostRequest> register_request; |
133 if (is_me2mom_) { | 143 if (is_me2mom_) { |
134 scoped_ptr<remoting::SupportAccessVerifier> support_access_verifier( | 144 scoped_ptr<remoting::SupportAccessVerifier> support_access_verifier( |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 LOG(ERROR) << "Unknown video codec: " << video_codec; | 286 LOG(ERROR) << "Unknown video codec: " << video_codec; |
277 return 1; | 287 return 1; |
278 } | 288 } |
279 config->mutable_video_configs()->push_back(ChannelConfig( | 289 config->mutable_video_configs()->push_back(ChannelConfig( |
280 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 290 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
281 simple_host.set_protocol_config(config.release()); | 291 simple_host.set_protocol_config(config.release()); |
282 } | 292 } |
283 | 293 |
284 return simple_host.Run(); | 294 return simple_host.Run(); |
285 } | 295 } |
OLD | NEW |