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

Side by Side Diff: chrome/browser/extensions/app_host/app_host_upgrade.cc

Issue 10905238: If Chrome Binaries version > App Host version, then update App Host. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Style issues; removing unneeded debug messages. Created 8 years, 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
grt (UTC plus 2) 2012/09/13 13:14:43 since this is in the app_host directory, does it n
erikwright (departed) 2012/09/13 13:48:26 I requested the file-name because of a possibly mi
huangs 2012/09/13 18:46:00 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/app_host/app_host_upgrade.h"
6
7 #include <windows.h>
8 #include "base/command_line.h"
9 #include "base/logging.h"
10 #include "base/process_util.h"
11 #include "base/string16.h"
12 #include "base/string_util.h"
13 #include "base/version.h"
14 #include "base/win/registry.h"
15 #include "chrome/installer/launcher_support/chrome_launcher_support.h"
16
17 namespace app_host {
18
19 namespace {
20
21 const wchar_t kGoogleRegClientsKey[] =
22 L"Software\\Google\\Update\\Clients\\";
grt (UTC plus 2) 2012/09/13 13:14:43 this fits on one line
huangs 2012/09/13 18:46:00 Done.
23
24 // Copied from util_constants.cc
grt (UTC plus 2) 2012/09/13 13:14:43 period at the end
huangs 2012/09/13 18:46:00 Done.
25 const char kMultiInstall[] = "multi-install";
26 const char kChromeAppHost[] = "app-host";
27 const char kVerboseLogging[] = "verbose-logging";
28
29 // Copied from google_update_constants.cc
grt (UTC plus 2) 2012/09/13 13:14:43 period at the end
huangs 2012/09/13 18:46:00 Done.
30 const wchar_t kRegVersionField[] = L"pv";
31
32 }
33
34 // Copied from chrome_appid.cc
grt (UTC plus 2) 2012/09/13 13:14:43 period at the end also, please file a bug to remov
erikwright (departed) 2012/09/13 13:48:26 I believe we have - perhaps just reference it here
huangs 2012/09/13 18:46:00 Done. It was filed as http://code.google.com/p/ch
35 const wchar_t kMultiInstallAppGuid[] =
36 L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}";
37 const wchar_t kChromeAppHostAppGuid[] =
38 L"{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}";
39
40 bool GetAppVersionForInstallationLevel(const wchar_t* app_guid,
41 bool system_level,
42 Version* version) {
43 HKEY root_key = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
44 string16 client_key(kGoogleRegClientsKey);
45 client_key.append(app_guid);
46 base::win::RegKey reg_key;
47 string16 version_str;
48 if ((reg_key.Open(root_key, client_key.c_str(), KEY_QUERY_VALUE) !=
grt (UTC plus 2) 2012/09/13 13:14:43 this is more readable if wrapped just before KEY_Q
huangs 2012/09/13 18:46:00 Done.
49 ERROR_SUCCESS) ||
50 (reg_key.ReadValue(kRegVersionField, &version_str) != ERROR_SUCCESS)) {
51 return false;
52 }
53 *version = Version(WideToASCII(version_str));
54 return version->IsValid();
55 }
56
57 bool UpgradeAppHost(bool system_level) {
huangs 2012/09/13 18:46:00 Removing redundant parameter, per discussion.
58 using namespace chrome_launcher_support;
grt (UTC plus 2) 2012/09/13 13:14:43 is this really needed to make the code below more
huangs 2012/09/13 18:46:00 Used to be used 3 times, now 2 times. So removing
59 // Get the path to the setup.exe.
60 FilePath setup_exe(GetSetupExeForInstallationLevel(
61 system_level ? SYSTEM_LEVEL_INSTALLATION : USER_LEVEL_INSTALLATION));
62 if (setup_exe.empty()) {
63 LOG(INFO) << "Failed to find setup.exe";
grt (UTC plus 2) 2012/09/13 13:14:43 INFO -> ERROR?
huangs 2012/09/13 18:46:00 Done.
64 return false;
65 }
66 CommandLine cmd_line(setup_exe);
67 cmd_line.AppendSwitch(kMultiInstall);
68 cmd_line.AppendSwitch(kChromeAppHost);
69 // TODO: Make --verbose-logging depend on setup arguments for the
grt (UTC plus 2) 2012/09/13 13:14:43 i pose that it's better to unconditionally add --v
huangs 2012/09/13 18:46:00 Removing comment.
70 // system-level Chrome Binaries.
71 cmd_line.AppendSwitch(kVerboseLogging);
72 LOG(INFO) << "Upgrading App Host using command line: " <<
grt (UTC plus 2) 2012/09/13 13:14:43 suggest: "Launching: "
huangs 2012/09/13 18:46:00 Done.
73 cmd_line.GetCommandLineString();
74 return base::LaunchProcess(cmd_line, base::LaunchOptions(), NULL);
75 }
76
77 } // namespace app_host
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698