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

Side by Side Diff: chrome/install_static/product_install_details.cc

Issue 2601443002: Remove multi-install from install_static. (Closed)
Patch Set: huangs comments Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/install_static/product_install_details.h" 5 #include "chrome/install_static/product_install_details.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <assert.h> 8 #include <assert.h>
huangs 2017/01/03 05:35:14 Can remove <assert.h>?
grt (UTC plus 2) 2017/01/03 15:47:57 Done.
9 9
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "chrome/install_static/install_details.h" 12 #include "chrome/install_static/install_details.h"
13 #include "chrome/install_static/install_modes.h" 13 #include "chrome/install_static/install_modes.h"
14 #include "chrome/install_static/install_util.h" 14 #include "chrome/install_static/install_util.h"
15 #include "chrome_elf/nt_registry/nt_registry.h" 15 #include "chrome_elf/nt_registry/nt_registry.h"
16 16
17 namespace install_static { 17 namespace install_static {
18 18
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // Check for a match of the product directory name. 112 // Check for a match of the product directory name.
113 if (_wcsnicmp(&*name, kProductPathName, kProductPathNameLength)) 113 if (_wcsnicmp(&*name, kProductPathName, kProductPathNameLength))
114 return std::wstring(); 114 return std::wstring();
115 115
116 // Return the (possibly empty) suffix betwixt the product name and install 116 // Return the (possibly empty) suffix betwixt the product name and install
117 // binary dir. 117 // binary dir.
118 return std::wstring(&*(name - kProductPathNameLength), 118 return std::wstring(&*(name - kProductPathNameLength),
119 (name - scan) - kProductPathNameLength); 119 (name - scan) - kProductPathNameLength);
120 } 120 }
121 121
122 bool IsMultiInstall(const InstallConstants& mode, bool system_level) {
123 assert(mode.supports_multi_install);
124 std::wstring args;
125 return nt::QueryRegValueSZ(system_level ? nt::HKLM : nt::HKCU, nt::WOW6432,
126 GetClientStateKeyPath(mode.app_guid).c_str(),
127 L"UninstallArguments", &args) &&
128 args.find(L"--multi-install") != std::wstring::npos;
129 }
130
131 std::unique_ptr<PrimaryInstallDetails> MakeProductDetails( 122 std::unique_ptr<PrimaryInstallDetails> MakeProductDetails(
132 const std::wstring& exe_path) { 123 const std::wstring& exe_path) {
133 std::unique_ptr<PrimaryInstallDetails> details(new PrimaryInstallDetails()); 124 std::unique_ptr<PrimaryInstallDetails> details(new PrimaryInstallDetails());
134 125
135 const InstallConstants* mode = FindInstallMode(GetInstallSuffix(exe_path)); 126 const InstallConstants* mode = FindInstallMode(GetInstallSuffix(exe_path));
136 const bool system_level = 127 const bool system_level =
137 mode->supports_system_level && PathIsInProgramFiles(exe_path); 128 mode->supports_system_level && PathIsInProgramFiles(exe_path);
138 const bool multi_install =
139 mode->supports_multi_install && IsMultiInstall(*mode, system_level);
140 129
141 details->set_mode(mode); 130 details->set_mode(mode);
142 details->set_system_level(system_level); 131 details->set_system_level(system_level);
143 details->set_multi_install(multi_install); 132 details->set_channel(DetermineChannel(*mode, system_level));
144 details->set_channel(DetermineChannel(*mode, system_level, multi_install));
145 133
146 return details; 134 return details;
147 } 135 }
148 136
149 } // namespace install_static 137 } // namespace install_static
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698