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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 // thing to do. | 346 // thing to do. |
347 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 347 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
348 Version version; | 348 Version version; |
349 InstallUtil::GetChromeVersion(dist, true, &version); | 349 InstallUtil::GetChromeVersion(dist, true, &version); |
350 if (version.IsValid()) { | 350 if (version.IsValid()) { |
351 FilePath exe_path; | 351 FilePath exe_path; |
352 PathService::Get(base::DIR_EXE, &exe_path); | 352 PathService::Get(base::DIR_EXE, &exe_path); |
353 std::wstring exe = exe_path.value(); | 353 std::wstring exe = exe_path.value(); |
354 FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); | 354 FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); |
355 if (FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { | 355 if (FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { |
356 const string16 text = | 356 bool is_metro = base::win::IsMetroProcess(); |
357 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); | 357 if (!is_metro) { |
358 const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 358 // The dialog cannot be shown in Win8 Metro as doing so hangs Chrome on |
359 const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; | 359 // an invisible dialog. |
360 ui::MessageBox(NULL, text, caption, flags); | 360 // TODO (gab): Get rid of this dialog altogether and auto-launch |
| 361 // system-level Chrome instead. |
| 362 const string16 text = |
| 363 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); |
| 364 const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
| 365 const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; |
| 366 ui::MessageBox(NULL, text, caption, flags); |
| 367 } |
361 CommandLine uninstall_cmd( | 368 CommandLine uninstall_cmd( |
362 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); | 369 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); |
363 if (!uninstall_cmd.GetProgram().empty()) { | 370 if (!uninstall_cmd.GetProgram().empty()) { |
364 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); | 371 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); |
365 uninstall_cmd.AppendSwitch( | 372 uninstall_cmd.AppendSwitch( |
366 installer::switches::kDoNotRemoveSharedItems); | 373 installer::switches::kDoNotRemoveSharedItems); |
367 base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL); | 374 base::LaunchOptions launch_options; |
| 375 if (is_metro) |
| 376 launch_options.force_breakaway_from_job_ = true; |
| 377 base::LaunchProcess(uninstall_cmd, launch_options, NULL); |
368 } | 378 } |
369 return true; | 379 return true; |
370 } | 380 } |
371 } | 381 } |
372 return false; | 382 return false; |
373 } | 383 } |
374 | 384 |
375 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { | 385 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { |
376 int resource_id = 0; | 386 int resource_id = 0; |
377 switch (installer_string_id) { | 387 switch (installer_string_id) { |
(...skipping 11 matching lines...) Expand all Loading... |
389 if (resource_id) | 399 if (resource_id) |
390 return l10n_util::GetStringUTF16(resource_id); | 400 return l10n_util::GetStringUTF16(resource_id); |
391 return string16(); | 401 return string16(); |
392 } | 402 } |
393 | 403 |
394 // static | 404 // static |
395 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 405 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
396 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 406 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
397 installer::SetTranslationDelegate(&delegate); | 407 installer::SetTranslationDelegate(&delegate); |
398 } | 408 } |
OLD | NEW |