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 bool is_metro = base::win::IsMetroProcess(); |
365 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); | 365 if (!is_metro) { |
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 if (is_metro) |
| 384 launch_options.force_breakaway_from_job_ = true; |
| 385 base::LaunchProcess(uninstall_cmd, launch_options, NULL); |
376 } | 386 } |
377 return true; | 387 return true; |
378 } | 388 } |
379 } | 389 } |
380 return false; | 390 return false; |
381 } | 391 } |
382 | 392 |
383 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { | 393 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { |
384 int resource_id = 0; | 394 int resource_id = 0; |
385 switch (installer_string_id) { | 395 switch (installer_string_id) { |
(...skipping 11 matching lines...) Expand all Loading... |
397 if (resource_id) | 407 if (resource_id) |
398 return l10n_util::GetStringUTF16(resource_id); | 408 return l10n_util::GetStringUTF16(resource_id); |
399 return string16(); | 409 return string16(); |
400 } | 410 } |
401 | 411 |
402 // static | 412 // static |
403 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 413 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
404 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 414 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
405 installer::SetTranslationDelegate(&delegate); | 415 installer::SetTranslationDelegate(&delegate); |
406 } | 416 } |
OLD | NEW |