| 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 | |
| 452 ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) | 432 ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) |
| 453 : is_enabled_(false) { | 433 : is_enabled_(false) { |
| 454 HANDLE temp_handle; | 434 HANDLE temp_handle; |
| 455 if (!::OpenProcessToken(::GetCurrentProcess(), | 435 if (!::OpenProcessToken(::GetCurrentProcess(), |
| 456 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, | 436 TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, |
| 457 &temp_handle)) { | 437 &temp_handle)) { |
| 458 return; | 438 return; |
| 459 } | 439 } |
| 460 token_.Set(temp_handle); | 440 token_.Set(temp_handle); |
| 461 | 441 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 483 } | 463 } |
| 484 | 464 |
| 485 ScopedTokenPrivilege::~ScopedTokenPrivilege() { | 465 ScopedTokenPrivilege::~ScopedTokenPrivilege() { |
| 486 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { | 466 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { |
| 487 ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_, | 467 ::AdjustTokenPrivileges(token_, FALSE, &previous_privileges_, |
| 488 sizeof(TOKEN_PRIVILEGES), NULL, NULL); | 468 sizeof(TOKEN_PRIVILEGES), NULL, NULL); |
| 489 } | 469 } |
| 490 } | 470 } |
| 491 | 471 |
| 492 } // namespace installer | 472 } // namespace installer |
| OLD | NEW |