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

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

Issue 14824006: Revert 198820 "Move FileEnumerator to its own file, do some refa..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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 // 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
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/files/file_enumerator.h"
14 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
15 #include "base/logging.h" 14 #include "base/logging.h"
16 #include "base/process_util.h" 15 #include "base/process_util.h"
17 #include "base/string_util.h" 16 #include "base/string_util.h"
18 #include "base/version.h" 17 #include "base/version.h"
19 #include "chrome/installer/util/copy_tree_work_item.h" 18 #include "chrome/installer/util/copy_tree_work_item.h"
20 #include "chrome/installer/util/installation_state.h" 19 #include "chrome/installer/util/installation_state.h"
21 #include "chrome/installer/util/installer_state.h" 20 #include "chrome/installer/util/installer_state.h"
22 #include "chrome/installer/util/master_preferences.h" 21 #include "chrome/installer/util/master_preferences.h"
23 #include "chrome/installer/util/util_constants.h" 22 #include "chrome/installer/util/util_constants.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (installer_state != NULL) 117 if (installer_state != NULL)
119 installer_state->UpdateStage(installer::BINARY_PATCHING); 118 installer_state->UpdateStage(installer::BINARY_PATCHING);
120 119
121 return ApplyBinaryPatch(src.value().c_str(), patch.value().c_str(), 120 return ApplyBinaryPatch(src.value().c_str(), patch.value().c_str(),
122 dest.value().c_str()); 121 dest.value().c_str());
123 } 122 }
124 123
125 Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path) { 124 Version* GetMaxVersionFromArchiveDir(const base::FilePath& chrome_path) {
126 VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value(); 125 VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value();
127 Version* version = NULL; 126 Version* version = NULL;
128 base::FileEnumerator version_enum(chrome_path, false, 127 file_util::FileEnumerator version_enum(chrome_path, false,
129 base::FileEnumerator::DIRECTORIES); 128 file_util::FileEnumerator::DIRECTORIES);
130 // TODO(tommi): The version directory really should match the version of 129 // TODO(tommi): The version directory really should match the version of
131 // setup.exe. To begin with, we should at least DCHECK that that's true. 130 // setup.exe. To begin with, we should at least DCHECK that that's true.
132 131
133 scoped_ptr<Version> max_version(new Version("0.0.0.0")); 132 scoped_ptr<Version> max_version(new Version("0.0.0.0"));
134 bool version_found = false; 133 bool version_found = false;
135 134
136 while (!version_enum.Next().empty()) { 135 while (!version_enum.Next().empty()) {
137 base::FileEnumerator::FileInfo find_data = version_enum.GetInfo(); 136 file_util::FileEnumerator::FindInfo find_data = {0};
138 VLOG(1) << "directory found: " << find_data.GetName().value(); 137 version_enum.GetFindInfo(&find_data);
138 VLOG(1) << "directory found: " << find_data.cFileName;
139 139
140 scoped_ptr<Version> found_version( 140 scoped_ptr<Version> found_version(
141 new Version(WideToASCII(find_data.GetName().value()))); 141 new Version(WideToASCII(find_data.cFileName)));
142 if (found_version->IsValid() && 142 if (found_version->IsValid() &&
143 found_version->CompareTo(*max_version.get()) > 0) { 143 found_version->CompareTo(*max_version.get()) > 0) {
144 max_version.reset(found_version.release()); 144 max_version.reset(found_version.release());
145 version_found = true; 145 version_found = true;
146 } 146 }
147 } 147 }
148 148
149 return (version_found ? max_version.release() : NULL); 149 return (version_found ? max_version.release() : NULL);
150 } 150 }
151 151
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 } 345 }
346 346
347 ScopedTokenPrivilege::~ScopedTokenPrivilege() { 347 ScopedTokenPrivilege::~ScopedTokenPrivilege() {
348 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { 348 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) {
349 ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_, 349 ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_,
350 sizeof(TOKEN_PRIVILEGES), NULL, NULL); 350 sizeof(TOKEN_PRIVILEGES), NULL, NULL);
351 } 351 }
352 } 352 }
353 353
354 } // namespace installer 354 } // namespace installer
OLDNEW
« no previous file with comments | « trunk/src/chrome/common/extensions/unpacker.cc ('k') | trunk/src/chrome/installer/setup/uninstall.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698