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

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

Issue 174194: Re-apply r23841 "During uninstall if Chrome is set as default" (Closed)
Patch Set: update for combobox model changes Created 11 years, 4 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
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | chrome/browser/views/uninstall_dialog.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser_main_win.h" 5 #include "chrome/browser/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 "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "app/message_box_flags.h" 11 #include "app/message_box_flags.h"
12 #include "app/win_util.h" 12 #include "app/win_util.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/win_util.h" 15 #include "base/win_util.h"
16 #include "chrome/browser/first_run.h" 16 #include "chrome/browser/first_run.h"
17 #include "chrome/browser/metrics/metrics_service.h" 17 #include "chrome/browser/metrics/metrics_service.h"
18 #include "chrome/browser/views/uninstall_dialog.h" 18 #include "chrome/browser/views/uninstall_view.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/env_vars.h" 20 #include "chrome/common/env_vars.h"
21 #include "chrome/common/result_codes.h" 21 #include "chrome/common/result_codes.h"
22 #include "chrome/installer/util/helper.h" 22 #include "chrome/installer/util/helper.h"
23 #include "chrome/installer/util/install_util.h" 23 #include "chrome/installer/util/install_util.h"
24 #include "chrome/installer/util/shell_util.h" 24 #include "chrome/installer/util/shell_util.h"
25 #include "grit/chromium_strings.h" 25 #include "grit/chromium_strings.h"
26 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
27 #include "views/controls/message_box_view.h"
28 #include "views/focus/accelerator_handler.h" 27 #include "views/focus/accelerator_handler.h"
29 #include "views/window/window.h" 28 #include "views/window/window.h"
30 29
31 // Displays a warning message if the user is running chrome on windows 2000. 30 // Displays a warning message if the user is running chrome on windows 2000.
32 // Returns true if the OS is win2000, false otherwise. 31 // Returns true if the OS is win2000, false otherwise.
33 bool CheckForWin2000() { 32 bool CheckForWin2000() {
34 if (win_util::GetWinVersion() == win_util::WINVERSION_2000) { 33 if (win_util::GetWinVersion() == win_util::WINVERSION_2000) {
35 const std::wstring text = l10n_util::GetString(IDS_UNSUPPORTED_OS_WIN2000); 34 const std::wstring text = l10n_util::GetString(IDS_UNSUPPORTED_OS_WIN2000);
36 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); 35 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
37 win_util::MessageBox(NULL, text, caption, 36 win_util::MessageBox(NULL, text, caption,
38 MB_OK | MB_ICONWARNING | MB_TOPMOST); 37 MB_OK | MB_ICONWARNING | MB_TOPMOST);
39 return true; 38 return true;
40 } 39 }
41 return false; 40 return false;
42 } 41 }
43 42
44 int AskForUninstallConfirmation() { 43 int AskForUninstallConfirmation() {
45 int ret = ResultCodes::NORMAL_EXIT; 44 int ret = ResultCodes::NORMAL_EXIT;
46 UninstallDialog::ShowUninstallDialog(ret); 45 views::Window::CreateChromeWindow(NULL, gfx::Rect(),
46 new UninstallView(ret))->Show();
47 views::AcceleratorHandler accelerator_handler; 47 views::AcceleratorHandler accelerator_handler;
48 MessageLoopForUI::current()->Run(&accelerator_handler); 48 MessageLoopForUI::current()->Run(&accelerator_handler);
49 return ret; 49 return ret;
50 } 50 }
51 51
52 void ShowCloseBrowserFirstMessageBox() { 52 void ShowCloseBrowserFirstMessageBox() {
53 const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_CLOSE_APP); 53 const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_CLOSE_APP);
54 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); 54 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
55 const UINT flags = MB_OK | MB_ICONWARNING | MB_TOPMOST; 55 const UINT flags = MB_OK | MB_ICONWARNING | MB_TOPMOST;
56 win_util::MessageBox(NULL, text, caption, flags); 56 win_util::MessageBox(NULL, text, caption, flags);
57 } 57 }
58 58
59 int DoUninstallTasks(bool chrome_still_running) { 59 int DoUninstallTasks(bool chrome_still_running) {
60 // We want to show a warning to user (and exit) if Chrome is already running
61 // *before* we show the uninstall confirmation dialog box. But while the
62 // uninstall confirmation dialog is up, user might start Chrome, so we
63 // check once again after user acknowledges Uninstall dialog.
60 if (chrome_still_running) { 64 if (chrome_still_running) {
61 ShowCloseBrowserFirstMessageBox(); 65 ShowCloseBrowserFirstMessageBox();
62 return ResultCodes::UNINSTALL_CHROME_ALIVE; 66 return ResultCodes::UNINSTALL_CHROME_ALIVE;
63 } 67 }
64 int ret = AskForUninstallConfirmation(); 68 int ret = AskForUninstallConfirmation();
69 if (Upgrade::IsBrowserAlreadyRunning()) {
70 ShowCloseBrowserFirstMessageBox();
71 return ResultCodes::UNINSTALL_CHROME_ALIVE;
72 }
73
65 if (ret != ResultCodes::UNINSTALL_USER_CANCEL) { 74 if (ret != ResultCodes::UNINSTALL_USER_CANCEL) {
66 // The following actions are just best effort. 75 // The following actions are just best effort.
67 LOG(INFO) << "Executing uninstall actions"; 76 LOG(INFO) << "Executing uninstall actions";
68 if (!FirstRun::RemoveSentinel()) 77 if (!FirstRun::RemoveSentinel())
69 LOG(INFO) << "Failed to delete sentinel file."; 78 LOG(INFO) << "Failed to delete sentinel file.";
70 // We want to remove user level shortcuts and we only care about the ones 79 // We want to remove user level shortcuts and we only care about the ones
71 // created by us and not by the installer so |alternate| is false. 80 // created by us and not by the installer so |alternate| is false.
72 if (!ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER, false)) 81 if (!ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER, false))
73 LOG(INFO) << "Failed to delete desktop shortcut."; 82 LOG(INFO) << "Failed to delete desktop shortcut.";
74 if (!ShellUtil::RemoveChromeQuickLaunchShortcut(ShellUtil::CURRENT_USER)) 83 if (!ShellUtil::RemoveChromeQuickLaunchShortcut(ShellUtil::CURRENT_USER))
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 194 }
186 195
187 // We record in UMA the conditions that can prevent breakpad from generating 196 // We record in UMA the conditions that can prevent breakpad from generating
188 // and sending crash reports. Namely that the crash reporting registration 197 // and sending crash reports. Namely that the crash reporting registration
189 // failed and that the process is being debugged. 198 // failed and that the process is being debugged.
190 void RecordBreakpadStatusUMA(MetricsService* metrics) { 199 void RecordBreakpadStatusUMA(MetricsService* metrics) {
191 DWORD len = ::GetEnvironmentVariableW(env_vars::kNoOOBreakpad, NULL, 0); 200 DWORD len = ::GetEnvironmentVariableW(env_vars::kNoOOBreakpad, NULL, 0);
192 metrics->RecordBreakpadRegistration((len == 0)); 201 metrics->RecordBreakpadRegistration((len == 0));
193 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent()); 202 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent());
194 } 203 }
OLDNEW
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | chrome/browser/views/uninstall_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698