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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // system-level Chrome instead. | 351 // system-level Chrome instead. |
352 const string16 text = | 352 const string16 text = |
353 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); | 353 l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); |
354 const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 354 const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
355 const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; | 355 const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; |
356 ui::MessageBox(NULL, text, caption, flags); | 356 ui::MessageBox(NULL, text, caption, flags); |
357 } | 357 } |
358 CommandLine uninstall_cmd( | 358 CommandLine uninstall_cmd( |
359 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); | 359 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); |
360 if (!uninstall_cmd.GetProgram().empty()) { | 360 if (!uninstall_cmd.GetProgram().empty()) { |
| 361 uninstall_cmd.AppendSwitch(installer::switches::kSelfDestruct); |
361 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); | 362 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); |
362 uninstall_cmd.AppendSwitch( | 363 uninstall_cmd.AppendSwitch( |
363 installer::switches::kDoNotRemoveSharedItems); | 364 installer::switches::kDoNotRemoveSharedItems); |
364 base::LaunchOptions launch_options; | 365 |
| 366 const FilePath setup_exe(uninstall_cmd.GetProgram()); |
| 367 const string16 params(uninstall_cmd.GetArgumentsString()); |
| 368 |
| 369 SHELLEXECUTEINFO sei = { sizeof(sei) }; |
| 370 sei.fMask = SEE_MASK_NOASYNC; |
| 371 sei.nShow = SW_SHOWNORMAL; |
| 372 sei.lpFile = setup_exe.value().c_str(); |
| 373 sei.lpParameters = params.c_str(); |
| 374 // On Windows 8 SEE_MASK_FLAG_LOG_USAGE is necessary to guarantee we |
| 375 // flip to the Desktop when launching. |
365 if (is_metro) | 376 if (is_metro) |
366 launch_options.force_breakaway_from_job_ = true; | 377 sei.fMask |= SEE_MASK_FLAG_LOG_USAGE; |
367 base::LaunchProcess(uninstall_cmd, launch_options, NULL); | 378 |
| 379 if (!::ShellExecuteEx(&sei)) |
| 380 DPCHECK(false); |
368 } | 381 } |
369 return true; | 382 return true; |
370 } | 383 } |
371 } | 384 } |
372 return false; | 385 return false; |
373 } | 386 } |
374 | 387 |
375 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { | 388 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { |
376 int resource_id = 0; | 389 int resource_id = 0; |
377 switch (installer_string_id) { | 390 switch (installer_string_id) { |
(...skipping 11 matching lines...) Expand all Loading... |
389 if (resource_id) | 402 if (resource_id) |
390 return l10n_util::GetStringUTF16(resource_id); | 403 return l10n_util::GetStringUTF16(resource_id); |
391 return string16(); | 404 return string16(); |
392 } | 405 } |
393 | 406 |
394 // static | 407 // static |
395 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 408 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
396 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 409 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
397 installer::SetTranslationDelegate(&delegate); | 410 installer::SetTranslationDelegate(&delegate); |
398 } | 411 } |
OLD | NEW |