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

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

Issue 218683013: Remove stale code to delete the metro user data dir. It never shipped. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gab comments Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 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/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.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"
12 #include "chrome/installer/util/browser_distribution.h" 10 #include "chrome/installer/util/browser_distribution.h"
13 #include "chrome/installer/util/install_util.h" 11 #include "chrome/installer/util/install_util.h"
14 #include "chrome/installer/util/installation_state.h" 12 #include "chrome/installer/util/installation_state.h"
15 #include "chrome/installer/util/util_constants.h" 13 #include "chrome/installer/util/util_constants.h"
16 14
17 namespace { 15 namespace {
18 16
19 base::FilePath GetChromeInstallBasePath(bool system, 17 base::FilePath GetChromeInstallBasePath(bool system,
20 BrowserDistribution* distribution, 18 BrowserDistribution* distribution,
21 const wchar_t* sub_path) { 19 const wchar_t* sub_path) {
(...skipping 14 matching lines...) Expand all
36 34
37 } // namespace 35 } // namespace
38 36
39 namespace installer { 37 namespace installer {
40 38
41 base::FilePath GetChromeInstallPath(bool system_install, 39 base::FilePath GetChromeInstallPath(bool system_install,
42 BrowserDistribution* dist) { 40 BrowserDistribution* dist) {
43 return GetChromeInstallBasePath(system_install, dist, kInstallBinaryDir); 41 return GetChromeInstallBasePath(system_install, dist, kInstallBinaryDir);
44 } 42 }
45 43
46 // TODO(gab): Cleanup this method (kMetroChromeUserDataSubDir is deprecated). 44 base::FilePath GetChromeUserDataPath(BrowserDistribution* dist) {
47 void GetChromeUserDataPaths(BrowserDistribution* dist, 45 return GetChromeInstallBasePath(false, dist, kInstallUserDataDir);
48 std::vector<base::FilePath>* paths) {
49 const bool has_metro_data =
50 base::win::GetVersion() >= base::win::VERSION_WIN8 &&
51 dist->GetDefaultBrowserControlPolicy() !=
52 BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED;
53
54 base::FilePath data_dir(GetChromeInstallBasePath(false, dist,
55 kInstallUserDataDir));
56 if (data_dir.empty()) {
57 paths->clear();
58 } else {
59 paths->resize(has_metro_data ? 2 : 1);
60 (*paths)[0] = data_dir;
61 if (has_metro_data) {
62 (*paths)[1] = data_dir.DirName().Append(
63 chrome::kMetroChromeUserDataSubDir);
64 }
65 }
66 DCHECK(!paths->empty());
67 } 46 }
68 47
69 BrowserDistribution* GetBinariesDistribution(bool system_install) { 48 BrowserDistribution* GetBinariesDistribution(bool system_install) {
70 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 49 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
71 ProductState state; 50 ProductState state;
72 51
73 // If we're part of a multi-install, we need to poll using the multi-installer 52 // If we're part of a multi-install, we need to poll using the multi-installer
74 // package's app guid rather than the browser's or Chrome Frame's app guid. 53 // package's app guid rather than the browser's or Chrome Frame's app guid.
75 // If we can't read the app's state from the registry, assume it isn't 54 // If we can't read the app's state from the registry, assume it isn't
76 // multi-installed. 55 // multi-installed.
77 if (state.Initialize(system_install, dist) && state.is_multi_install()) { 56 if (state.Initialize(system_install, dist) && state.is_multi_install()) {
78 return BrowserDistribution::GetSpecificDistribution( 57 return BrowserDistribution::GetSpecificDistribution(
79 BrowserDistribution::CHROME_BINARIES); 58 BrowserDistribution::CHROME_BINARIES);
80 } else { 59 } else {
81 return dist; 60 return dist;
82 } 61 }
83 } 62 }
84 63
85 std::wstring GetAppGuidForUpdates(bool system_install) { 64 std::wstring GetAppGuidForUpdates(bool system_install) {
86 return GetBinariesDistribution(system_install)->GetAppGuid(); 65 return GetBinariesDistribution(system_install)->GetAppGuid();
87 } 66 }
88 67
89 } // namespace installer. 68 } // namespace installer.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698