OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file defines specific implementation of BrowserDistribution class for | 5 // This file defines specific implementation of BrowserDistribution class for |
6 // Google Chrome. | 6 // Google Chrome. |
7 | 7 |
8 #include "chrome/installer/util/google_chrome_distribution.h" | 8 #include "chrome/installer/util/google_chrome_distribution.h" |
9 | 9 |
10 #include <windows.h> | 10 #include <windows.h> |
11 #include <wtsapi32.h> | 11 #include <wtsapi32.h> |
12 #include <msi.h> | 12 #include <msi.h> |
13 #include <sddl.h> | 13 #include <sddl.h> |
14 | 14 |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/file_path.h" | 16 #include "base/file_path.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
19 #include "base/rand_util.h" | 19 #include "base/rand_util.h" |
20 #include "base/string_split.h" | 20 #include "base/string_split.h" |
21 #include "base/string_number_conversions.h" | 21 #include "base/string_number_conversions.h" |
22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "base/win/registry.h" | 24 #include "base/win/registry.h" |
25 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
26 #include "chrome/common/attrition_experiments.h" | 26 #include "chrome/common/attrition_experiments.h" |
| 27 #include "chrome/common/chrome_result_codes.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
29 #include "chrome/installer/util/channel_info.h" | 30 #include "chrome/installer/util/channel_info.h" |
30 #include "chrome/installer/util/product.h" | 31 #include "chrome/installer/util/product.h" |
31 #include "chrome/installer/util/install_util.h" | 32 #include "chrome/installer/util/install_util.h" |
32 #include "chrome/installer/util/l10n_string_util.h" | 33 #include "chrome/installer/util/l10n_string_util.h" |
33 #include "chrome/installer/util/google_update_constants.h" | 34 #include "chrome/installer/util/google_update_constants.h" |
34 #include "chrome/installer/util/google_update_settings.h" | 35 #include "chrome/installer/util/google_update_settings.h" |
35 #include "chrome/installer/util/helper.h" | 36 #include "chrome/installer/util/helper.h" |
36 #include "chrome/installer/util/util_constants.h" | 37 #include "chrome/installer/util/util_constants.h" |
37 #include "chrome/installer/util/wmi.h" | 38 #include "chrome/installer/util/wmi.h" |
38 #include "content/common/json_value_serializer.h" | 39 #include "content/common/json_value_serializer.h" |
39 #include "content/common/result_codes.h" | |
40 | 40 |
41 #include "installer_util_strings.h" // NOLINT | 41 #include "installer_util_strings.h" // NOLINT |
42 | 42 |
43 #pragma comment(lib, "wtsapi32.lib") | 43 #pragma comment(lib, "wtsapi32.lib") |
44 | 44 |
45 namespace { | 45 namespace { |
46 | 46 |
47 const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; | 47 const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; |
48 const wchar_t kBrowserAppId[] = L"Chrome"; | 48 const wchar_t kBrowserAppId[] = L"Chrome"; |
49 | 49 |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 options.command_line_string().find(L" -- " + url)); | 769 options.command_line_string().find(L" -- " + url)); |
770 } | 770 } |
771 // Launch chrome now. It will show the toast UI. | 771 // Launch chrome now. It will show the toast UI. |
772 int32 exit_code = 0; | 772 int32 exit_code = 0; |
773 if (!installation.LaunchChromeAndWait(application_path, options, &exit_code)) | 773 if (!installation.LaunchChromeAndWait(application_path, options, &exit_code)) |
774 return; | 774 return; |
775 | 775 |
776 // The chrome process has exited, figure out what happened. | 776 // The chrome process has exited, figure out what happened. |
777 const wchar_t* outcome = NULL; | 777 const wchar_t* outcome = NULL; |
778 switch (exit_code) { | 778 switch (exit_code) { |
779 case ResultCodes::NORMAL_EXIT: | 779 case content::RESULT_CODE_NORMAL_EXIT: |
780 outcome = kToastExpTriesOkGroup; | 780 outcome = kToastExpTriesOkGroup; |
781 break; | 781 break; |
782 case ResultCodes::NORMAL_EXIT_CANCEL: | 782 case chrome::RESULT_CODE_NORMAL_EXIT_CANCEL: |
783 outcome = kToastExpCancelGroup; | 783 outcome = kToastExpCancelGroup; |
784 break; | 784 break; |
785 case ResultCodes::NORMAL_EXIT_EXP2: | 785 case chrome::RESULT_CODE_NORMAL_EXIT_EXP2: |
786 outcome = kToastExpUninstallGroup; | 786 outcome = kToastExpUninstallGroup; |
787 break; | 787 break; |
788 default: | 788 default: |
789 outcome = kToastExpTriesErrorGroup; | 789 outcome = kToastExpTriesErrorGroup; |
790 }; | 790 }; |
791 | 791 |
792 // Write to the |client| key for the last time. | 792 // Write to the |client| key for the last time. |
793 SetClient(experiment_group + outcome, true); | 793 SetClient(experiment_group + outcome, true); |
794 | 794 |
795 if (outcome != kToastExpUninstallGroup) | 795 if (outcome != kToastExpUninstallGroup) |
796 return; | 796 return; |
797 | 797 |
798 // The user wants to uninstall. This is a best effort operation. Note that | 798 // The user wants to uninstall. This is a best effort operation. Note that |
799 // we waited for chrome to exit so the uninstall would not detect chrome | 799 // we waited for chrome to exit so the uninstall would not detect chrome |
800 // running. | 800 // running. |
801 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( | 801 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( |
802 installer::switches::kSystemLevelToast); | 802 installer::switches::kSystemLevelToast); |
803 | 803 |
804 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast, | 804 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast, |
805 GetType())); | 805 GetType())); |
806 base::LaunchApp(cmd, false, false, NULL); | 806 base::LaunchApp(cmd, false, false, NULL); |
807 } | 807 } |
808 #endif | 808 #endif |
OLD | NEW |