OLD | NEW |
---|---|
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/plugin/daemon_installer_win.h" | 5 #include "remoting/host/plugin/daemon_installer_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "base/stringize_macros.h" | 13 #include "base/stringize_macros.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "base/timer.h" | 16 #include "base/timer.h" |
17 #include "base/win/object_watcher.h" | 17 #include "base/win/object_watcher.h" |
18 #include "base/win/registry.h" | 18 #include "base/win/registry.h" |
19 #include "base/win/scoped_bstr.h" | 19 #include "base/win/scoped_bstr.h" |
20 #include "base/win/scoped_comptr.h" | 20 #include "base/win/scoped_comptr.h" |
21 #include "base/win/scoped_handle.h" | 21 #include "base/win/scoped_handle.h" |
22 | 22 |
23 namespace omaha { | 23 namespace omaha { |
24 #include "google_update/google_update_idl.h" | 24 #include "google_update/google_update_idl.h" |
25 } // namespace omaha | 25 } // namespace omaha |
Peter Kasting
2012/06/14 20:16:27
No other files in the project which #include this
alexeypa (please no reviews)
2012/06/15 18:45:49
Unfortunately, the state constants declared in "go
Peter Kasting
2012/06/15 19:02:42
Which other header has the conflict? Can we chang
alexeypa (please no reviews)
2012/06/15 19:51:24
It turns out there is no conflict anymore and omah
| |
26 | 26 |
27 #include "remoting/host/constants.h" | |
28 | |
27 using base::win::ScopedBstr; | 29 using base::win::ScopedBstr; |
28 using base::win::ScopedComPtr; | 30 using base::win::ScopedComPtr; |
29 | 31 |
30 namespace { | 32 namespace { |
31 | 33 |
32 // The COM elevation moniker for Omaha. | 34 // The COM elevation moniker for Omaha. |
33 const char16 kOmahaElevationMoniker[] = | 35 const char16 kOmahaElevationMoniker[] = |
Peter Kasting
2012/06/14 20:16:27
This file contains many instances of problem's I'v
alexeypa (please no reviews)
2012/06/15 18:45:49
I filed http://crbug.com/133003 for this.
| |
34 TO_L_STRING("Elevation:Administrator!new:GoogleUpdate.Update3WebMachine"); | 36 TO_L_STRING("Elevation:Administrator!new:GoogleUpdate.Update3WebMachine"); |
35 | 37 |
36 // The registry key where the configuration of Omaha is stored. | 38 // The registry key where the configuration of Omaha is stored. |
37 const char16 kOmahaUpdateKeyName[] = TO_L_STRING("Software\\Google\\Update"); | 39 const char16 kOmahaUpdateKeyName[] = TO_L_STRING("Software\\Google\\Update"); |
38 | 40 |
39 // The name of the value where the full path to GoogleUpdate.exe is stored. | 41 // The name of the value where the full path to GoogleUpdate.exe is stored. |
40 const char16 kOmahaPathValueName[] = TO_L_STRING("path"); | 42 const char16 kOmahaPathValueName[] = TO_L_STRING("path"); |
41 | 43 |
42 // The command line format string for GoogleUpdate.exe | 44 // The command line format string for GoogleUpdate.exe |
43 const char16 kGoogleUpdateCommandLineFormat[] = | 45 const char16 kGoogleUpdateCommandLineFormat[] = |
44 TO_L_STRING("\"%ls\" /install \"bundlename=Chromoting%%20Host&appguid=%ls&") | 46 TO_L_STRING("\"%ls\" /install \"bundlename=Chromoting%%20Host&appguid=%ls&") |
45 TO_L_STRING("appname=Chromoting%%20Host&needsadmin=True&lang=%ls\""); | 47 TO_L_STRING("appname=Chromoting%%20Host&needsadmin=True&lang=%ls\""); |
46 | 48 |
47 // The Omaha Appid of the host. | |
48 const char16 kOmahaAppid[] = | |
49 TO_L_STRING("{b210701e-ffc4-49e3-932b-370728c72662}"); | |
50 | |
51 // TODO(alexeypa): Get the desired laungage from the web app. | 49 // TODO(alexeypa): Get the desired laungage from the web app. |
52 const char16 kOmahaLanguage[] = TO_L_STRING("en"); | 50 const char16 kOmahaLanguage[] = TO_L_STRING("en"); |
53 | 51 |
54 // An empty string for optional parameters. | 52 // An empty string for optional parameters. |
55 const char16 kOmahaEmpty[] = TO_L_STRING(""); | 53 const char16 kOmahaEmpty[] = TO_L_STRING(""); |
56 | 54 |
57 // The installation status polling interval. | 55 // The installation status polling interval. |
58 const int kOmahaPollIntervalMs = 500; | 56 const int kOmahaPollIntervalMs = 500; |
59 | 57 |
60 } // namespace | 58 } // namespace |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 return; | 134 return; |
137 } | 135 } |
138 | 136 |
139 hr = bundle_->initialize(); | 137 hr = bundle_->initialize(); |
140 if (FAILED(hr)) { | 138 if (FAILED(hr)) { |
141 Done(hr); | 139 Done(hr); |
142 return; | 140 return; |
143 } | 141 } |
144 | 142 |
145 // Add Chromoting Host to the bundle. | 143 // Add Chromoting Host to the bundle. |
146 ScopedBstr appid(kOmahaAppid); | 144 ScopedBstr appid(kHostOmahaAppid); |
147 ScopedBstr empty(kOmahaEmpty); | 145 ScopedBstr empty(kOmahaEmpty); |
148 ScopedBstr language(kOmahaLanguage); | 146 ScopedBstr language(kOmahaLanguage); |
149 hr = bundle_->createApp(appid, empty, language, empty); | 147 hr = bundle_->createApp(appid, empty, language, empty); |
150 if (FAILED(hr)) { | 148 if (FAILED(hr)) { |
151 Done(hr); | 149 Done(hr); |
152 return; | 150 return; |
153 } | 151 } |
154 | 152 |
155 hr = bundle_->checkForUpdate(); | 153 hr = bundle_->checkForUpdate(); |
156 if (FAILED(hr)) { | 154 if (FAILED(hr)) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 &google_update); | 283 &google_update); |
286 if (result != ERROR_SUCCESS) { | 284 if (result != ERROR_SUCCESS) { |
287 Done(HRESULT_FROM_WIN32(result)); | 285 Done(HRESULT_FROM_WIN32(result)); |
288 return; | 286 return; |
289 } | 287 } |
290 | 288 |
291 // Launch the updater process and wait for its termination. | 289 // Launch the updater process and wait for its termination. |
292 string16 command_line = | 290 string16 command_line = |
293 StringPrintf(kGoogleUpdateCommandLineFormat, | 291 StringPrintf(kGoogleUpdateCommandLineFormat, |
294 google_update.c_str(), | 292 google_update.c_str(), |
295 kOmahaAppid, | 293 kHostOmahaAppid, |
296 kOmahaLanguage); | 294 kOmahaLanguage); |
297 | 295 |
298 base::LaunchOptions options; | 296 base::LaunchOptions options; |
299 if (!base::LaunchProcess(command_line, options, process_.Receive())) { | 297 if (!base::LaunchProcess(command_line, options, process_.Receive())) { |
300 result = GetLastError(); | 298 result = GetLastError(); |
301 Done(HRESULT_FROM_WIN32(result)); | 299 Done(HRESULT_FROM_WIN32(result)); |
302 return; | 300 return; |
303 } | 301 } |
304 | 302 |
305 if (!process_watcher_.StartWatching(process_.Get(), this)) { | 303 if (!process_watcher_.StartWatching(process_.Get(), this)) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 HWND parent = GetAncestor(window, GA_PARENT); | 379 HWND parent = GetAncestor(window, GA_PARENT); |
382 if (parent == NULL) { | 380 if (parent == NULL) { |
383 return window; | 381 return window; |
384 } | 382 } |
385 | 383 |
386 window = parent; | 384 window = parent; |
387 } | 385 } |
388 } | 386 } |
389 | 387 |
390 } // namespace remoting | 388 } // namespace remoting |
OLD | NEW |