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

Unified Diff: chrome/browser/extensions/app_host/app_host_main.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: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/app_host/app_host_main.cc
diff --git a/chrome/browser/extensions/app_host/app_host_main.cc b/chrome/browser/extensions/app_host/app_host_main.cc
index 10d044a57cbf93c2e524ceead7b669a8763e726d..b10a20511e4df47d5d220c260c2d1680fbd8c765 100644
--- a/chrome/browser/extensions/app_host/app_host_main.cc
+++ b/chrome/browser/extensions/app_host/app_host_main.cc
@@ -7,6 +7,9 @@
#include "base/file_path.h"
#include "base/logging.h"
#include "base/process_util.h"
+#include "base/string16.h"
+#include "base/string_util.h"
+#include "base/version.h"
#include "chrome/browser/extensions/app_host/binaries_installer.h"
#include "chrome/installer/launcher_support/chrome_launcher_support.h"
@@ -38,13 +41,34 @@ int main(int /* argc */, char* /* argv[] */) {
chrome_exe_command_line.AppendArguments(
*CommandLine::ForCurrentProcess(), false);
- if (base::LaunchProcess(chrome_exe_command_line,
- base::LaunchOptions(),
- NULL)) {
+ // Launch Chrome before checking for updates, for faster user experience.
+ bool launch_result = base::LaunchProcess(chrome_exe_command_line,
+ base::LaunchOptions(),
+ NULL);
+ if (launch_result) {
LOG(INFO) << "Delegated to Chrome executable at " << chrome_exe.value();
- return 0;
} else {
LOG(INFO) << "Failed to launch Chrome executable at " << chrome_exe.value();
- return 1;
}
+
+ // Upgrade App Host if its version is less than CHrome Binary's.
erikwright (departed) 2012/09/12 15:53:50 CHrome -> Chrome
huangs 2012/09/12 19:24:27 Done.
+ string16 app_host_version_str;
+ string16 chrome_binaries_version_str;
+ if (chrome_launcher_support::GetAppHostVersionString(&app_host_version_str) &&
erikwright (departed) 2012/09/12 15:53:50 It seems to me these methods should do the convers
huangs 2012/09/12 19:24:27 Done.
+ chrome_launcher_support::GetAnyChromeBinariesVersionString(
erikwright (departed) 2012/09/12 15:53:50 All of this only applies if ChromeBinaries are at
huangs 2012/09/12 19:24:27 Done.
+ &chrome_binaries_version_str)) {
+ LOG(INFO) << "App Host version: " << app_host_version_str;
+ LOG(INFO) << "Chrome binaries version: " << chrome_binaries_version_str;
+ if (Version(WideToASCII(app_host_version_str)).IsOlderThan(
+ WideToASCII(chrome_binaries_version_str))) {
+ LOG(INFO) << "App Host out of date -- running setup.exe to upgrade";
+ if (!chrome_launcher_support::UpgradeAppHost()) {
+ LOG(INFO) << "Failed to upgrade App Host";
+ }
+ }
+ } else {
+ LOG(INFO) << "Failed to get the version for App Host or Chrome Binaries";
+ }
+
+ return launch_result ? 0 : 1;
}

Powered by Google App Engine
This is Rietveld 408576698