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

Side by Side Diff: chrome/app_installer/win/app_installer_main.cc

Issue 685103004: Refactor chrome_launcher_support::GetAnyChromePath. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix app_installer compile. Created 5 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
« no previous file with comments | « no previous file | chrome/app_installer/win/app_installer_util.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <windows.h> 5 #include <windows.h>
6 #include <initguid.h> 6 #include <initguid.h>
7 7
8 #include "base/at_exit.h" 8 #include "base/at_exit.h"
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/i18n/streaming_utf8_validator.h" 12 #include "base/i18n/streaming_utf8_validator.h"
13 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/logging_win.h" 15 #include "base/logging_win.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/process/launch.h" 17 #include "base/process/launch.h"
18 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "chrome/app_installer/win/app_installer_util.h" 20 #include "chrome/app_installer/win/app_installer_util.h"
21 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/chrome_version_info.h" 22 #include "chrome/common/chrome_version_info.h"
23 #include "chrome/installer/launcher_support/chrome_launcher_support.h"
23 #include "chrome/installer/util/util_constants.h" 24 #include "chrome/installer/util/util_constants.h"
24 #include "content/public/common/user_agent.h" 25 #include "content/public/common/user_agent.h"
25 26
26 namespace app_installer { 27 namespace app_installer {
27 28
28 namespace { 29 namespace {
29 30
30 // Log provider UUID. Required for logging to Sawbuck. 31 // Log provider UUID. Required for logging to Sawbuck.
31 // {d82c3b59-bacd-4625-8282-4d570c4dad12} 32 // {d82c3b59-bacd-4625-8282-4d570c4dad12}
32 DEFINE_GUID(kAppInstallerLogProvider, 33 DEFINE_GUID(kAppInstallerLogProvider,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Parse the data to check it's valid JSON. The download page will just eval 115 // Parse the data to check it's valid JSON. The download page will just eval
115 // it. 116 // it.
116 base::JSONReader json_reader; 117 base::JSONReader json_reader;
117 scoped_ptr<base::Value> inline_install_data( 118 scoped_ptr<base::Value> inline_install_data(
118 json_reader.ReadToValue(inline_install_json)); 119 json_reader.ReadToValue(inline_install_json));
119 if (!inline_install_data) { 120 if (!inline_install_data) {
120 LOG(ERROR) << json_reader.GetErrorMessage(); 121 LOG(ERROR) << json_reader.GetErrorMessage();
121 return COULD_NOT_PARSE_INLINE_INSTALL_DATA; 122 return COULD_NOT_PARSE_INLINE_INSTALL_DATA;
122 } 123 }
123 124
124 base::FilePath chrome_path = GetChromeExePath(is_canary); 125 base::FilePath chrome_path =
126 chrome_launcher_support::GetAnyChromePath(is_canary);
125 // If none found, show EULA, download, and install Chrome. 127 // If none found, show EULA, download, and install Chrome.
126 if (chrome_path.empty()) { 128 if (chrome_path.empty()) {
127 ExitCode get_chrome_result = GetChrome(is_canary, inline_install_json); 129 ExitCode get_chrome_result = GetChrome(is_canary, inline_install_json);
128 if (get_chrome_result != SUCCESS) 130 if (get_chrome_result != SUCCESS)
129 return get_chrome_result; 131 return get_chrome_result;
130 132
131 chrome_path = GetChromeExePath(is_canary); 133 chrome_path = chrome_launcher_support::GetAnyChromePath(is_canary);
132 if (chrome_path.empty()) 134 if (chrome_path.empty())
133 return COULD_NOT_FIND_CHROME; 135 return COULD_NOT_FIND_CHROME;
134 } 136 }
135 137
136 base::CommandLine cmd(chrome_path); 138 base::CommandLine cmd(chrome_path);
137 cmd.AppendSwitchASCII(kInstallChromeApp, app_id); 139 cmd.AppendSwitchASCII(kInstallChromeApp, app_id);
138 DVLOG(1) << "Install command: " << cmd.GetCommandLineString(); 140 DVLOG(1) << "Install command: " << cmd.GetCommandLineString();
139 bool launched = base::LaunchProcess(cmd, base::LaunchOptions()).IsValid(); 141 bool launched = base::LaunchProcess(cmd, base::LaunchOptions()).IsValid();
140 DVLOG(1) << "Launch " << (launched ? "success." : "failed."); 142 DVLOG(1) << "Launch " << (launched ? "success." : "failed.");
141 143
142 return SUCCESS; 144 return SUCCESS;
143 } 145 }
144 146
145 } // namespace app_installer 147 } // namespace app_installer
OLDNEW
« no previous file with comments | « no previous file | chrome/app_installer/win/app_installer_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698