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

Side by Side Diff: chrome/installer/setup/setup_util.cc

Issue 2258243002: Consistently use namespaced base::Version in chrome/installer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « chrome/installer/setup/setup_util.h ('k') | chrome/installer/setup/setup_util_unittest.cc » ('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) 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 // This file declares util functions for setup project. 5 // This file declares util functions for setup project.
6 6
7 #include "chrome/installer/setup/setup_util.h" 7 #include "chrome/installer/setup/setup_util.h"
8 8
9 #include <windows.h> 9 #include <windows.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 patch_status + kBsdiffErrorOffset : 0; 153 patch_status + kBsdiffErrorOffset : 0;
154 154
155 LOG_IF(ERROR, exit_code) 155 LOG_IF(ERROR, exit_code)
156 << "Failed to apply bsdiff patch " << patch.value() 156 << "Failed to apply bsdiff patch " << patch.value()
157 << " to file " << src.value() << " and generating file " << dest.value() 157 << " to file " << src.value() << " and generating file " << dest.value()
158 << ". err=" << exit_code; 158 << ". err=" << exit_code;
159 159
160 return exit_code; 160 return exit_code;
161 } 161 }
162 162
163 Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path) { 163 base::Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path) {
164 VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value(); 164 VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value();
165 base::FileEnumerator version_enum(chrome_path, false, 165 base::FileEnumerator version_enum(chrome_path, false,
166 base::FileEnumerator::DIRECTORIES); 166 base::FileEnumerator::DIRECTORIES);
167 // TODO(tommi): The version directory really should match the version of 167 // TODO(tommi): The version directory really should match the version of
168 // setup.exe. To begin with, we should at least DCHECK that that's true. 168 // setup.exe. To begin with, we should at least DCHECK that that's true.
169 169
170 std::unique_ptr<Version> max_version(new Version("0.0.0.0")); 170 std::unique_ptr<base::Version> max_version(new base::Version("0.0.0.0"));
171 bool version_found = false; 171 bool version_found = false;
172 172
173 while (!version_enum.Next().empty()) { 173 while (!version_enum.Next().empty()) {
174 base::FileEnumerator::FileInfo find_data = version_enum.GetInfo(); 174 base::FileEnumerator::FileInfo find_data = version_enum.GetInfo();
175 VLOG(1) << "directory found: " << find_data.GetName().value(); 175 VLOG(1) << "directory found: " << find_data.GetName().value();
176 176
177 std::unique_ptr<Version> found_version( 177 std::unique_ptr<base::Version> found_version(
178 new Version(base::UTF16ToASCII(find_data.GetName().value()))); 178 new base::Version(base::UTF16ToASCII(find_data.GetName().value())));
179 if (found_version->IsValid() && 179 if (found_version->IsValid() &&
180 found_version->CompareTo(*max_version.get()) > 0) { 180 found_version->CompareTo(*max_version.get()) > 0) {
181 max_version.reset(found_version.release()); 181 max_version.reset(found_version.release());
182 version_found = true; 182 version_found = true;
183 } 183 }
184 } 184 }
185 185
186 return (version_found ? max_version.release() : NULL); 186 return (version_found ? max_version.release() : NULL);
187 } 187 }
188 188
(...skipping 12 matching lines...) Expand all
201 base::FilePath patch_source; 201 base::FilePath patch_source;
202 const ProductState* product = 202 const ProductState* product =
203 original_state.GetProductState(installer_state.system_install(), 203 original_state.GetProductState(installer_state.system_install(),
204 installer_state.state_type()); 204 installer_state.state_type());
205 if (product) { 205 if (product) {
206 patch_source = installer_state.GetInstallerDirectory(product->version()) 206 patch_source = installer_state.GetInstallerDirectory(product->version())
207 .Append(installer::kChromeArchive); 207 .Append(installer::kChromeArchive);
208 if (base::PathExists(patch_source)) 208 if (base::PathExists(patch_source))
209 return patch_source; 209 return patch_source;
210 } 210 }
211 std::unique_ptr<Version> version( 211 std::unique_ptr<base::Version> version(
212 installer::GetMaxVersionFromArchiveDir(installer_state.target_path())); 212 installer::GetMaxVersionFromArchiveDir(installer_state.target_path()));
213 if (version) { 213 if (version) {
214 patch_source = installer_state.GetInstallerDirectory(*version) 214 patch_source = installer_state.GetInstallerDirectory(*version)
215 .Append(installer::kChromeArchive); 215 .Append(installer::kChromeArchive);
216 if (base::PathExists(patch_source)) 216 if (base::PathExists(patch_source))
217 return patch_source; 217 return patch_source;
218 } 218 }
219 return base::FilePath(); 219 return base::FilePath();
220 } 220 }
221 221
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } 659 }
660 660
661 ScopedTokenPrivilege::~ScopedTokenPrivilege() { 661 ScopedTokenPrivilege::~ScopedTokenPrivilege() {
662 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { 662 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) {
663 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, 663 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_,
664 sizeof(TOKEN_PRIVILEGES), NULL, NULL); 664 sizeof(TOKEN_PRIVILEGES), NULL, NULL);
665 } 665 }
666 } 666 }
667 667
668 } // namespace installer 668 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/setup_util.h ('k') | chrome/installer/setup/setup_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698