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 <stdint.h> | 9 #include <stdint.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
27 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
28 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
29 #include "base/threading/thread_task_runner_handle.h" | 29 #include "base/threading/thread_task_runner_handle.h" |
30 #include "base/time/time.h" | 30 #include "base/time/time.h" |
31 #include "base/version.h" | 31 #include "base/version.h" |
32 #include "base/win/scoped_bstr.h" | 32 #include "base/win/scoped_bstr.h" |
33 #include "base/win/windows_version.h" | 33 #include "base/win/windows_version.h" |
34 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
35 #include "chrome/grit/generated_resources.h" | 35 #include "chrome/grit/generated_resources.h" |
| 36 #include "chrome/install_static/install_util.h" |
36 #include "chrome/installer/util/browser_distribution.h" | 37 #include "chrome/installer/util/browser_distribution.h" |
37 #include "chrome/installer/util/google_update_settings.h" | 38 #include "chrome/installer/util/google_update_settings.h" |
38 #include "chrome/installer/util/helper.h" | 39 #include "chrome/installer/util/helper.h" |
39 #include "chrome/installer/util/install_util.h" | 40 #include "chrome/installer/util/install_util.h" |
40 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
41 #include "ui/base/win/atl_module.h" | 42 #include "ui/base/win/atl_module.h" |
42 #include "ui/gfx/geometry/safe_integer_conversions.h" | 43 #include "ui/gfx/geometry/safe_integer_conversions.h" |
43 | 44 |
44 namespace { | 45 namespace { |
45 | 46 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 // Likewise, a failure to set the parent window need not block an update | 556 // Likewise, a failure to set the parent window need not block an update |
556 // check. | 557 // check. |
557 app_bundle->put_parentHWND( | 558 app_bundle->put_parentHWND( |
558 reinterpret_cast<ULONG_PTR>(elevation_window_)); | 559 reinterpret_cast<ULONG_PTR>(elevation_window_)); |
559 } | 560 } |
560 app_bundle_.swap(app_bundle); | 561 app_bundle_.swap(app_bundle); |
561 } | 562 } |
562 | 563 |
563 // Get a reference to the Chrome app in the bundle. | 564 // Get a reference to the Chrome app in the bundle. |
564 if (!app_) { | 565 if (!app_) { |
565 base::string16 app_guid = | 566 const wchar_t* app_guid = install_static::GetAppGuid(); |
566 BrowserDistribution::GetDistribution()->GetAppGuid(); | 567 DCHECK(app_guid); |
567 DCHECK(!app_guid.empty()); | 568 DCHECK(*app_guid); |
568 | 569 |
569 base::win::ScopedComPtr<IDispatch> dispatch; | 570 base::win::ScopedComPtr<IDispatch> dispatch; |
570 // It is common for this call to fail with APP_USING_EXTERNAL_UPDATER if | 571 // It is common for this call to fail with APP_USING_EXTERNAL_UPDATER if |
571 // an auto update is in progress. | 572 // an auto update is in progress. |
572 hresult = app_bundle_->createInstalledApp( | 573 hresult = app_bundle_->createInstalledApp(base::win::ScopedBstr(app_guid)); |
573 base::win::ScopedBstr(app_guid.c_str())); | |
574 if (FAILED(hresult)) | 574 if (FAILED(hresult)) |
575 return hresult; | 575 return hresult; |
576 // Move the IAppBundleWeb reference into a local now so that failures from | 576 // Move the IAppBundleWeb reference into a local now so that failures from |
577 // this point onward result in it being released. | 577 // this point onward result in it being released. |
578 base::win::ScopedComPtr<IAppBundleWeb> app_bundle; | 578 base::win::ScopedComPtr<IAppBundleWeb> app_bundle; |
579 app_bundle.swap(app_bundle_); | 579 app_bundle.swap(app_bundle_); |
580 hresult = app_bundle->get_appWeb(0, dispatch.Receive()); | 580 hresult = app_bundle->get_appWeb(0, dispatch.Receive()); |
581 if (FAILED(hresult)) | 581 if (FAILED(hresult)) |
582 return hresult; | 582 return hresult; |
583 base::win::ScopedComPtr<IAppWeb> app; | 583 base::win::ScopedComPtr<IAppWeb> app; |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 const GoogleUpdate3ClassFactory& google_update_factory) { | 889 const GoogleUpdate3ClassFactory& google_update_factory) { |
890 if (g_google_update_factory) { | 890 if (g_google_update_factory) { |
891 delete g_google_update_factory; | 891 delete g_google_update_factory; |
892 g_google_update_factory = nullptr; | 892 g_google_update_factory = nullptr; |
893 } | 893 } |
894 if (!google_update_factory.is_null()) { | 894 if (!google_update_factory.is_null()) { |
895 g_google_update_factory = | 895 g_google_update_factory = |
896 new GoogleUpdate3ClassFactory(google_update_factory); | 896 new GoogleUpdate3ClassFactory(google_update_factory); |
897 } | 897 } |
898 } | 898 } |
OLD | NEW |