| OLD | NEW |
| 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" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |