| 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 #include "base/win/scoped_variant.h" | 22 #include "base/win/scoped_variant.h" |
| 23 #include "google_update/google_update_idl.h" |
| 23 #include "remoting/base/dispatch_win.h" | 24 #include "remoting/base/dispatch_win.h" |
| 24 | |
| 25 namespace omaha { | |
| 26 #include "google_update/google_update_idl.h" | |
| 27 } // namespace omaha | |
| 28 | |
| 29 #include "remoting/host/constants.h" | 25 #include "remoting/host/constants.h" |
| 30 | 26 |
| 31 using base::win::ScopedBstr; | 27 using base::win::ScopedBstr; |
| 32 using base::win::ScopedComPtr; | 28 using base::win::ScopedComPtr; |
| 33 using base::win::ScopedVariant; | 29 using base::win::ScopedVariant; |
| 34 | 30 |
| 35 namespace { | 31 namespace { |
| 36 | 32 |
| 37 // The COM elevation moniker for Omaha. | 33 // The COM elevation moniker for Omaha. |
| 38 const char16 kOmahaElevationMoniker[] = | 34 const char16 kOmahaElevationMoniker[] = |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 return; | 184 return; |
| 189 } | 185 } |
| 190 if (current_state.type() != VT_DISPATCH) { | 186 if (current_state.type() != VT_DISPATCH) { |
| 191 Done(DISP_E_TYPEMISMATCH); | 187 Done(DISP_E_TYPEMISMATCH); |
| 192 return; | 188 return; |
| 193 } | 189 } |
| 194 | 190 |
| 195 ScopedVariant state; | 191 ScopedVariant state; |
| 196 hr = dispatch::Invoke(V_DISPATCH(¤t_state), L"stateValue", | 192 hr = dispatch::Invoke(V_DISPATCH(¤t_state), L"stateValue", |
| 197 DISPATCH_PROPERTYGET, state.Receive()); | 193 DISPATCH_PROPERTYGET, state.Receive()); |
| 198 if (FAILED(hr)) { | |
| 199 Done(hr); | |
| 200 return; | |
| 201 } | |
| 202 if (state.type() != VT_I4) { | 194 if (state.type() != VT_I4) { |
| 203 Done(DISP_E_TYPEMISMATCH); | 195 Done(DISP_E_TYPEMISMATCH); |
| 204 return; | 196 return; |
| 205 } | 197 } |
| 206 | 198 |
| 207 // Perform state-specific actions. | 199 // Perform state-specific actions. |
| 208 switch (V_I4(&state)) { | 200 switch (V_I4(&state)) { |
| 209 case omaha::STATE_INIT: | 201 case STATE_INIT: |
| 210 case omaha::STATE_WAITING_TO_CHECK_FOR_UPDATE: | 202 case STATE_WAITING_TO_CHECK_FOR_UPDATE: |
| 211 case omaha::STATE_CHECKING_FOR_UPDATE: | 203 case STATE_CHECKING_FOR_UPDATE: |
| 212 case omaha::STATE_WAITING_TO_DOWNLOAD: | 204 case STATE_WAITING_TO_DOWNLOAD: |
| 213 case omaha::STATE_RETRYING_DOWNLOAD: | 205 case STATE_RETRYING_DOWNLOAD: |
| 214 case omaha::STATE_DOWNLOADING: | 206 case STATE_DOWNLOADING: |
| 215 case omaha::STATE_WAITING_TO_INSTALL: | 207 case STATE_WAITING_TO_INSTALL: |
| 216 case omaha::STATE_INSTALLING: | 208 case STATE_INSTALLING: |
| 217 case omaha::STATE_PAUSED: | 209 case STATE_PAUSED: |
| 218 break; | 210 break; |
| 219 | 211 |
| 220 case omaha::STATE_UPDATE_AVAILABLE: | 212 case STATE_UPDATE_AVAILABLE: |
| 221 hr = dispatch::Invoke(V_DISPATCH(&bundle_), L"download", | 213 hr = dispatch::Invoke(V_DISPATCH(&bundle_), L"download", |
| 222 DISPATCH_METHOD, NULL); | 214 DISPATCH_METHOD, NULL); |
| 223 if (FAILED(hr)) { | 215 if (FAILED(hr)) { |
| 224 Done(hr); | 216 Done(hr); |
| 225 return; | 217 return; |
| 226 } | 218 } |
| 227 break; | 219 break; |
| 228 | 220 |
| 229 case omaha::STATE_DOWNLOAD_COMPLETE: | 221 case STATE_DOWNLOAD_COMPLETE: |
| 230 case omaha::STATE_EXTRACTING: | 222 case STATE_EXTRACTING: |
| 231 case omaha::STATE_APPLYING_DIFFERENTIAL_PATCH: | 223 case STATE_APPLYING_DIFFERENTIAL_PATCH: |
| 232 case omaha::STATE_READY_TO_INSTALL: | 224 case STATE_READY_TO_INSTALL: |
| 233 hr = dispatch::Invoke(V_DISPATCH(&bundle_), L"install", | 225 hr = dispatch::Invoke(V_DISPATCH(&bundle_), L"install", |
| 234 DISPATCH_METHOD, NULL); | 226 DISPATCH_METHOD, NULL); |
| 235 if (FAILED(hr)) { | 227 if (FAILED(hr)) { |
| 236 Done(hr); | 228 Done(hr); |
| 237 return; | 229 return; |
| 238 } | 230 } |
| 239 break; | 231 break; |
| 240 | 232 |
| 241 case omaha::STATE_INSTALL_COMPLETE: | 233 case STATE_INSTALL_COMPLETE: |
| 242 case omaha::STATE_NO_UPDATE: | 234 case STATE_NO_UPDATE: |
| 243 // Installation complete or not required. Report success. | 235 // Installation complete or not required. Report success. |
| 244 Done(S_OK); | 236 Done(S_OK); |
| 245 return; | 237 return; |
| 246 | 238 |
| 247 case omaha::STATE_ERROR: { | 239 case STATE_ERROR: { |
| 248 ScopedVariant error_code; | 240 ScopedVariant error_code; |
| 249 hr = dispatch::Invoke(V_DISPATCH(¤t_state), L"errorCode", | 241 hr = dispatch::Invoke(V_DISPATCH(¤t_state), L"errorCode", |
| 250 DISPATCH_PROPERTYGET, error_code.Receive()); | 242 DISPATCH_PROPERTYGET, error_code.Receive()); |
| 251 if (FAILED(hr)) { | 243 if (FAILED(hr)) { |
| 252 Done(hr); | 244 Done(hr); |
| 253 return; | 245 return; |
| 254 } | 246 } |
| 255 if (error_code.type() != VT_UI4) { | 247 if (error_code.type() != VT_UI4) { |
| 256 Done(DISP_E_TYPEMISMATCH); | 248 Done(DISP_E_TYPEMISMATCH); |
| 257 return; | 249 return; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 HWND parent = GetAncestor(window, GA_PARENT); | 382 HWND parent = GetAncestor(window, GA_PARENT); |
| 391 if (parent == NULL) { | 383 if (parent == NULL) { |
| 392 return window; | 384 return window; |
| 393 } | 385 } |
| 394 | 386 |
| 395 window = parent; | 387 window = parent; |
| 396 } | 388 } |
| 397 } | 389 } |
| 398 | 390 |
| 399 } // namespace remoting | 391 } // namespace remoting |
| OLD | NEW |