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

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: Renamed app_host_upgrade.* to update.*; changed how App Host version is obtained; moved code to upd… 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/version.h"
huangs 2012/09/13 22:25:37 Oops, this snuck in. Deleting.
10 #include "chrome/browser/extensions/app_host/binaries_installer.h" 11 #include "chrome/browser/extensions/app_host/binaries_installer.h"
12 #include "chrome/browser/extensions/app_host/update.h"
11 #include "chrome/installer/launcher_support/chrome_launcher_support.h" 13 #include "chrome/installer/launcher_support/chrome_launcher_support.h"
12 14
13 int main(int /* argc */, char* /* argv[] */) { 15 int main(int /* argc */, char* /* argv[] */) {
16 using namespace app_host;
17 using namespace chrome_launcher_support;
erikwright (departed) 2012/09/13 19:27:49 It seems these are no longer high-value as the two
huangs 2012/09/13 22:25:37 Done.
14 base::AtExitManager exit_manager; 18 base::AtExitManager exit_manager;
15 19
16 // Initialize the commandline singleton from the environment. 20 // Initialize the commandline singleton from the environment.
17 CommandLine::Init(0, NULL); 21 CommandLine::Init(0, NULL);
18 22
19 FilePath chrome_exe(chrome_launcher_support::GetAnyChromePath()); 23 FilePath chrome_exe(GetAnyChromePath());
20 24
21 if (chrome_exe.empty()) { 25 if (chrome_exe.empty()) {
22 LOG(INFO) << "No Chrome executable could be found. Let's install it."; 26 LOG(INFO) << "No Chrome executable could be found. Let's install it.";
23 HRESULT hr = app_host::InstallBinaries(); 27 HRESULT hr = app_host::InstallBinaries();
24 if (FAILED(hr)) { 28 if (FAILED(hr)) {
25 LOG(ERROR) << "Failed to install the Chrome Binaries. Error: " << hr; 29 LOG(ERROR) << "Failed to install the Chrome Binaries. Error: " << hr;
26 return 1; 30 return 1;
27 } else { 31 } else {
28 chrome_exe = chrome_launcher_support::GetAnyChromePath(); 32 chrome_exe = GetAnyChromePath();
29 if (chrome_exe.empty()) { 33 if (chrome_exe.empty()) {
30 LOG(ERROR) << "Failed to find the Chrome Binaries despite a " 34 LOG(ERROR) << "Failed to find the Chrome Binaries despite a "
31 << "'successful' installation."; 35 << "'successful' installation.";
32 return 1; 36 return 1;
33 } 37 }
34 } 38 }
35 } 39 }
36 40
37 CommandLine chrome_exe_command_line(chrome_exe); 41 CommandLine chrome_exe_command_line(chrome_exe);
38 chrome_exe_command_line.AppendArguments( 42 chrome_exe_command_line.AppendArguments(
39 *CommandLine::ForCurrentProcess(), false); 43 *CommandLine::ForCurrentProcess(), false);
40 44
41 if (base::LaunchProcess(chrome_exe_command_line, 45 // Launch Chrome before checking for update, for faster user experience.
42 base::LaunchOptions(), 46 bool launch_result = base::LaunchProcess(chrome_exe_command_line,
43 NULL)) { 47 base::LaunchOptions(),
48 NULL);
grt (UTC plus 2) 2012/09/13 20:04:12 nit: move this to the previous line
huangs 2012/09/13 22:25:37 Done.
49 if (launch_result)
44 LOG(INFO) << "Delegated to Chrome executable at " << chrome_exe.value(); 50 LOG(INFO) << "Delegated to Chrome executable at " << chrome_exe.value();
45 return 0; 51 else
46 } else {
47 LOG(INFO) << "Failed to launch Chrome executable at " << chrome_exe.value(); 52 LOG(INFO) << "Failed to launch Chrome executable at " << chrome_exe.value();
48 return 1; 53
49 } 54 EnsureAppHostUpToDate();
55
56 return !launch_result;
50 } 57 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/app_host/update.h » ('j') | chrome/browser/extensions/app_host/update.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698