| 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 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 422 |
| 423 bool IsUninstallSuccess(InstallStatus install_status) { | 423 bool IsUninstallSuccess(InstallStatus install_status) { |
| 424 // The following status values represent failed uninstalls: | 424 // The following status values represent failed uninstalls: |
| 425 // 15: CHROME_NOT_INSTALLED | 425 // 15: CHROME_NOT_INSTALLED |
| 426 // 20: UNINSTALL_FAILED | 426 // 20: UNINSTALL_FAILED |
| 427 // 21: UNINSTALL_CANCELLED | 427 // 21: UNINSTALL_CANCELLED |
| 428 return (install_status == UNINSTALL_SUCCESSFUL || | 428 return (install_status == UNINSTALL_SUCCESSFUL || |
| 429 install_status == UNINSTALL_REQUIRES_REBOOT); | 429 install_status == UNINSTALL_REQUIRES_REBOOT); |
| 430 } | 430 } |
| 431 | 431 |
| 432 bool ContainsUnsupportedSwitch(const CommandLine& cmd_line) { |
| 433 static const char* const kLegacySwitches[] = { |
| 434 // Chrome Frame ready-mode. |
| 435 "ready-mode", |
| 436 "ready-mode-opt-in", |
| 437 "ready-mode-temp-opt-out", |
| 438 "ready-mode-end-temp-opt-out", |
| 439 // Chrome Frame quick-enable. |
| 440 "quick-enable-cf", |
| 441 // Installation of Chrome Frame. |
| 442 "chrome-frame", |
| 443 "migrate-chrome-frame", |
| 444 }; |
| 445 for (size_t i = 0; i < arraysize(kLegacySwitches); ++i) { |
| 446 if (cmd_line.HasSwitch(kLegacySwitches[i])) |
| 447 return true; |
| 448 } |
| 449 return false; |
| 450 } |
| 451 |
| 432 ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) | 452 ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) |
| 433 : is_enabled_(false) { | 453 : is_enabled_(false) { |
| 434 HANDLE temp_handle; | 454 HANDLE temp_handle; |
| 435 if (!::OpenProcessToken(::GetCurrentProcess(), | 455 if (!::OpenProcessToken(::GetCurrentProcess(), |
| 436 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, | 456 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, |
| 437 &temp_handle)) { | 457 &temp_handle)) { |
| 438 return; | 458 return; |
| 439 } | 459 } |
| 440 token_.Set(temp_handle); | 460 token_.Set(temp_handle); |
| 441 | 461 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 463 } | 483 } |
| 464 | 484 |
| 465 ScopedTokenPrivilege::~ScopedTokenPrivilege() { | 485 ScopedTokenPrivilege::~ScopedTokenPrivilege() { |
| 466 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { | 486 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { |
| 467 ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_, | 487 ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_, |
| 468 sizeof(TOKEN_PRIVILEGES), NULL, NULL); | 488 sizeof(TOKEN_PRIVILEGES), NULL, NULL); |
| 469 } | 489 } |
| 470 } | 490 } |
| 471 | 491 |
| 472 } // namespace installer | 492 } // namespace installer |
| OLD | NEW |