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

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: factored in gab's comments 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
« no previous file with comments | « chrome/installer/util/helper.h ('k') | chrome/installer/util/product.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) 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);
58 }
59 }
60 DCHECK(!paths->empty());
45 } 61 }
46 62
47 BrowserDistribution* GetBinariesDistribution(bool system_install) { 63 BrowserDistribution* GetBinariesDistribution(bool system_install) {
48 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 64 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
49 ProductState state; 65 ProductState state;
50 66
51 // If we're part of a multi-install, we need to poll using the multi-installer 67 // 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. 68 // 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 69 // If we can't read the app's state from the registry, assume it isn't
54 // multi-installed. 70 // multi-installed.
55 if (state.Initialize(system_install, dist) && state.is_multi_install()) { 71 if (state.Initialize(system_install, dist) && state.is_multi_install()) {
56 return BrowserDistribution::GetSpecificDistribution( 72 return BrowserDistribution::GetSpecificDistribution(
57 BrowserDistribution::CHROME_BINARIES); 73 BrowserDistribution::CHROME_BINARIES);
58 } else { 74 } else {
59 return dist; 75 return dist;
60 } 76 }
61 } 77 }
62 78
63 std::wstring GetAppGuidForUpdates(bool system_install) { 79 std::wstring GetAppGuidForUpdates(bool system_install) {
64 return GetBinariesDistribution(system_install)->GetAppGuid(); 80 return GetBinariesDistribution(system_install)->GetAppGuid();
65 } 81 }
66 82
67 } // namespace installer. 83 } // namespace installer.
OLDNEW
« no previous file with comments | « chrome/installer/util/helper.h ('k') | chrome/installer/util/product.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698