| OLD | NEW |
| 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> |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <initializer_list> | 13 #include <initializer_list> |
| 14 #include <iterator> | 14 #include <iterator> |
| 15 #include <limits> | 15 #include <limits> |
| 16 #include <set> | 16 #include <set> |
| 17 #include <string> | 17 #include <string> |
| 18 #include <utility> |
| 18 | 19 |
| 19 #include "base/bind.h" | 20 #include "base/bind.h" |
| 20 #include "base/command_line.h" | 21 #include "base/command_line.h" |
| 21 #include "base/cpu.h" | 22 #include "base/cpu.h" |
| 22 #include "base/files/file_enumerator.h" | 23 #include "base/files/file_enumerator.h" |
| 23 #include "base/files/file_path.h" | 24 #include "base/files/file_path.h" |
| 24 #include "base/files/file_util.h" | 25 #include "base/files/file_util.h" |
| 25 #include "base/logging.h" | 26 #include "base/logging.h" |
| 26 #include "base/macros.h" | 27 #include "base/macros.h" |
| 27 #include "base/memory/ptr_util.h" | 28 #include "base/memory/ptr_util.h" |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 bool version_found = false; | 329 bool version_found = false; |
| 329 | 330 |
| 330 while (!version_enum.Next().empty()) { | 331 while (!version_enum.Next().empty()) { |
| 331 base::FileEnumerator::FileInfo find_data = version_enum.GetInfo(); | 332 base::FileEnumerator::FileInfo find_data = version_enum.GetInfo(); |
| 332 VLOG(1) << "directory found: " << find_data.GetName().value(); | 333 VLOG(1) << "directory found: " << find_data.GetName().value(); |
| 333 | 334 |
| 334 std::unique_ptr<base::Version> found_version( | 335 std::unique_ptr<base::Version> found_version( |
| 335 new base::Version(base::UTF16ToASCII(find_data.GetName().value()))); | 336 new base::Version(base::UTF16ToASCII(find_data.GetName().value()))); |
| 336 if (found_version->IsValid() && | 337 if (found_version->IsValid() && |
| 337 found_version->CompareTo(*max_version.get()) > 0) { | 338 found_version->CompareTo(*max_version.get()) > 0) { |
| 338 max_version.reset(found_version.release()); | 339 max_version = std::move(found_version); |
| 339 version_found = true; | 340 version_found = true; |
| 340 } | 341 } |
| 341 } | 342 } |
| 342 | 343 |
| 343 return (version_found ? max_version.release() : NULL); | 344 return (version_found ? max_version.release() : NULL); |
| 344 } | 345 } |
| 345 | 346 |
| 346 base::FilePath FindArchiveToPatch(const InstallationState& original_state, | 347 base::FilePath FindArchiveToPatch(const InstallationState& original_state, |
| 347 const InstallerState& installer_state, | 348 const InstallerState& installer_state, |
| 348 const base::Version& desired_version) { | 349 const base::Version& desired_version) { |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 } | 846 } |
| 846 | 847 |
| 847 ScopedTokenPrivilege::~ScopedTokenPrivilege() { | 848 ScopedTokenPrivilege::~ScopedTokenPrivilege() { |
| 848 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { | 849 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { |
| 849 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, | 850 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, |
| 850 sizeof(TOKEN_PRIVILEGES), NULL, NULL); | 851 sizeof(TOKEN_PRIVILEGES), NULL, NULL); |
| 851 } | 852 } |
| 852 } | 853 } |
| 853 | 854 |
| 854 } // namespace installer | 855 } // namespace installer |
| OLD | NEW |