Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: chrome/browser/chrome_browser_main_win.cc

Issue 11685006: [Fixit-Dec-2012] Auto-launch system-level Chrome post user-level Chrome self-destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/installer/setup/install.cc » ('j') | chrome/installer/setup/setup_main.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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) };
grt (UTC plus 2) 2013/01/02 17:59:33 For safety, I think you need: sei.fMask =
gab 2013/01/02 21:15:48 Done.
370 sei.nShow = SW_SHOWNORMAL;
371 sei.lpFile = setup_exe.value().c_str();
372 sei.lpParameters = params.c_str();
grt (UTC plus 2) 2013/01/02 17:59:33 MSDN says that quotes in lpParameters must be quot
gab 2013/01/02 21:15:48 Interesting, if this is ever a problem (and if it
grt (UTC plus 2) 2013/01/03 15:41:27 Yup. Wasn't suggesting that this was the place, ju
373 // On Windows 8 SEE_MASK_FLAG_LOG_USAGE is necessary to guarantee we
374 // flip to the Desktop when launching.
365 if (is_metro) 375 if (is_metro)
366 launch_options.force_breakaway_from_job_ = true; 376 sei.fMask = SEE_MASK_FLAG_LOG_USAGE;
grt (UTC plus 2) 2013/01/02 17:59:33 = -> |=
gab 2013/01/02 21:15:48 Done.
367 base::LaunchProcess(uninstall_cmd, launch_options, NULL); 377
378 if (!::ShellExecuteExW(&sei))
grt (UTC plus 2) 2013/01/02 17:59:33 nit: please remove the trailing 'W'
grt (UTC plus 2) 2013/01/02 17:59:33 MSDN suggests that COM should always be initialize
robertshield 2013/01/02 19:36:06 This should be fine.
gab 2013/01/02 21:15:48 Done.
gab 2013/01/02 21:15:48 Ack.
379 NOTREACHED();
grt (UTC plus 2) 2013/01/02 17:59:33 DPCHECK(false); so that the last-error code is log
gab 2013/01/02 21:15:48 Done.
368 } 380 }
369 return true; 381 return true;
370 } 382 }
371 } 383 }
372 return false; 384 return false;
373 } 385 }
374 386
375 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) { 387 string16 TranslationDelegate::GetLocalizedString(int installer_string_id) {
376 int resource_id = 0; 388 int resource_id = 0;
377 switch (installer_string_id) { 389 switch (installer_string_id) {
(...skipping 11 matching lines...) Expand all
389 if (resource_id) 401 if (resource_id)
390 return l10n_util::GetStringUTF16(resource_id); 402 return l10n_util::GetStringUTF16(resource_id);
391 return string16(); 403 return string16();
392 } 404 }
393 405
394 // static 406 // static
395 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { 407 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() {
396 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); 408 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ());
397 installer::SetTranslationDelegate(&delegate); 409 installer::SetTranslationDelegate(&delegate);
398 } 410 }
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/setup/install.cc » ('j') | chrome/installer/setup/setup_main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698