Chromium Code Reviews| 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/chrome_browser_main_win.h" | 5 #include "chrome/browser/chrome_browser_main_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 // thing to do. | 354 // thing to do. |
| 355 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 355 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 356 Version version; | 356 Version version; |
| 357 InstallUtil::GetChromeVersion(dist, true, &version); | 357 InstallUtil::GetChromeVersion(dist, true, &version); |
| 358 if (version.IsValid()) { | 358 if (version.IsValid()) { |
| 359 FilePath exe_path; | 359 FilePath exe_path; |
| 360 PathService::Get(base::DIR_EXE, &exe_path); | 360 PathService::Get(base::DIR_EXE, &exe_path); |
| 361 std::wstring exe = exe_path.value(); | 361 std::wstring exe = exe_path.value(); |
| 362 FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); | 362 FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); |
| 363 if (FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { | 363 if (FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { |
| 364 const string16 text = | 364 if (base::win::GetVersion() < base::win::VERSION_WIN8 || |
| 365 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); | 365 !base::win::IsMetroProcess()) { |
| 366 const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 366 // The dialog cannot be shown in Win8 Metro as doing so hangs Chrome on |
| 367 const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; | 367 // an invisible dialog. |
| 368 ui::MessageBox(NULL, text, caption, flags); | 368 // TODO (gab): Get rid of this dialog altogether and auto-launch |
| 369 // system-level Chrome instead. | |
| 370 const string16 text = | |
| 371 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); | |
| 372 const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | |
| 373 const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; | |
| 374 ui::MessageBox(NULL, text, caption, flags); | |
| 375 } | |
| 369 CommandLine uninstall_cmd( | 376 CommandLine uninstall_cmd( |
| 370 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); | 377 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); |
| 371 if (!uninstall_cmd.GetProgram().empty()) { | 378 if (!uninstall_cmd.GetProgram().empty()) { |
| 372 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); | 379 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); |
| 373 uninstall_cmd.AppendSwitch( | 380 uninstall_cmd.AppendSwitch( |
| 374 installer::switches::kDoNotRemoveSharedItems); | 381 installer::switches::kDoNotRemoveSharedItems); |
| 375 base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL); | 382 base::LaunchOptions launch_options; |
| 383 launch_options.force_breakaway_from_job_ = true; | |
|
grt (UTC plus 2)
2012/11/20 02:35:38
i'm a bit concerned about always doing this. as i
gab
2012/11/20 15:38:06
Done.
| |
| 384 base::LaunchProcess(uninstall_cmd, launch_options, NULL); | |
| 376 } | 385 } |
| 377 return true; | 386 return true; |
| 378 } | 387 } |
| 379 } | 388 } |
| 380 return false; | 389 return false; |
| 381 } | 390 } |
| 382 | 391 |
| 383 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { | 392 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { |
| 384 int resource_id = 0; | 393 int resource_id = 0; |
| 385 switch (installer_string_id) { | 394 switch (installer_string_id) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 397 if (resource_id) | 406 if (resource_id) |
| 398 return l10n_util::GetStringUTF16(resource_id); | 407 return l10n_util::GetStringUTF16(resource_id); |
| 399 return string16(); | 408 return string16(); |
| 400 } | 409 } |
| 401 | 410 |
| 402 // static | 411 // static |
| 403 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 412 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
| 404 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 413 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
| 405 installer::SetTranslationDelegate(&delegate); | 414 installer::SetTranslationDelegate(&delegate); |
| 406 } | 415 } |
| OLD | NEW |