| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/environment.h" | 13 #include "base/environment.h" |
| 14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/scoped_native_library.h" | 17 #include "base/scoped_native_library.h" |
| 18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
| 21 #include "base/win/wrapped_window_proc.h" | 21 #include "base/win/wrapped_window_proc.h" |
| 22 #include "chrome/browser/browser_util_win.h" | 22 #include "chrome/browser/browser_util_win.h" |
| 23 #include "chrome/browser/first_run/first_run.h" | 23 #include "chrome/browser/first_run/first_run.h" |
| 24 #include "chrome/browser/metrics/metrics_service.h" | 24 #include "chrome/browser/metrics/metrics_service.h" |
| 25 #include "chrome/browser/profiles/profile_info_cache.h" |
| 26 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" |
| 25 #include "chrome/browser/ui/browser_list.h" | 27 #include "chrome/browser/ui/browser_list.h" |
| 26 #include "chrome/browser/ui/views/uninstall_view.h" | 28 #include "chrome/browser/ui/views/uninstall_view.h" |
| 27 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
| 28 #include "chrome/common/chrome_result_codes.h" | 30 #include "chrome/common/chrome_result_codes.h" |
| 29 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/env_vars.h" | 32 #include "chrome/common/env_vars.h" |
| 31 #include "chrome/installer/util/browser_distribution.h" | 33 #include "chrome/installer/util/browser_distribution.h" |
| 32 #include "chrome/installer/util/helper.h" | 34 #include "chrome/installer/util/helper.h" |
| 33 #include "chrome/installer/util/install_util.h" | 35 #include "chrome/installer/util/install_util.h" |
| 34 #include "chrome/installer/util/shell_util.h" | 36 #include "chrome/installer/util/shell_util.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 136 |
| 135 if (ret != chrome::RESULT_CODE_UNINSTALL_USER_CANCEL) { | 137 if (ret != chrome::RESULT_CODE_UNINSTALL_USER_CANCEL) { |
| 136 // The following actions are just best effort. | 138 // The following actions are just best effort. |
| 137 VLOG(1) << "Executing uninstall actions"; | 139 VLOG(1) << "Executing uninstall actions"; |
| 138 if (!FirstRun::RemoveSentinel()) | 140 if (!FirstRun::RemoveSentinel()) |
| 139 VLOG(1) << "Failed to delete sentinel file."; | 141 VLOG(1) << "Failed to delete sentinel file."; |
| 140 // We want to remove user level shortcuts and we only care about the ones | 142 // We want to remove user level shortcuts and we only care about the ones |
| 141 // created by us and not by the installer so |alternate| is false. | 143 // created by us and not by the installer so |alternate| is false. |
| 142 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 144 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 143 if (!ShellUtil::RemoveChromeDesktopShortcut(dist, ShellUtil::CURRENT_USER, | 145 if (!ShellUtil::RemoveChromeDesktopShortcut(dist, ShellUtil::CURRENT_USER, |
| 144 false)) | 146 false)) { |
| 145 VLOG(1) << "Failed to delete desktop shortcut."; | 147 VLOG(1) << "Failed to delete desktop shortcut."; |
| 148 } |
| 149 if (!ShellUtil::RemoveChromeDesktopShortcutsWithAppendedNames( |
| 150 ProfileShortcutManagerWin::GenerateShortcutsFromProfiles( |
| 151 ProfileInfoCache::GetProfileNames()))) { |
| 152 VLOG(1) << "Failed to delete desktop profiles shortcuts."; |
| 153 } |
| 146 if (!ShellUtil::RemoveChromeQuickLaunchShortcut(dist, | 154 if (!ShellUtil::RemoveChromeQuickLaunchShortcut(dist, |
| 147 ShellUtil::CURRENT_USER)) | 155 ShellUtil::CURRENT_USER)) { |
| 148 VLOG(1) << "Failed to delete quick launch shortcut."; | 156 VLOG(1) << "Failed to delete quick launch shortcut."; |
| 157 } |
| 149 } | 158 } |
| 150 return ret; | 159 return ret; |
| 151 } | 160 } |
| 152 | 161 |
| 153 // ChromeBrowserMainPartsWin --------------------------------------------------- | 162 // ChromeBrowserMainPartsWin --------------------------------------------------- |
| 154 | 163 |
| 155 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( | 164 ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( |
| 156 const content::MainFunctionParams& parameters) | 165 const content::MainFunctionParams& parameters) |
| 157 : ChromeBrowserMainParts(parameters) { | 166 : ChromeBrowserMainParts(parameters) { |
| 158 } | 167 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); | 303 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); |
| 295 uninstall_cmd.AppendSwitch( | 304 uninstall_cmd.AppendSwitch( |
| 296 installer::switches::kDoNotRemoveSharedItems); | 305 installer::switches::kDoNotRemoveSharedItems); |
| 297 base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL); | 306 base::LaunchProcess(uninstall_cmd, base::LaunchOptions(), NULL); |
| 298 } | 307 } |
| 299 return true; | 308 return true; |
| 300 } | 309 } |
| 301 } | 310 } |
| 302 return false; | 311 return false; |
| 303 } | 312 } |
| OLD | NEW |