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/file_util.h" | 13 #include "base/file_util.h" |
13 #include "base/files/file_enumerator.h" | 14 #include "base/files/file_enumerator.h" |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/process/kill.h" | 17 #include "base/process/kill.h" |
17 #include "base/process/launch.h" | 18 #include "base/process/launch.h" |
18 #include "base/process/process_handle.h" | 19 #include "base/process/process_handle.h" |
19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
20 #include "base/version.h" | 21 #include "base/version.h" |
21 #include "base/win/registry.h" | 22 #include "base/win/registry.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 "chrome-frame", | 443 "chrome-frame", |
443 "migrate-chrome-frame", | 444 "migrate-chrome-frame", |
444 }; | 445 }; |
445 for (size_t i = 0; i < arraysize(kLegacySwitches); ++i) { | 446 for (size_t i = 0; i < arraysize(kLegacySwitches); ++i) { |
446 if (cmd_line.HasSwitch(kLegacySwitches[i])) | 447 if (cmd_line.HasSwitch(kLegacySwitches[i])) |
447 return true; | 448 return true; |
448 } | 449 } |
449 return false; | 450 return false; |
450 } | 451 } |
451 | 452 |
| 453 bool IsProcessorSupported() { |
| 454 return base::CPU().has_sse2(); |
| 455 } |
| 456 |
452 ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) | 457 ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) |
453 : is_enabled_(false) { | 458 : is_enabled_(false) { |
454 HANDLE temp_handle; | 459 HANDLE temp_handle; |
455 if (!::OpenProcessToken(::GetCurrentProcess(), | 460 if (!::OpenProcessToken(::GetCurrentProcess(), |
456 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, | 461 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, |
457 &temp_handle)) { | 462 &temp_handle)) { |
458 return; | 463 return; |
459 } | 464 } |
460 token_.Set(temp_handle); | 465 token_.Set(temp_handle); |
461 | 466 |
(...skipping 21 matching lines...) Expand all Loading... |
483 } | 488 } |
484 | 489 |
485 ScopedTokenPrivilege::~ScopedTokenPrivilege() { | 490 ScopedTokenPrivilege::~ScopedTokenPrivilege() { |
486 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { | 491 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { |
487 ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_, | 492 ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_, |
488 sizeof(TOKEN_PRIVILEGES), NULL, NULL); | 493 sizeof(TOKEN_PRIVILEGES), NULL, NULL); |
489 } | 494 } |
490 } | 495 } |
491 | 496 |
492 } // namespace installer | 497 } // namespace installer |
OLD | NEW |