OLD | NEW |
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 "cloud_print/service/win/chrome_launcher.h" | 5 #include "cloud_print/service/win/chrome_launcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "base/win/registry.h" | 17 #include "base/win/registry.h" |
18 #include "base/win/scoped_handle.h" | 18 #include "base/win/scoped_handle.h" |
19 #include "base/win/scoped_process_information.h" | 19 #include "base/win/scoped_process_information.h" |
20 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 23 #include "chrome/common/prefetch_argument_win.h" |
23 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 24 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
24 #include "cloud_print/common/win/cloud_print_utils.h" | 25 #include "cloud_print/common/win/cloud_print_utils.h" |
25 #include "cloud_print/service/service_constants.h" | 26 #include "cloud_print/service/service_constants.h" |
26 #include "cloud_print/service/win/service_utils.h" | 27 #include "cloud_print/service/win/service_utils.h" |
27 #include "components/browser_sync/common/browser_sync_switches.h" | 28 #include "components/browser_sync/common/browser_sync_switches.h" |
28 #include "components/cloud_devices/common/cloud_devices_urls.h" | 29 #include "components/cloud_devices/common/cloud_devices_urls.h" |
29 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
30 #include "google_apis/gaia/gaia_urls.h" | 31 #include "google_apis/gaia/gaia_urls.h" |
31 #include "net/base/url_util.h" | 32 #include "net/base/url_util.h" |
32 #include "url/gurl.h" | 33 #include "url/gurl.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 while (1) { | 205 while (1) { |
205 base::FilePath chrome_path = | 206 base::FilePath chrome_path = |
206 chrome_launcher_support::GetAnyChromePath(false /* is_sxs */); | 207 chrome_launcher_support::GetAnyChromePath(false /* is_sxs */); |
207 | 208 |
208 if (!chrome_path.empty()) { | 209 if (!chrome_path.empty()) { |
209 base::CommandLine cmd(chrome_path); | 210 base::CommandLine cmd(chrome_path); |
210 CopyChromeSwitchesFromCurrentProcess(&cmd); | 211 CopyChromeSwitchesFromCurrentProcess(&cmd); |
211 | 212 |
212 // Required switches. | 213 // Required switches. |
213 cmd.AppendSwitchASCII(switches::kProcessType, switches::kServiceProcess); | 214 cmd.AppendSwitchASCII(switches::kProcessType, switches::kServiceProcess); |
| 215 chrome::AddWindowsPrefetchArgument(&cmd); |
214 cmd.AppendSwitchPath(switches::kUserDataDir, user_data_); | 216 cmd.AppendSwitchPath(switches::kUserDataDir, user_data_); |
215 cmd.AppendSwitch(switches::kNoServiceAutorun); | 217 cmd.AppendSwitch(switches::kNoServiceAutorun); |
216 | 218 |
217 // Optional. | 219 // Optional. |
218 cmd.AppendSwitch(switches::kDisableDefaultApps); | 220 cmd.AppendSwitch(switches::kDisableDefaultApps); |
219 cmd.AppendSwitch(switches::kDisableExtensions); | 221 cmd.AppendSwitch(switches::kDisableExtensions); |
220 cmd.AppendSwitch(switches::kDisableGpu); | 222 cmd.AppendSwitch(switches::kDisableGpu); |
221 cmd.AppendSwitch(switches::kDisableSoftwareRasterizer); | 223 cmd.AppendSwitch(switches::kDisableSoftwareRasterizer); |
222 cmd.AppendSwitch(switches::kDisableSync); | 224 cmd.AppendSwitch(switches::kDisableSync); |
223 cmd.AppendSwitch(switches::kNoFirstRun); | 225 cmd.AppendSwitch(switches::kNoFirstRun); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 LOG(ERROR) << "Chrome launch failed."; | 326 LOG(ERROR) << "Chrome launch failed."; |
325 return std::string(); | 327 return std::string(); |
326 } | 328 } |
327 if (!json.empty()) { | 329 if (!json.empty()) { |
328 // Close chrome because Service State is ready. | 330 // Close chrome because Service State is ready. |
329 CloseChrome(chrome_process.Pass(), thread_id); | 331 CloseChrome(chrome_process.Pass(), thread_id); |
330 return json; | 332 return json; |
331 } | 333 } |
332 } | 334 } |
333 } | 335 } |
OLD | NEW |