| 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 "chrome/browser/google/google_update_win.h" | 5 #include "chrome/browser/google/google_update_win.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlcom.h> | 8 #include <atlcom.h> |
| 9 #include <objbase.h> | 9 #include <objbase.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // With older versions of GoogleUpdate, a system-level update requires Admin | 188 // With older versions of GoogleUpdate, a system-level update requires Admin |
| 189 // privileges. Elevate while instantiating the MachineClass. | 189 // privileges. Elevate while instantiating the MachineClass. |
| 190 hresult = CoGetClassObjectAsAdmin(elevation_window, google_update_clsid, | 190 hresult = CoGetClassObjectAsAdmin(elevation_window, google_update_clsid, |
| 191 IID_PPV_ARGS(&class_factory)); | 191 IID_PPV_ARGS(&class_factory)); |
| 192 } | 192 } |
| 193 if (FAILED(hresult)) | 193 if (FAILED(hresult)) |
| 194 return hresult; | 194 return hresult; |
| 195 | 195 |
| 196 ConfigureProxyBlanket(class_factory.Get()); | 196 ConfigureProxyBlanket(class_factory.Get()); |
| 197 | 197 |
| 198 return class_factory->CreateInstance(nullptr, | 198 return class_factory->CreateInstance( |
| 199 IID_PPV_ARGS(google_update->Receive())); | 199 nullptr, IID_PPV_ARGS(google_update->GetAddressOf())); |
| 200 } | 200 } |
| 201 | 201 |
| 202 // UpdateCheckDriver ----------------------------------------------------------- | 202 // UpdateCheckDriver ----------------------------------------------------------- |
| 203 | 203 |
| 204 // A driver that is created and destroyed on the caller's thread and drives | 204 // A driver that is created and destroyed on the caller's thread and drives |
| 205 // Google Update on another. | 205 // Google Update on another. |
| 206 class UpdateCheckDriver { | 206 class UpdateCheckDriver { |
| 207 public: | 207 public: |
| 208 // Runs an update check on |task_runner|, invoking methods of |delegate| on | 208 // Runs an update check on |task_runner|, invoking methods of |delegate| on |
| 209 // the caller's thread to report progress and final results. | 209 // the caller's thread to report progress and final results. |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 ConfigureProxyBlanket(google_update_.Get()); | 519 ConfigureProxyBlanket(google_update_.Get()); |
| 520 } | 520 } |
| 521 | 521 |
| 522 // The class was created, so all subsequent errors are reported as: | 522 // The class was created, so all subsequent errors are reported as: |
| 523 *error_code = GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR; | 523 *error_code = GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR; |
| 524 | 524 |
| 525 // Create an app bundle. | 525 // Create an app bundle. |
| 526 if (!app_bundle_) { | 526 if (!app_bundle_) { |
| 527 base::win::ScopedComPtr<IAppBundleWeb> app_bundle; | 527 base::win::ScopedComPtr<IAppBundleWeb> app_bundle; |
| 528 base::win::ScopedComPtr<IDispatch> dispatch; | 528 base::win::ScopedComPtr<IDispatch> dispatch; |
| 529 hresult = google_update_->createAppBundleWeb(dispatch.Receive()); | 529 hresult = google_update_->createAppBundleWeb(dispatch.GetAddressOf()); |
| 530 if (FAILED(hresult)) | 530 if (FAILED(hresult)) |
| 531 return hresult; | 531 return hresult; |
| 532 hresult = dispatch.CopyTo(app_bundle.Receive()); | 532 hresult = dispatch.CopyTo(app_bundle.GetAddressOf()); |
| 533 if (FAILED(hresult)) | 533 if (FAILED(hresult)) |
| 534 return hresult; | 534 return hresult; |
| 535 dispatch.Reset(); | 535 dispatch.Reset(); |
| 536 | 536 |
| 537 ConfigureProxyBlanket(app_bundle.Get()); | 537 ConfigureProxyBlanket(app_bundle.Get()); |
| 538 | 538 |
| 539 if (!locale_.empty()) { | 539 if (!locale_.empty()) { |
| 540 // Ignore the result of this since, while setting the display language is | 540 // Ignore the result of this since, while setting the display language is |
| 541 // nice to have, a failure to do so does not affect the likelihood that | 541 // nice to have, a failure to do so does not affect the likelihood that |
| 542 // the update check and/or install will succeed. | 542 // the update check and/or install will succeed. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 565 base::win::ScopedComPtr<IDispatch> dispatch; | 565 base::win::ScopedComPtr<IDispatch> dispatch; |
| 566 // It is common for this call to fail with APP_USING_EXTERNAL_UPDATER if | 566 // It is common for this call to fail with APP_USING_EXTERNAL_UPDATER if |
| 567 // an auto update is in progress. | 567 // an auto update is in progress. |
| 568 hresult = app_bundle_->createInstalledApp(base::win::ScopedBstr(app_guid)); | 568 hresult = app_bundle_->createInstalledApp(base::win::ScopedBstr(app_guid)); |
| 569 if (FAILED(hresult)) | 569 if (FAILED(hresult)) |
| 570 return hresult; | 570 return hresult; |
| 571 // Move the IAppBundleWeb reference into a local now so that failures from | 571 // Move the IAppBundleWeb reference into a local now so that failures from |
| 572 // this point onward result in it being released. | 572 // this point onward result in it being released. |
| 573 base::win::ScopedComPtr<IAppBundleWeb> app_bundle; | 573 base::win::ScopedComPtr<IAppBundleWeb> app_bundle; |
| 574 app_bundle.swap(app_bundle_); | 574 app_bundle.swap(app_bundle_); |
| 575 hresult = app_bundle->get_appWeb(0, dispatch.Receive()); | 575 hresult = app_bundle->get_appWeb(0, dispatch.GetAddressOf()); |
| 576 if (FAILED(hresult)) | 576 if (FAILED(hresult)) |
| 577 return hresult; | 577 return hresult; |
| 578 base::win::ScopedComPtr<IAppWeb> app; | 578 base::win::ScopedComPtr<IAppWeb> app; |
| 579 hresult = dispatch.CopyTo(app.Receive()); | 579 hresult = dispatch.CopyTo(app.GetAddressOf()); |
| 580 if (FAILED(hresult)) | 580 if (FAILED(hresult)) |
| 581 return hresult; | 581 return hresult; |
| 582 ConfigureProxyBlanket(app.Get()); | 582 ConfigureProxyBlanket(app.Get()); |
| 583 hresult = app_bundle->checkForUpdate(); | 583 hresult = app_bundle->checkForUpdate(); |
| 584 if (FAILED(hresult)) | 584 if (FAILED(hresult)) |
| 585 return hresult; | 585 return hresult; |
| 586 app_bundle_.swap(app_bundle); | 586 app_bundle_.swap(app_bundle); |
| 587 app_.swap(app); | 587 app_.swap(app); |
| 588 } | 588 } |
| 589 | 589 |
| 590 return hresult; | 590 return hresult; |
| 591 } | 591 } |
| 592 | 592 |
| 593 bool UpdateCheckDriver::GetCurrentState( | 593 bool UpdateCheckDriver::GetCurrentState( |
| 594 base::win::ScopedComPtr<ICurrentState>* current_state, | 594 base::win::ScopedComPtr<ICurrentState>* current_state, |
| 595 CurrentState* state_value, | 595 CurrentState* state_value, |
| 596 HRESULT* hresult) const { | 596 HRESULT* hresult) const { |
| 597 base::win::ScopedComPtr<IDispatch> dispatch; | 597 base::win::ScopedComPtr<IDispatch> dispatch; |
| 598 *hresult = app_->get_currentState(dispatch.Receive()); | 598 *hresult = app_->get_currentState(dispatch.GetAddressOf()); |
| 599 if (FAILED(*hresult)) | 599 if (FAILED(*hresult)) |
| 600 return false; | 600 return false; |
| 601 *hresult = dispatch.CopyTo(current_state->Receive()); | 601 *hresult = dispatch.CopyTo(current_state->GetAddressOf()); |
| 602 if (FAILED(*hresult)) | 602 if (FAILED(*hresult)) |
| 603 return false; | 603 return false; |
| 604 ConfigureProxyBlanket(current_state->Get()); | 604 ConfigureProxyBlanket(current_state->Get()); |
| 605 LONG value = 0; | 605 LONG value = 0; |
| 606 *hresult = (*current_state)->get_stateValue(&value); | 606 *hresult = (*current_state)->get_stateValue(&value); |
| 607 if (FAILED(*hresult)) | 607 if (FAILED(*hresult)) |
| 608 return false; | 608 return false; |
| 609 *state_value = static_cast<CurrentState>(value); | 609 *state_value = static_cast<CurrentState>(value); |
| 610 return true; | 610 return true; |
| 611 } | 611 } |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 const GoogleUpdate3ClassFactory& google_update_factory) { | 884 const GoogleUpdate3ClassFactory& google_update_factory) { |
| 885 if (g_google_update_factory) { | 885 if (g_google_update_factory) { |
| 886 delete g_google_update_factory; | 886 delete g_google_update_factory; |
| 887 g_google_update_factory = nullptr; | 887 g_google_update_factory = nullptr; |
| 888 } | 888 } |
| 889 if (!google_update_factory.is_null()) { | 889 if (!google_update_factory.is_null()) { |
| 890 g_google_update_factory = | 890 g_google_update_factory = |
| 891 new GoogleUpdate3ClassFactory(google_update_factory); | 891 new GoogleUpdate3ClassFactory(google_update_factory); |
| 892 } | 892 } |
| 893 } | 893 } |
| OLD | NEW |