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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 546 |
547 hresult = app_bundle->initialize(); | 547 hresult = app_bundle->initialize(); |
548 if (FAILED(hresult)) | 548 if (FAILED(hresult)) |
549 return hresult; | 549 return hresult; |
550 if (elevation_window_) { | 550 if (elevation_window_) { |
551 // Likewise, a failure to set the parent window need not block an update | 551 // Likewise, a failure to set the parent window need not block an update |
552 // check. | 552 // check. |
553 app_bundle->put_parentHWND( | 553 app_bundle->put_parentHWND( |
554 reinterpret_cast<ULONG_PTR>(elevation_window_)); | 554 reinterpret_cast<ULONG_PTR>(elevation_window_)); |
555 } | 555 } |
556 app_bundle_.swap(app_bundle); | 556 app_bundle_.Swap(app_bundle); |
557 } | 557 } |
558 | 558 |
559 // Get a reference to the Chrome app in the bundle. | 559 // Get a reference to the Chrome app in the bundle. |
560 if (!app_) { | 560 if (!app_) { |
561 const wchar_t* app_guid = install_static::GetAppGuid(); | 561 const wchar_t* app_guid = install_static::GetAppGuid(); |
562 DCHECK(app_guid); | 562 DCHECK(app_guid); |
563 DCHECK(*app_guid); | 563 DCHECK(*app_guid); |
564 | 564 |
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.GetAddressOf()); | 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.GetAddressOf()); | 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; |
(...skipping 286 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 |