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 "chrome/browser/chromeos/system/input_device_settings.h" | 5 #include "chrome/browser/chromeos/system/input_device_settings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 DCHECK(!argv.empty()); | 48 DCHECK(!argv.empty()); |
49 const std::string& script(argv[0]); | 49 const std::string& script(argv[0]); |
50 | 50 |
51 // Script must exist on device and is of correct format. | 51 // Script must exist on device and is of correct format. |
52 DCHECK(script.compare(kInputControl) == 0); | 52 DCHECK(script.compare(kInputControl) == 0); |
53 DCHECK(!base::SysInfo::IsRunningOnChromeOS() || ScriptExists(script)); | 53 DCHECK(!base::SysInfo::IsRunningOnChromeOS() || ScriptExists(script)); |
54 | 54 |
55 if (!ScriptExists(script)) | 55 if (!ScriptExists(script)) |
56 return; | 56 return; |
57 | 57 |
58 base::ProcessHandle handle; | 58 base::Process process = |
59 base::LaunchProcess(base::CommandLine(argv), base::LaunchOptions(), &handle); | 59 base::LaunchProcess(base::CommandLine(argv), base::LaunchOptions()); |
60 base::EnsureProcessGetsReaped(handle); | 60 if (process.IsValid()) |
| 61 base::EnsureProcessGetsReaped(process.pid()); |
61 } | 62 } |
62 | 63 |
63 void ExecuteScript(const std::vector<std::string>& argv) { | 64 void ExecuteScript(const std::vector<std::string>& argv) { |
64 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 65 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
65 | 66 |
66 if (argv.size() == 1) | 67 if (argv.size() == 1) |
67 return; | 68 return; |
68 | 69 |
69 VLOG(1) << "About to launch: \"" | 70 VLOG(1) << "About to launch: \"" |
70 << base::CommandLine(argv).GetCommandLineString() << "\""; | 71 << base::CommandLine(argv).GetCommandLineString() << "\""; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 void InputDeviceSettings::SetSettingsForTesting( | 315 void InputDeviceSettings::SetSettingsForTesting( |
315 InputDeviceSettings* test_settings) { | 316 InputDeviceSettings* test_settings) { |
316 if (g_test_instance == test_settings) | 317 if (g_test_instance == test_settings) |
317 return; | 318 return; |
318 delete g_test_instance; | 319 delete g_test_instance; |
319 g_test_instance = test_settings; | 320 g_test_instance = test_settings; |
320 } | 321 } |
321 | 322 |
322 } // namespace system | 323 } // namespace system |
323 } // namespace chromeos | 324 } // namespace chromeos |
OLD | NEW |