OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // The file contains the implementation of the mini_installer re-versioner. | 5 // The file contains the implementation of the mini_installer re-versioner. |
6 // The main function (GenerateNextVersion) does the following in a temp dir: | 6 // The main function (GenerateNextVersion) does the following in a temp dir: |
7 // - Extracts and unpacks setup.exe and the Chrome-bin folder from | 7 // - Extracts and unpacks setup.exe and the Chrome-bin folder from |
8 // mini_installer.exe. | 8 // mini_installer.exe. |
9 // - Inspects setup.exe to determine the current version. | 9 // - Inspects setup.exe to determine the current version. |
10 // - Runs through all .dll and .exe files: | 10 // - Runs through all .dll and .exe files: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // A helper class for manipulating a Chrome product version. | 104 // A helper class for manipulating a Chrome product version. |
105 class ChromeVersion { | 105 class ChromeVersion { |
106 public: | 106 public: |
107 static ChromeVersion FromHighLow(DWORD high, DWORD low) { | 107 static ChromeVersion FromHighLow(DWORD high, DWORD low) { |
108 return ChromeVersion(static_cast<ULONGLONG>(high) << 32 | | 108 return ChromeVersion(static_cast<ULONGLONG>(high) << 32 | |
109 static_cast<ULONGLONG>(low)); | 109 static_cast<ULONGLONG>(low)); |
110 } | 110 } |
111 static ChromeVersion FromString(const std::string& version_string) { | 111 static ChromeVersion FromString(const std::string& version_string) { |
112 Version version(version_string); | 112 Version version(version_string); |
113 DCHECK(version.IsValid()); | 113 DCHECK(version.IsValid()); |
114 const std::vector<uint16>& c(version.components()); | 114 const std::vector<uint32>& c(version.components()); |
115 return ChromeVersion(static_cast<ULONGLONG>(c[0]) << 48 | | 115 return ChromeVersion(static_cast<ULONGLONG>(c[0]) << 48 | |
116 static_cast<ULONGLONG>(c[1]) << 32 | | 116 static_cast<ULONGLONG>(c[1]) << 32 | |
117 static_cast<ULONGLONG>(c[2]) << 16 | | 117 static_cast<ULONGLONG>(c[2]) << 16 | |
118 static_cast<ULONGLONG>(c[3])); | 118 static_cast<ULONGLONG>(c[3])); |
119 } | 119 } |
120 | 120 |
121 ChromeVersion() { } | 121 ChromeVersion() { } |
122 explicit ChromeVersion(ULONGLONG value) : version_(value) { } | 122 explicit ChromeVersion(ULONGLONG value) : version_(value) { } |
123 WORD major() const { return static_cast<WORD>(version_ >> 48); } | 123 WORD major() const { return static_cast<WORD>(version_ >> 48); } |
124 WORD minor() const { return static_cast<WORD>(version_ >> 32); } | 124 WORD minor() const { return static_cast<WORD>(version_ >> 32); } |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 return false; | 691 return false; |
692 } | 692 } |
693 ctx.current_version_str = ctx.current_version.ToString(); | 693 ctx.current_version_str = ctx.current_version.ToString(); |
694 ctx.new_version = ChromeVersion::FromString(version.GetString()); | 694 ctx.new_version = ChromeVersion::FromString(version.GetString()); |
695 ctx.new_version_str = ctx.new_version.ToString(); | 695 ctx.new_version_str = ctx.new_version.ToString(); |
696 | 696 |
697 return UpdateVersionIfMatch(target_file, &ctx); | 697 return UpdateVersionIfMatch(target_file, &ctx); |
698 } | 698 } |
699 | 699 |
700 } // namespace upgrade_test | 700 } // namespace upgrade_test |
OLD | NEW |