| OLD | NEW |
| (Empty) |
| 1 // Copyright 2010 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 | |
| 16 #include "omaha/goopdate/ondemand.h" | |
| 17 #include "omaha/base/debug.h" | |
| 18 #include "omaha/client/bundle_installer.h" | |
| 19 #include "omaha/common/const_cmd_line.h" | |
| 20 #include "omaha/common/lang.h" | |
| 21 #include "omaha/common/update3_utils.h" | |
| 22 #include "goopdate/omaha3_idl.h" | |
| 23 #include "omaha/goopdate/job_observer.h" | |
| 24 | |
| 25 namespace omaha { | |
| 26 | |
| 27 namespace internal { | |
| 28 | |
| 29 namespace { | |
| 30 | |
| 31 HRESULT CreateJobObserverForOnDemand(DWORD job_observer_git_cookie, | |
| 32 JobObserverCOMDecorator** job_observer) { | |
| 33 ASSERT1(job_observer); | |
| 34 *job_observer = NULL; | |
| 35 | |
| 36 CComGITPtr<IJobObserver> job_observer_git(job_observer_git_cookie); | |
| 37 CComPtr<IJobObserver> ijob_observer; | |
| 38 HRESULT hr = job_observer_git.CopyTo(&ijob_observer); | |
| 39 ASSERT1(ijob_observer); | |
| 40 if (FAILED(hr)) { | |
| 41 CORE_LOG(LE, (_T("[job_observer_git.CopyTo failed][0x%x]"), hr)); | |
| 42 return hr; | |
| 43 } | |
| 44 | |
| 45 CComObject<JobObserverCOMDecorator>* job_observer_com = NULL; | |
| 46 hr = CComObject<JobObserverCOMDecorator>::CreateInstance(&job_observer_com); | |
| 47 if (FAILED(hr)) { | |
| 48 CORE_LOG(LE, (_T("[JobObserverCOMDecorator creation failed][0x%x]"), hr)); | |
| 49 return hr; | |
| 50 } | |
| 51 | |
| 52 job_observer_com->Initialize(ijob_observer); | |
| 53 job_observer_com->AddRef(); | |
| 54 *job_observer = job_observer_com; | |
| 55 return S_OK; | |
| 56 } | |
| 57 | |
| 58 } // namespace | |
| 59 | |
| 60 HRESULT DoOnDemand(bool is_machine, OnDemandParameters on_demand_params) { | |
| 61 CComPtr<JobObserverCOMDecorator> job_observer; | |
| 62 HRESULT hr = internal::CreateJobObserverForOnDemand( | |
| 63 on_demand_params.job_observer_git_cookie, &job_observer); | |
| 64 if (FAILED(hr)) { | |
| 65 CORE_LOG(LE, (_T("[CreateJobObserver failed][0x%x]"), hr)); | |
| 66 return hr; | |
| 67 } | |
| 68 | |
| 69 return UpdateAppOnDemand(is_machine, | |
| 70 on_demand_params.app_id, | |
| 71 on_demand_params.is_update_check_only, | |
| 72 on_demand_params.session_id, | |
| 73 on_demand_params.impersonation_token, | |
| 74 on_demand_params.primary_token, | |
| 75 job_observer); | |
| 76 } | |
| 77 | |
| 78 } // namespace internal | |
| 79 | |
| 80 } // namespace omaha | |
| OLD | NEW |