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

Side by Side Diff: chrome/installer/util/helper.cc

Issue 10826144: Delete both regular and Metro user data dirs on uninstall. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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/installer/util/helper.h" 5 #include "chrome/installer/util/helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/win/windows_version.h"
11 #include "chrome/common/chrome_constants.h"
10 #include "chrome/installer/util/browser_distribution.h" 12 #include "chrome/installer/util/browser_distribution.h"
11 #include "chrome/installer/util/installation_state.h" 13 #include "chrome/installer/util/installation_state.h"
12 #include "chrome/installer/util/install_util.h" 14 #include "chrome/installer/util/install_util.h"
13 #include "chrome/installer/util/util_constants.h" 15 #include "chrome/installer/util/util_constants.h"
14 16
15 namespace { 17 namespace {
16 18
17 FilePath GetChromeInstallBasePath(bool system, 19 FilePath GetChromeInstallBasePath(bool system,
18 BrowserDistribution* distribution, 20 BrowserDistribution* distribution,
19 const wchar_t* sub_path) { 21 const wchar_t* sub_path) {
(...skipping 13 matching lines...) Expand all
33 } 35 }
34 36
35 } // namespace 37 } // namespace
36 38
37 namespace installer { 39 namespace installer {
38 40
39 FilePath GetChromeInstallPath(bool system_install, BrowserDistribution* dist) { 41 FilePath GetChromeInstallPath(bool system_install, BrowserDistribution* dist) {
40 return GetChromeInstallBasePath(system_install, dist, kInstallBinaryDir); 42 return GetChromeInstallBasePath(system_install, dist, kInstallBinaryDir);
41 } 43 }
42 44
43 FilePath GetChromeUserDataPath(BrowserDistribution* dist) { 45 void GetChromeUserDataPaths(BrowserDistribution* dist,
44 return GetChromeInstallBasePath(false, dist, kInstallUserDataDir); 46 std::vector<FilePath>* paths) {
47 const bool has_metro_data = dist->CanSetAsDefault() &&
48 base::win::GetVersion() >= base::win::VERSION_WIN8;
49 FilePath data_dir(GetChromeInstallBasePath(false, dist, kInstallUserDataDir));
50 if (data_dir.empty()) {
51 paths->clear();
52 } else {
53 paths->resize(has_metro_data ? 2 : 1);
54 (*paths)[0] = data_dir;
55 if (has_metro_data) {
56 (*paths)[1] = data_dir.DirName().Append(
57 chrome::kMetroChromeUserDataSubDir);
gab 2012/08/03 17:54:20 We do not want installer_util to depend on chrome
grt (UTC plus 2) 2012/08/03 20:18:37 not done. this is in common_constants, which inst
gab 2012/08/03 21:58:57 Ah I see, chrome common constants != chrome :). T
58 }
59 }
45 } 60 }
46 61
47 BrowserDistribution* GetBinariesDistribution(bool system_install) { 62 BrowserDistribution* GetBinariesDistribution(bool system_install) {
48 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 63 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
49 ProductState state; 64 ProductState state;
50 65
51 // If we're part of a multi-install, we need to poll using the multi-installer 66 // If we're part of a multi-install, we need to poll using the multi-installer
52 // package's app guid rather than the browser's or Chrome Frame's app guid. 67 // package's app guid rather than the browser's or Chrome Frame's app guid.
53 // If we can't read the app's state from the registry, assume it isn't 68 // If we can't read the app's state from the registry, assume it isn't
54 // multi-installed. 69 // multi-installed.
55 if (state.Initialize(system_install, dist) && state.is_multi_install()) { 70 if (state.Initialize(system_install, dist) && state.is_multi_install()) {
56 return BrowserDistribution::GetSpecificDistribution( 71 return BrowserDistribution::GetSpecificDistribution(
57 BrowserDistribution::CHROME_BINARIES); 72 BrowserDistribution::CHROME_BINARIES);
58 } else { 73 } else {
59 return dist; 74 return dist;
60 } 75 }
61 } 76 }
62 77
63 std::wstring GetAppGuidForUpdates(bool system_install) { 78 std::wstring GetAppGuidForUpdates(bool system_install) {
64 return GetBinariesDistribution(system_install)->GetAppGuid(); 79 return GetBinariesDistribution(system_install)->GetAppGuid();
65 } 80 }
66 81
67 } // namespace installer. 82 } // namespace installer.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698