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 #include "chrome/browser/first_run/upgrade_util.h" | 5 #include "chrome/browser/first_run/upgrade_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 // Having just ascertained that we can swap, now check that we should: if | 229 // Having just ascertained that we can swap, now check that we should: if |
230 // we are given an explicit --chrome-version flag, don't rename unless the | 230 // we are given an explicit --chrome-version flag, don't rename unless the |
231 // specified version matches the "pv" value. In practice, this is used to | 231 // specified version matches the "pv" value. In practice, this is used to |
232 // defer Chrome Frame updates until the current version of the Chrome Frame | 232 // defer Chrome Frame updates until the current version of the Chrome Frame |
233 // DLL component is loaded. | 233 // DLL component is loaded. |
234 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | 234 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); |
235 if (cmd_line.HasSwitch(switches::kChromeVersion)) { | 235 if (cmd_line.HasSwitch(switches::kChromeVersion)) { |
236 std::string version_string = | 236 std::string version_string = |
237 cmd_line.GetSwitchValueASCII(switches::kChromeVersion); | 237 cmd_line.GetSwitchValueASCII(switches::kChromeVersion); |
238 base::Version cmd_version(version_string); | 238 Version cmd_version(version_string); |
239 | 239 |
240 std::wstring pv_value; | 240 std::wstring pv_value; |
241 if (key.ReadValue(google_update::kRegVersionField, | 241 if (key.ReadValue(google_update::kRegVersionField, |
242 &pv_value) == ERROR_SUCCESS) { | 242 &pv_value) == ERROR_SUCCESS) { |
243 base::Version pv_version(WideToASCII(pv_value)); | 243 Version pv_version(WideToASCII(pv_value)); |
244 if (cmd_version.IsValid() && pv_version.IsValid() && | 244 if (cmd_version.IsValid() && pv_version.IsValid() && |
245 !cmd_version.Equals(pv_version)) { | 245 !cmd_version.Equals(pv_version)) { |
246 return false; | 246 return false; |
247 } | 247 } |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 // First try to rename exe by launching rename command ourselves. | 251 // First try to rename exe by launching rename command ourselves. |
252 std::wstring rename_cmd; | 252 std::wstring rename_cmd; |
253 if (key.ReadValue(google_update::kRegRenameCmdField, | 253 if (key.ReadValue(google_update::kRegRenameCmdField, |
(...skipping 25 matching lines...) Expand all Loading... |
279 return false; | 279 return false; |
280 // At this point the chrome.exe has been swapped with the new one. | 280 // At this point the chrome.exe has been swapped with the new one. |
281 if (!RelaunchChromeBrowser(command_line)) { | 281 if (!RelaunchChromeBrowser(command_line)) { |
282 // The re-launch fails. Feel free to panic now. | 282 // The re-launch fails. Feel free to panic now. |
283 NOTREACHED(); | 283 NOTREACHED(); |
284 } | 284 } |
285 return true; | 285 return true; |
286 } | 286 } |
287 | 287 |
288 } // namespace upgrade_util | 288 } // namespace upgrade_util |
OLD | NEW |