diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-13 20:52:18 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-13 20:52:18 +0000 |
commit | 53c38d23fb0d73d48f3fd804da52fd374d08e2c9 (patch) | |
tree | 675f149d7c8d4867f8594fe0ec2bdd02aa53dd51 | |
parent | 79db623ab30e307049cd9ad0cc22a8ff1a399cbb (diff) | |
download | chromium_src-53c38d23fb0d73d48f3fd804da52fd374d08e2c9.zip chromium_src-53c38d23fb0d73d48f3fd804da52fd374d08e2c9.tar.gz chromium_src-53c38d23fb0d73d48f3fd804da52fd374d08e2c9.tar.bz2 |
Small cleanup of DoUninstallTasks()
- eliminates one #ifdef
- Did I mention is cleaner?
Review URL: http://codereview.chromium.org/21331
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9791 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_main.cc | 15 | ||||
-rw-r--r-- | chrome/browser/browser_main_mac.mm | 2 | ||||
-rw-r--r-- | chrome/browser/browser_main_win.cc | 13 | ||||
-rw-r--r-- | chrome/browser/browser_main_win.h | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_main_gtk.cc | 2 |
5 files changed, 19 insertions, 17 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 89ce130..31a10c2 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -379,19 +379,8 @@ int BrowserMain(const MainFunctionParams& parameters) { // If the command line specifies 'uninstall' then we need to work here // unless we detect another chrome browser running. - if (parsed_command_line.HasSwitch(switches::kUninstall)) { - if (already_running) { -#if defined(OS_WIN) - const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_CLOSE_APP); - const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); - win_util::MessageBox(NULL, text, caption, - MB_OK | MB_ICONWARNING | MB_TOPMOST); -#endif - return ResultCodes::UNINSTALL_CHROME_ALIVE; - } else { - return DoUninstallTasks(); - } - } + if (parsed_command_line.HasSwitch(switches::kUninstall)) + return DoUninstallTasks(already_running); if (parsed_command_line.HasSwitch(switches::kHideIcons) || parsed_command_line.HasSwitch(switches::kShowIcons)) { diff --git a/chrome/browser/browser_main_mac.mm b/chrome/browser/browser_main_mac.mm index 8f493f3..719ee96 100644 --- a/chrome/browser/browser_main_mac.mm +++ b/chrome/browser/browser_main_mac.mm @@ -39,7 +39,7 @@ void WillTerminate() { // From browser_main_win.h, stubs until we figure out the right thing... -int DoUninstallTasks() { +int DoUninstallTasks(bool chrome_still_running) { return ResultCodes::NORMAL_EXIT; } diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc index ef34c41..a7a0f6c 100644 --- a/chrome/browser/browser_main_win.cc +++ b/chrome/browser/browser_main_win.cc @@ -45,7 +45,18 @@ bool AskForUninstallConfirmation() { return (IDOK == win_util::MessageBox(NULL, text, caption, flags)); } -int DoUninstallTasks() { +void ShowCloseBrowserFirstMessageBox() { + const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_CLOSE_APP); + const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); + const UINT flags = MB_OK | MB_ICONWARNING | MB_TOPMOST; + win_util::MessageBox(NULL, text, caption, flags); +} + +int DoUninstallTasks(bool chrome_still_running) { + if (chrome_still_running) { + ShowCloseBrowserFirstMessageBox(); + return ResultCodes::UNINSTALL_CHROME_ALIVE; + } if (!AskForUninstallConfirmation()) return ResultCodes::UNINSTALL_USER_CANCEL; // The following actions are just best effort. diff --git a/chrome/browser/browser_main_win.h b/chrome/browser/browser_main_win.h index 9069058..1ce9726 100644 --- a/chrome/browser/browser_main_win.h +++ b/chrome/browser/browser_main_win.h @@ -15,7 +15,9 @@ class MetricsService; bool CheckForWin2000(); // Handle uninstallation when given the appropriate the command-line switch. -int DoUninstallTasks(); +// If |chrome_still_running| is true a modal dialog will be shown asking the +// user to close the other chrome instance. +int DoUninstallTasks(bool chrome_still_running); // Prepares the localized strings that are going to be displayed to // the user if the browser process dies. These strings are stored in the diff --git a/chrome/browser/gtk/browser_main_gtk.cc b/chrome/browser/gtk/browser_main_gtk.cc index b7e8360..3abc961 100644 --- a/chrome/browser/gtk/browser_main_gtk.cc +++ b/chrome/browser/gtk/browser_main_gtk.cc @@ -8,7 +8,7 @@ // From browser_main_win.h, stubs until we figure out the right thing... -int DoUninstallTasks() { +int DoUninstallTasks(bool chrome_still_running) { return ResultCodes::NORMAL_EXIT; } |