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> |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // able to use the duplicated handle above (Google Update results). | 246 // able to use the duplicated handle above (Google Update results). |
247 bool launched = base::LaunchAppAsUser(user_token, | 247 bool launched = base::LaunchAppAsUser(user_token, |
248 cmd_line.command_line_string(), | 248 cmd_line.command_line_string(), |
249 false, NULL, true, true); | 249 false, NULL, true, true); |
250 ::CloseHandle(user_token); | 250 ::CloseHandle(user_token); |
251 return launched; | 251 return launched; |
252 } | 252 } |
253 | 253 |
254 } // namespace | 254 } // namespace |
255 | 255 |
256 GoogleChromeDistribution::GoogleChromeDistribution( | 256 GoogleChromeDistribution::GoogleChromeDistribution() |
257 const installer::MasterPreferences& prefs) | 257 : BrowserDistribution(CHROME_BROWSER), |
258 : BrowserDistribution(prefs), product_guid_(kChromeGuid) { | 258 product_guid_(kChromeGuid) { |
259 } | 259 } |
260 | 260 |
261 // The functions below are not used by the 64-bit Windows binary - | 261 // The functions below are not used by the 64-bit Windows binary - |
262 // see the comment in google_chrome_distribution_dummy.cc | 262 // see the comment in google_chrome_distribution_dummy.cc |
263 #ifndef _WIN64 | 263 #ifndef _WIN64 |
264 bool GoogleChromeDistribution::BuildUninstallMetricsString( | 264 bool GoogleChromeDistribution::BuildUninstallMetricsString( |
265 DictionaryValue* uninstall_metrics_dict, std::wstring* metrics) { | 265 DictionaryValue* uninstall_metrics_dict, std::wstring* metrics) { |
266 DCHECK(NULL != metrics); | 266 DCHECK(NULL != metrics); |
267 bool has_values = false; | 267 bool has_values = false; |
268 | 268 |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 // User level: The experiment needs to be performed in a different process | 626 // User level: The experiment needs to be performed in a different process |
627 // because google_update expects the upgrade process to be quick and nimble. | 627 // because google_update expects the upgrade process to be quick and nimble. |
628 // System level: We have already been relaunched, so we don't need to be | 628 // System level: We have already been relaunched, so we don't need to be |
629 // quick, but we relaunch to follow the exact same codepath. | 629 // quick, but we relaunch to follow the exact same codepath. |
630 RelaunchSetup(installer::switches::kInactiveUserToast, flavor, | 630 RelaunchSetup(installer::switches::kInactiveUserToast, flavor, |
631 system_level); | 631 system_level); |
632 } | 632 } |
633 | 633 |
634 // User qualifies for the experiment. Launch chrome with --try-chrome=flavor. | 634 // User qualifies for the experiment. Launch chrome with --try-chrome=flavor. |
635 void GoogleChromeDistribution::InactiveUserToastExperiment(int flavor, | 635 void GoogleChromeDistribution::InactiveUserToastExperiment(int flavor, |
636 const installer::Product& installation) { | 636 const installer::Product& installation, |
| 637 const FilePath& application_path) { |
637 bool has_welcome_url = (flavor == 0); | 638 bool has_welcome_url = (flavor == 0); |
638 // Possibly add a url to launch depending on the experiment flavor. | 639 // Possibly add a url to launch depending on the experiment flavor. |
639 CommandLine options(CommandLine::NO_PROGRAM); | 640 CommandLine options(CommandLine::NO_PROGRAM); |
640 options.AppendSwitchNative(switches::kTryChromeAgain, | 641 options.AppendSwitchNative(switches::kTryChromeAgain, |
641 base::IntToString16(flavor)); | 642 base::IntToString16(flavor)); |
642 if (has_welcome_url) { | 643 if (has_welcome_url) { |
643 // Prepend the url with a space. | 644 // Prepend the url with a space. |
644 std::wstring url(GetWelcomeBackUrl()); | 645 std::wstring url(GetWelcomeBackUrl()); |
645 options.AppendArg("--"); | 646 options.AppendArg("--"); |
646 options.AppendArgNative(url); | 647 options.AppendArgNative(url); |
647 // The command line should now have the url added as: | 648 // The command line should now have the url added as: |
648 // "chrome.exe -- <url>" | 649 // "chrome.exe -- <url>" |
649 DCHECK_NE(std::wstring::npos, | 650 DCHECK_NE(std::wstring::npos, |
650 options.command_line_string().find(L" -- " + url)); | 651 options.command_line_string().find(L" -- " + url)); |
651 } | 652 } |
652 // Launch chrome now. It will show the toast UI. | 653 // Launch chrome now. It will show the toast UI. |
653 int32 exit_code = 0; | 654 int32 exit_code = 0; |
654 if (!installation.LaunchChromeAndWait(options, &exit_code)) | 655 if (!installation.LaunchChromeAndWait(application_path, options, &exit_code)) |
655 return; | 656 return; |
656 | 657 |
657 // The chrome process has exited, figure out what happened. | 658 // The chrome process has exited, figure out what happened. |
658 const wchar_t* outcome = NULL; | 659 const wchar_t* outcome = NULL; |
659 switch (exit_code) { | 660 switch (exit_code) { |
660 case ResultCodes::NORMAL_EXIT: | 661 case ResultCodes::NORMAL_EXIT: |
661 outcome = kToastExpTriesOkGroup; | 662 outcome = kToastExpTriesOkGroup; |
662 break; | 663 break; |
663 case ResultCodes::NORMAL_EXIT_CANCEL: | 664 case ResultCodes::NORMAL_EXIT_CANCEL: |
664 outcome = kToastExpCancelGroup; | 665 outcome = kToastExpCancelGroup; |
(...skipping 16 matching lines...) Expand all Loading... |
681 // running. | 682 // running. |
682 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( | 683 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( |
683 installer::switches::kSystemLevelToast); | 684 installer::switches::kSystemLevelToast); |
684 | 685 |
685 std::wstring cmd(InstallUtil::GetChromeUninstallCmd( | 686 std::wstring cmd(InstallUtil::GetChromeUninstallCmd( |
686 system_level_toast, this)); | 687 system_level_toast, this)); |
687 | 688 |
688 base::LaunchApp(cmd, false, false, NULL); | 689 base::LaunchApp(cmd, false, false, NULL); |
689 } | 690 } |
690 #endif | 691 #endif |
691 | |
692 bool GoogleChromeDistribution::SetChannelFlags( | |
693 bool set, | |
694 installer::ChannelInfo* channel_info) { | |
695 DCHECK(channel_info); | |
696 return channel_info->SetChrome(set); | |
697 } | |
OLD | NEW |