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 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/cpu.h" | 12 #include "base/cpu.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/files/file_enumerator.h" | 14 #include "base/files/file_enumerator.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/process/kill.h" | 17 #include "base/process/kill.h" |
18 #include "base/process/launch.h" | 18 #include "base/process/launch.h" |
19 #include "base/process/process_handle.h" | 19 #include "base/process/process_handle.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/strings/utf_string_conversions.h" |
21 #include "base/version.h" | 22 #include "base/version.h" |
22 #include "base/win/registry.h" | 23 #include "base/win/registry.h" |
23 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
24 #include "chrome/installer/setup/setup_constants.h" | 25 #include "chrome/installer/setup/setup_constants.h" |
25 #include "chrome/installer/util/copy_tree_work_item.h" | 26 #include "chrome/installer/util/copy_tree_work_item.h" |
26 #include "chrome/installer/util/google_update_constants.h" | 27 #include "chrome/installer/util/google_update_constants.h" |
27 #include "chrome/installer/util/installation_state.h" | 28 #include "chrome/installer/util/installation_state.h" |
28 #include "chrome/installer/util/installer_state.h" | 29 #include "chrome/installer/util/installer_state.h" |
29 #include "chrome/installer/util/master_preferences.h" | 30 #include "chrome/installer/util/master_preferences.h" |
30 #include "chrome/installer/util/util_constants.h" | 31 #include "chrome/installer/util/util_constants.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // setup.exe. To begin with, we should at least DCHECK that that's true. | 149 // setup.exe. To begin with, we should at least DCHECK that that's true. |
149 | 150 |
150 scoped_ptr<Version> max_version(new Version("0.0.0.0")); | 151 scoped_ptr<Version> max_version(new Version("0.0.0.0")); |
151 bool version_found = false; | 152 bool version_found = false; |
152 | 153 |
153 while (!version_enum.Next().empty()) { | 154 while (!version_enum.Next().empty()) { |
154 base::FileEnumerator::FileInfo find_data = version_enum.GetInfo(); | 155 base::FileEnumerator::FileInfo find_data = version_enum.GetInfo(); |
155 VLOG(1) << "directory found: " << find_data.GetName().value(); | 156 VLOG(1) << "directory found: " << find_data.GetName().value(); |
156 | 157 |
157 scoped_ptr<Version> found_version( | 158 scoped_ptr<Version> found_version( |
158 new Version(WideToASCII(find_data.GetName().value()))); | 159 new Version(base::UTF16ToASCII(find_data.GetName().value()))); |
159 if (found_version->IsValid() && | 160 if (found_version->IsValid() && |
160 found_version->CompareTo(*max_version.get()) > 0) { | 161 found_version->CompareTo(*max_version.get()) > 0) { |
161 max_version.reset(found_version.release()); | 162 max_version.reset(found_version.release()); |
162 version_found = true; | 163 version_found = true; |
163 } | 164 } |
164 } | 165 } |
165 | 166 |
166 return (version_found ? max_version.release() : NULL); | 167 return (version_found ? max_version.release() : NULL); |
167 } | 168 } |
168 | 169 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 } | 489 } |
489 | 490 |
490 ScopedTokenPrivilege::~ScopedTokenPrivilege() { | 491 ScopedTokenPrivilege::~ScopedTokenPrivilege() { |
491 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { | 492 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { |
492 ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_, | 493 ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_, |
493 sizeof(TOKEN_PRIVILEGES), NULL, NULL); | 494 sizeof(TOKEN_PRIVILEGES), NULL, NULL); |
494 } | 495 } |
495 } | 496 } |
496 | 497 |
497 } // namespace installer | 498 } // namespace installer |
OLD | NEW |