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

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

Issue 1301883002: Revert of base: Remove using:: declaration from version.h header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 patch_status + kBsdiffErrorOffset : 0; 135 patch_status + kBsdiffErrorOffset : 0;
136 136
137 LOG_IF(ERROR, exit_code) 137 LOG_IF(ERROR, exit_code)
138 << "Failed to apply bsdiff patch " << patch.value() 138 << "Failed to apply bsdiff patch " << patch.value()
139 << " to file " << src.value() << " and generating file " << dest.value() 139 << " to file " << src.value() << " and generating file " << dest.value()
140 << ". err=" << exit_code; 140 << ". err=" << exit_code;
141 141
142 return exit_code; 142 return exit_code;
143 } 143 }
144 144
145 base::Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path) { 145 Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path) {
146 VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value(); 146 VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value();
147 base::FileEnumerator version_enum(chrome_path, false, 147 base::FileEnumerator version_enum(chrome_path, false,
148 base::FileEnumerator::DIRECTORIES); 148 base::FileEnumerator::DIRECTORIES);
149 // TODO(tommi): The version directory really should match the version of 149 // TODO(tommi): The version directory really should match the version of
150 // setup.exe. To begin with, we should at least DCHECK that that's true. 150 // setup.exe. To begin with, we should at least DCHECK that that's true.
151 151
152 scoped_ptr<base::Version> max_version(new base::Version("0.0.0.0")); 152 scoped_ptr<Version> max_version(new Version("0.0.0.0"));
153 bool version_found = false; 153 bool version_found = false;
154 154
155 while (!version_enum.Next().empty()) { 155 while (!version_enum.Next().empty()) {
156 base::FileEnumerator::FileInfo find_data = version_enum.GetInfo(); 156 base::FileEnumerator::FileInfo find_data = version_enum.GetInfo();
157 VLOG(1) << "directory found: " << find_data.GetName().value(); 157 VLOG(1) << "directory found: " << find_data.GetName().value();
158 158
159 scoped_ptr<base::Version> found_version( 159 scoped_ptr<Version> found_version(
160 new base::Version(base::UTF16ToASCII(find_data.GetName().value()))); 160 new Version(base::UTF16ToASCII(find_data.GetName().value())));
161 if (found_version->IsValid() && 161 if (found_version->IsValid() &&
162 found_version->CompareTo(*max_version.get()) > 0) { 162 found_version->CompareTo(*max_version.get()) > 0) {
163 max_version.reset(found_version.release()); 163 max_version.reset(found_version.release());
164 version_found = true; 164 version_found = true;
165 } 165 }
166 } 166 }
167 167
168 return (version_found ? max_version.release() : NULL); 168 return (version_found ? max_version.release() : NULL);
169 } 169 }
170 170
(...skipping 12 matching lines...) Expand all
183 base::FilePath patch_source; 183 base::FilePath patch_source;
184 const ProductState* product = 184 const ProductState* product =
185 original_state.GetProductState(installer_state.system_install(), 185 original_state.GetProductState(installer_state.system_install(),
186 installer_state.state_type()); 186 installer_state.state_type());
187 if (product) { 187 if (product) {
188 patch_source = installer_state.GetInstallerDirectory(product->version()) 188 patch_source = installer_state.GetInstallerDirectory(product->version())
189 .Append(installer::kChromeArchive); 189 .Append(installer::kChromeArchive);
190 if (base::PathExists(patch_source)) 190 if (base::PathExists(patch_source))
191 return patch_source; 191 return patch_source;
192 } 192 }
193 scoped_ptr<base::Version> version( 193 scoped_ptr<Version> version(
194 installer::GetMaxVersionFromArchiveDir(installer_state.target_path())); 194 installer::GetMaxVersionFromArchiveDir(installer_state.target_path()));
195 if (version) { 195 if (version) {
196 patch_source = installer_state.GetInstallerDirectory(*version) 196 patch_source = installer_state.GetInstallerDirectory(*version)
197 .Append(installer::kChromeArchive); 197 .Append(installer::kChromeArchive);
198 if (base::PathExists(patch_source)) 198 if (base::PathExists(patch_source))
199 return patch_source; 199 return patch_source;
200 } 200 }
201 return base::FilePath(); 201 return base::FilePath();
202 } 202 }
203 203
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 ::CloseHandle(pi.hThread); 256 ::CloseHandle(pi.hThread);
257 ::CloseHandle(pi.hProcess); 257 ::CloseHandle(pi.hProcess);
258 } 258 }
259 259
260 return ok != FALSE; 260 return ok != FALSE;
261 } 261 }
262 262
263 bool GetExistingHigherInstaller( 263 bool GetExistingHigherInstaller(
264 const InstallationState& original_state, 264 const InstallationState& original_state,
265 bool system_install, 265 bool system_install,
266 const base::Version& installer_version, 266 const Version& installer_version,
267 base::FilePath* setup_exe) { 267 base::FilePath* setup_exe) {
268 DCHECK(setup_exe); 268 DCHECK(setup_exe);
269 bool trying_single_browser = false; 269 bool trying_single_browser = false;
270 const ProductState* existing_state = 270 const ProductState* existing_state =
271 original_state.GetProductState(system_install, 271 original_state.GetProductState(system_install,
272 BrowserDistribution::CHROME_BINARIES); 272 BrowserDistribution::CHROME_BINARIES);
273 if (!existing_state) { 273 if (!existing_state) {
274 // The binaries aren't installed, but perhaps a single-install Chrome is. 274 // The binaries aren't installed, but perhaps a single-install Chrome is.
275 trying_single_browser = true; 275 trying_single_browser = true;
276 existing_state = 276 existing_state =
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } 513 }
514 514
515 ScopedTokenPrivilege::~ScopedTokenPrivilege() { 515 ScopedTokenPrivilege::~ScopedTokenPrivilege() {
516 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { 516 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) {
517 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, 517 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_,
518 sizeof(TOKEN_PRIVILEGES), NULL, NULL); 518 sizeof(TOKEN_PRIVILEGES), NULL, NULL);
519 } 519 }
520 } 520 }
521 521
522 } // namespace installer 522 } // 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