| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // DLL component is loaded. | 203 // DLL component is loaded. |
| 204 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | 204 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); |
| 205 if (cmd_line.HasSwitch(switches::kChromeVersion)) { | 205 if (cmd_line.HasSwitch(switches::kChromeVersion)) { |
| 206 std::string version_string = | 206 std::string version_string = |
| 207 cmd_line.GetSwitchValueASCII(switches::kChromeVersion); | 207 cmd_line.GetSwitchValueASCII(switches::kChromeVersion); |
| 208 Version cmd_version(version_string); | 208 Version cmd_version(version_string); |
| 209 | 209 |
| 210 std::wstring pv_value; | 210 std::wstring pv_value; |
| 211 if (key.ReadValue(google_update::kRegVersionField, | 211 if (key.ReadValue(google_update::kRegVersionField, |
| 212 &pv_value) == ERROR_SUCCESS) { | 212 &pv_value) == ERROR_SUCCESS) { |
| 213 Version pv_version(WideToASCII(pv_value)); | 213 Version pv_version(base::WideToASCII(pv_value)); |
| 214 if (cmd_version.IsValid() && pv_version.IsValid() && | 214 if (cmd_version.IsValid() && pv_version.IsValid() && |
| 215 !cmd_version.Equals(pv_version)) { | 215 !cmd_version.Equals(pv_version)) { |
| 216 return false; | 216 return false; |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 // First try to rename exe by launching rename command ourselves. | 221 // First try to rename exe by launching rename command ourselves. |
| 222 std::wstring rename_cmd; | 222 std::wstring rename_cmd; |
| 223 if (key.ReadValue(google_update::kRegRenameCmdField, | 223 if (key.ReadValue(google_update::kRegRenameCmdField, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 250 return false; | 250 return false; |
| 251 // At this point the chrome.exe has been swapped with the new one. | 251 // At this point the chrome.exe has been swapped with the new one. |
| 252 if (!RelaunchChromeBrowser(command_line)) { | 252 if (!RelaunchChromeBrowser(command_line)) { |
| 253 // The re-launch fails. Feel free to panic now. | 253 // The re-launch fails. Feel free to panic now. |
| 254 NOTREACHED(); | 254 NOTREACHED(); |
| 255 } | 255 } |
| 256 return true; | 256 return true; |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace upgrade_util | 259 } // namespace upgrade_util |
| OLD | NEW |