Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: chrome/browser/first_run/upgrade_util_win.cc

Issue 129003003: Remove support for specifying version on command line. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to r244153 Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/client_util.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return false; 218 return false;
219 219
220 // Open up the registry key containing current version and rename information. 220 // Open up the registry key containing current version and rename information.
221 bool user_install = 221 bool user_install =
222 InstallUtil::IsPerUserInstall(cur_chrome_exe.value().c_str()); 222 InstallUtil::IsPerUserInstall(cur_chrome_exe.value().c_str());
223 HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; 223 HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
224 BrowserDistribution *dist = BrowserDistribution::GetDistribution(); 224 BrowserDistribution *dist = BrowserDistribution::GetDistribution();
225 base::win::RegKey key; 225 base::win::RegKey key;
226 if (key.Open(reg_root, dist->GetVersionKey().c_str(), 226 if (key.Open(reg_root, dist->GetVersionKey().c_str(),
227 KEY_QUERY_VALUE) == ERROR_SUCCESS) { 227 KEY_QUERY_VALUE) == ERROR_SUCCESS) {
228
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
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
233 // DLL component is loaded.
234 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
235 if (cmd_line.HasSwitch(switches::kChromeVersion)) {
236 std::string version_string =
237 cmd_line.GetSwitchValueASCII(switches::kChromeVersion);
238 Version cmd_version(version_string);
239
240 std::wstring pv_value;
241 if (key.ReadValue(google_update::kRegVersionField,
242 &pv_value) == ERROR_SUCCESS) {
243 Version pv_version(WideToASCII(pv_value));
244 if (cmd_version.IsValid() && pv_version.IsValid() &&
245 !cmd_version.Equals(pv_version)) {
246 return false;
247 }
248 }
249 }
250
251 // First try to rename exe by launching rename command ourselves. 228 // First try to rename exe by launching rename command ourselves.
252 std::wstring rename_cmd; 229 std::wstring rename_cmd;
253 if (key.ReadValue(google_update::kRegRenameCmdField, 230 if (key.ReadValue(google_update::kRegRenameCmdField,
254 &rename_cmd) == ERROR_SUCCESS) { 231 &rename_cmd) == ERROR_SUCCESS) {
255 base::win::ScopedHandle handle; 232 base::win::ScopedHandle handle;
256 base::LaunchOptions options; 233 base::LaunchOptions options;
257 options.wait = true; 234 options.wait = true;
258 options.start_hidden = true; 235 options.start_hidden = true;
259 if (base::LaunchProcess(rename_cmd, options, &handle)) { 236 if (base::LaunchProcess(rename_cmd, options, &handle)) {
260 DWORD exit_code; 237 DWORD exit_code;
(...skipping 18 matching lines...) Expand all
279 return false; 256 return false;
280 // At this point the chrome.exe has been swapped with the new one. 257 // At this point the chrome.exe has been swapped with the new one.
281 if (!RelaunchChromeBrowser(command_line)) { 258 if (!RelaunchChromeBrowser(command_line)) {
282 // The re-launch fails. Feel free to panic now. 259 // The re-launch fails. Feel free to panic now.
283 NOTREACHED(); 260 NOTREACHED();
284 } 261 }
285 return true; 262 return true;
286 } 263 }
287 264
288 } // namespace upgrade_util 265 } // namespace upgrade_util
OLDNEW
« no previous file with comments | « chrome/app/client_util.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698