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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // thing to do. | 322 // thing to do. |
323 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 323 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
324 Version version; | 324 Version version; |
325 InstallUtil::GetChromeVersion(dist, true, &version); | 325 InstallUtil::GetChromeVersion(dist, true, &version); |
326 if (version.IsValid()) { | 326 if (version.IsValid()) { |
327 FilePath exe_path; | 327 FilePath exe_path; |
328 PathService::Get(base::DIR_EXE, &exe_path); | 328 PathService::Get(base::DIR_EXE, &exe_path); |
329 std::wstring exe = exe_path.value(); | 329 std::wstring exe = exe_path.value(); |
330 FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); | 330 FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); |
331 if (FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { | 331 if (FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { |
332 const string16 text = | 332 bool is_metro = base::win::IsMetroProcess(); |
333 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); | 333 if (!is_metro) { |
334 const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 334 // The dialog cannot be shown in Win8 Metro as doing so hangs Chrome on |
335 const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; | 335 // an invisible dialog. |
336 ui::MessageBox(NULL, text, caption, flags); | 336 // TODO (gab): Get rid of this dialog altogether and auto-launch |
| 337 // system-level Chrome instead. |
| 338 const string16 text = |
| 339 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); |
| 340 const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
| 341 const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; |
| 342 ui::MessageBox(NULL, text, caption, flags); |
| 343 } |
337 CommandLine uninstall_cmd( | 344 CommandLine uninstall_cmd( |
338 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); | 345 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); |
339 if (!uninstall_cmd.GetProgram().empty()) { | 346 if (!uninstall_cmd.GetProgram().empty()) { |
340 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); | 347 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); |
341 uninstall_cmd.AppendSwitch( | 348 uninstall_cmd.AppendSwitch( |
342 installer::switches::kDoNotRemoveSharedItems); | 349 installer::switches::kDoNotRemoveSharedItems); |
343 base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL); | 350 base::LaunchOptions launch_options; |
| 351 if (is_metro) |
| 352 launch_options.force_breakaway_from_job_ = true; |
| 353 base::LaunchProcess(uninstall_cmd, launch_options, NULL); |
344 } | 354 } |
345 return true; | 355 return true; |
346 } | 356 } |
347 } | 357 } |
348 return false; | 358 return false; |
349 } | 359 } |
350 | 360 |
351 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { | 361 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { |
352 int resource_id = 0; | 362 int resource_id = 0; |
353 switch (installer_string_id) { | 363 switch (installer_string_id) { |
(...skipping 11 matching lines...) Expand all Loading... |
365 if (resource_id) | 375 if (resource_id) |
366 return l10n_util::GetStringUTF16(resource_id); | 376 return l10n_util::GetStringUTF16(resource_id); |
367 return string16(); | 377 return string16(); |
368 } | 378 } |
369 | 379 |
370 // static | 380 // static |
371 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 381 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
372 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 382 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
373 installer::SetTranslationDelegate(&delegate); | 383 installer::SetTranslationDelegate(&delegate); |
374 } | 384 } |
OLD | NEW |