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> |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 if (desired_version.IsValid()) { | 358 if (desired_version.IsValid()) { |
359 base::FilePath archive(installer_state.GetInstallerDirectory( | 359 base::FilePath archive(installer_state.GetInstallerDirectory( |
360 desired_version).Append(kChromeArchive)); | 360 desired_version).Append(kChromeArchive)); |
361 return base::PathExists(archive) ? archive : base::FilePath(); | 361 return base::PathExists(archive) ? archive : base::FilePath(); |
362 } | 362 } |
363 | 363 |
364 // Check based on the version number advertised to Google Update, since that | 364 // Check based on the version number advertised to Google Update, since that |
365 // is the value used to select a specific differential update. If an archive | 365 // is the value used to select a specific differential update. If an archive |
366 // can't be found using that, fallback to using the newest version present. | 366 // can't be found using that, fallback to using the newest version present. |
367 base::FilePath patch_source; | 367 base::FilePath patch_source; |
368 const ProductState* product = original_state.GetProductState( | 368 const ProductState* product = |
369 installer_state.system_install(), BrowserDistribution::CHROME_BROWSER); | 369 original_state.GetProductState(installer_state.system_install()); |
370 if (product) { | 370 if (product) { |
371 patch_source = installer_state.GetInstallerDirectory(product->version()) | 371 patch_source = installer_state.GetInstallerDirectory(product->version()) |
372 .Append(installer::kChromeArchive); | 372 .Append(installer::kChromeArchive); |
373 if (base::PathExists(patch_source)) | 373 if (base::PathExists(patch_source)) |
374 return patch_source; | 374 return patch_source; |
375 } | 375 } |
376 std::unique_ptr<base::Version> version( | 376 std::unique_ptr<base::Version> version( |
377 installer::GetMaxVersionFromArchiveDir(installer_state.target_path())); | 377 installer::GetMaxVersionFromArchiveDir(installer_state.target_path())); |
378 if (version) { | 378 if (version) { |
379 patch_source = installer_state.GetInstallerDirectory(*version) | 379 patch_source = installer_state.GetInstallerDirectory(*version) |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 } | 852 } |
853 | 853 |
854 ScopedTokenPrivilege::~ScopedTokenPrivilege() { | 854 ScopedTokenPrivilege::~ScopedTokenPrivilege() { |
855 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { | 855 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { |
856 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, | 856 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, |
857 sizeof(TOKEN_PRIVILEGES), NULL, NULL); | 857 sizeof(TOKEN_PRIVILEGES), NULL, NULL); |
858 } | 858 } |
859 } | 859 } |
860 | 860 |
861 } // namespace installer | 861 } // namespace installer |
OLD | NEW |