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

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

Issue 62097: On uninstall ask whether to delete profile. (Closed)
Patch Set: run message loop. Created 11 years, 8 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/browser_views.vcproj » ('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) 2006-2008 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/common/win_util.h" 5 #include "chrome/common/win_util.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "chrome/browser/browser_main_win.h" 10 #include "chrome/browser/browser_main_win.h"
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/win_util.h" 14 #include "base/win_util.h"
15 #include "chrome/browser/first_run.h" 15 #include "chrome/browser/first_run.h"
16 #include "chrome/browser/metrics/metrics_service.h" 16 #include "chrome/browser/metrics/metrics_service.h"
17 #include "chrome/browser/views/uninstall_dialog.h"
17 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/env_vars.h" 19 #include "chrome/common/env_vars.h"
19 #include "chrome/common/l10n_util.h" 20 #include "chrome/common/l10n_util.h"
21 #include "chrome/common/message_box_flags.h"
20 #include "chrome/common/result_codes.h" 22 #include "chrome/common/result_codes.h"
21 #include "chrome/installer/util/helper.h" 23 #include "chrome/installer/util/helper.h"
22 #include "chrome/installer/util/install_util.h" 24 #include "chrome/installer/util/install_util.h"
23 #include "chrome/installer/util/shell_util.h" 25 #include "chrome/installer/util/shell_util.h"
26 #include "chrome/views/controls/message_box_view.h"
27 #include "chrome/views/widget/accelerator_handler.h"
28 #include "chrome/views/window/window.h"
24 #include "grit/chromium_strings.h" 29 #include "grit/chromium_strings.h"
25 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
26 31
27 // Displays a warning message if the user is running chrome on windows 2000. 32 // Displays a warning message if the user is running chrome on windows 2000.
28 // Returns true if the OS is win2000, false otherwise. 33 // Returns true if the OS is win2000, false otherwise.
29 bool CheckForWin2000() { 34 bool CheckForWin2000() {
30 if (win_util::GetWinVersion() == win_util::WINVERSION_2000) { 35 if (win_util::GetWinVersion() == win_util::WINVERSION_2000) {
31 const std::wstring text = l10n_util::GetString(IDS_UNSUPPORTED_OS_WIN2000); 36 const std::wstring text = l10n_util::GetString(IDS_UNSUPPORTED_OS_WIN2000);
32 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); 37 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
33 win_util::MessageBox(NULL, text, caption, 38 win_util::MessageBox(NULL, text, caption,
34 MB_OK | MB_ICONWARNING | MB_TOPMOST); 39 MB_OK | MB_ICONWARNING | MB_TOPMOST);
35 return true; 40 return true;
36 } 41 }
37 return false; 42 return false;
38 } 43 }
39 44
40 bool AskForUninstallConfirmation() { 45 int AskForUninstallConfirmation() {
41 const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_VERIFY); 46 int ret = ResultCodes::NORMAL_EXIT;
42 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); 47 UninstallDialog::ShowUninstallDialog(ret);
43 const UINT flags = MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST; 48 MessageLoop::current()->Run();
44 return (IDOK == win_util::MessageBox(NULL, text, caption, flags)); 49 return ret;
45 } 50 }
46 51
47 void ShowCloseBrowserFirstMessageBox() { 52 void ShowCloseBrowserFirstMessageBox() {
48 const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_CLOSE_APP); 53 const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_CLOSE_APP);
49 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); 54 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
50 const UINT flags = MB_OK | MB_ICONWARNING | MB_TOPMOST; 55 const UINT flags = MB_OK | MB_ICONWARNING | MB_TOPMOST;
51 win_util::MessageBox(NULL, text, caption, flags); 56 win_util::MessageBox(NULL, text, caption, flags);
52 } 57 }
53 58
54 int DoUninstallTasks(bool chrome_still_running) { 59 int DoUninstallTasks(bool chrome_still_running) {
55 if (chrome_still_running) { 60 if (chrome_still_running) {
56 ShowCloseBrowserFirstMessageBox(); 61 ShowCloseBrowserFirstMessageBox();
57 return ResultCodes::UNINSTALL_CHROME_ALIVE; 62 return ResultCodes::UNINSTALL_CHROME_ALIVE;
58 } 63 }
59 if (!AskForUninstallConfirmation()) 64 int ret = AskForUninstallConfirmation();
60 return ResultCodes::UNINSTALL_USER_CANCEL; 65 if (ret != ResultCodes::UNINSTALL_USER_CANCEL) {
61 // The following actions are just best effort. 66 // The following actions are just best effort.
62 LOG(INFO) << "Executing uninstall actions"; 67 LOG(INFO) << "Executing uninstall actions";
63 ResultCodes::ExitCode ret = ResultCodes::NORMAL_EXIT; 68 if (!FirstRun::RemoveSentinel())
64 if (!FirstRun::RemoveSentinel()) 69 LOG(INFO) << "Failed to delete sentinel file.";
Ben Goodger (Google) 2009/04/17 00:59:03 did you mean to leave these in?
65 ret = ResultCodes::UNINSTALL_DELETE_FILE_ERROR; 70 // We want to remove user level shortcuts and we only care about the ones
66 // 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.
67 // created by us and not by the installer so |alternate| is false. 72 if (!ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER, false))
68 if (!ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER, false)) 73 LOG(INFO) << "Failed to delete desktop shortcut.";
69 ret = ResultCodes::UNINSTALL_DELETE_FILE_ERROR; 74 if (!ShellUtil::RemoveChromeQuickLaunchShortcut(ShellUtil::CURRENT_USER))
70 if (!ShellUtil::RemoveChromeQuickLaunchShortcut(ShellUtil::CURRENT_USER)) 75 LOG(INFO) << "Failed to delete quick launch shortcut.";
71 ret = ResultCodes::UNINSTALL_DELETE_FILE_ERROR; 76 }
72 return ret; 77 return ret;
73 } 78 }
74 79
75 // Prepares the localized strings that are going to be displayed to 80 // Prepares the localized strings that are going to be displayed to
76 // the user if the browser process dies. These strings are stored in the 81 // the user if the browser process dies. These strings are stored in the
77 // environment block so they are accessible in the early stages of the 82 // environment block so they are accessible in the early stages of the
78 // chrome executable's lifetime. 83 // chrome executable's lifetime.
79 void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { 84 void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) {
80 // Clear this var so child processes don't show the dialog by default. 85 // Clear this var so child processes don't show the dialog by default.
81 ::SetEnvironmentVariableW(env_vars::kShowRestart, NULL); 86 ::SetEnvironmentVariableW(env_vars::kShowRestart, NULL);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 185 }
181 186
182 // We record in UMA the conditions that can prevent breakpad from generating 187 // We record in UMA the conditions that can prevent breakpad from generating
183 // and sending crash reports. Namely that the crash reporting registration 188 // and sending crash reports. Namely that the crash reporting registration
184 // failed and that the process is being debugged. 189 // failed and that the process is being debugged.
185 void RecordBreakpadStatusUMA(MetricsService* metrics) { 190 void RecordBreakpadStatusUMA(MetricsService* metrics) {
186 DWORD len = ::GetEnvironmentVariableW(env_vars::kNoOOBreakpad, NULL, 0); 191 DWORD len = ::GetEnvironmentVariableW(env_vars::kNoOOBreakpad, NULL, 0);
187 metrics->RecordBreakpadRegistration((len == 0)); 192 metrics->RecordBreakpadRegistration((len == 0));
188 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent()); 193 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent());
189 } 194 }
OLDNEW
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | chrome/browser/views/browser_views.vcproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698