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

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: One more /* is_sxs */. 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/util/util_constants.h" 23 #include "chrome/installer/util/util_constants.h"
grt (UTC plus 2) 2015/01/13 14:10:43 looks like this is missing: #include "chrome/insta
24 #include "content/public/common/user_agent.h" 24 #include "content/public/common/user_agent.h"
25 25
26 namespace app_installer { 26 namespace app_installer {
27 27
28 namespace { 28 namespace {
29 29
30 // Log provider UUID. Required for logging to Sawbuck. 30 // Log provider UUID. Required for logging to Sawbuck.
31 // {d82c3b59-bacd-4625-8282-4d570c4dad12} 31 // {d82c3b59-bacd-4625-8282-4d570c4dad12}
32 DEFINE_GUID(kAppInstallerLogProvider, 32 DEFINE_GUID(kAppInstallerLogProvider,
33 0xd82c3b59, 33 0xd82c3b59,
(...skipping 80 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 114 // Parse the data to check it's valid JSON. The download page will just eval
115 // it. 115 // it.
116 base::JSONReader json_reader; 116 base::JSONReader json_reader;
117 scoped_ptr<base::Value> inline_install_data( 117 scoped_ptr<base::Value> inline_install_data(
118 json_reader.ReadToValue(inline_install_json)); 118 json_reader.ReadToValue(inline_install_json));
119 if (!inline_install_data) { 119 if (!inline_install_data) {
120 LOG(ERROR) << json_reader.GetErrorMessage(); 120 LOG(ERROR) << json_reader.GetErrorMessage();
121 return COULD_NOT_PARSE_INLINE_INSTALL_DATA; 121 return COULD_NOT_PARSE_INLINE_INSTALL_DATA;
122 } 122 }
123 123
124 base::FilePath chrome_path = GetChromeExePath(is_canary); 124 base::FilePath chrome_path =
125 chrome_launcher_support::GetAnyChromePath(is_canary);
125 // If none found, show EULA, download, and install Chrome. 126 // If none found, show EULA, download, and install Chrome.
126 if (chrome_path.empty()) { 127 if (chrome_path.empty()) {
127 ExitCode get_chrome_result = GetChrome(is_canary, inline_install_json); 128 ExitCode get_chrome_result = GetChrome(is_canary, inline_install_json);
128 if (get_chrome_result != SUCCESS) 129 if (get_chrome_result != SUCCESS)
129 return get_chrome_result; 130 return get_chrome_result;
130 131
131 chrome_path = GetChromeExePath(is_canary); 132 chrome_path = chrome_launcher_support::GetAnyChromePath(is_canary);
132 if (chrome_path.empty()) 133 if (chrome_path.empty())
133 return COULD_NOT_FIND_CHROME; 134 return COULD_NOT_FIND_CHROME;
134 } 135 }
135 136
136 base::CommandLine cmd(chrome_path); 137 base::CommandLine cmd(chrome_path);
137 cmd.AppendSwitchASCII(kInstallChromeApp, app_id); 138 cmd.AppendSwitchASCII(kInstallChromeApp, app_id);
138 DVLOG(1) << "Install command: " << cmd.GetCommandLineString(); 139 DVLOG(1) << "Install command: " << cmd.GetCommandLineString();
139 bool launched = base::LaunchProcess(cmd, base::LaunchOptions()).IsValid(); 140 bool launched = base::LaunchProcess(cmd, base::LaunchOptions()).IsValid();
140 DVLOG(1) << "Launch " << (launched ? "success." : "failed."); 141 DVLOG(1) << "Launch " << (launched ? "success." : "failed.");
141 142
142 return SUCCESS; 143 return SUCCESS;
143 } 144 }
144 145
145 } // namespace app_installer 146 } // 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