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

Side by Side 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 unified diff | Download patch
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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/string16.h"
11 #include "base/string_util.h"
12 #include "base/version.h"
10 #include "chrome/browser/extensions/app_host/binaries_installer.h" 13 #include "chrome/browser/extensions/app_host/binaries_installer.h"
11 #include "chrome/installer/launcher_support/chrome_launcher_support.h" 14 #include "chrome/installer/launcher_support/chrome_launcher_support.h"
12 15
13 int main(int /* argc */, char* /* argv[] */) { 16 int main(int /* argc */, char* /* argv[] */) {
14 base::AtExitManager exit_manager; 17 base::AtExitManager exit_manager;
15 18
16 // Initialize the commandline singleton from the environment. 19 // Initialize the commandline singleton from the environment.
17 CommandLine::Init(0, NULL); 20 CommandLine::Init(0, NULL);
18 21
19 FilePath chrome_exe(chrome_launcher_support::GetAnyChromePath()); 22 FilePath chrome_exe(chrome_launcher_support::GetAnyChromePath());
(...skipping 11 matching lines...) Expand all
31 << "'successful' installation."; 34 << "'successful' installation.";
32 return 1; 35 return 1;
33 } 36 }
34 } 37 }
35 } 38 }
36 39
37 CommandLine chrome_exe_command_line(chrome_exe); 40 CommandLine chrome_exe_command_line(chrome_exe);
38 chrome_exe_command_line.AppendArguments( 41 chrome_exe_command_line.AppendArguments(
39 *CommandLine::ForCurrentProcess(), false); 42 *CommandLine::ForCurrentProcess(), false);
40 43
41 if (base::LaunchProcess(chrome_exe_command_line, 44 // Launch Chrome before checking for updates, for faster user experience.
42 base::LaunchOptions(), 45 bool launch_result = base::LaunchProcess(chrome_exe_command_line,
43 NULL)) { 46 base::LaunchOptions(),
47 NULL);
48 if (launch_result) {
44 LOG(INFO) << "Delegated to Chrome executable at " << chrome_exe.value(); 49 LOG(INFO) << "Delegated to Chrome executable at " << chrome_exe.value();
45 return 0;
46 } else { 50 } else {
47 LOG(INFO) << "Failed to launch Chrome executable at " << chrome_exe.value(); 51 LOG(INFO) << "Failed to launch Chrome executable at " << chrome_exe.value();
48 return 1;
49 } 52 }
53
54 // 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.
55 string16 app_host_version_str;
56 string16 chrome_binaries_version_str;
57 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.
58 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.
59 &chrome_binaries_version_str)) {
60 LOG(INFO) << "App Host version: " << app_host_version_str;
61 LOG(INFO) << "Chrome binaries version: " << chrome_binaries_version_str;
62 if (Version(WideToASCII(app_host_version_str)).IsOlderThan(
63 WideToASCII(chrome_binaries_version_str))) {
64 LOG(INFO) << "App Host out of date -- running setup.exe to upgrade";
65 if (!chrome_launcher_support::UpgradeAppHost()) {
66 LOG(INFO) << "Failed to upgrade App Host";
67 }
68 }
69 } else {
70 LOG(INFO) << "Failed to get the version for App Host or Chrome Binaries";
71 }
72
73 return launch_result ? 0 : 1;
50 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698