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

Side by Side Diff: chrome/browser/chromeos/system/input_device_settings_impl_x11.cc

Issue 2871303004: Rename TaskRunner::RunsTasksOnCurrentThread() in //chrome (Closed)
Patch Set: Created 3 years, 7 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
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 "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 29 matching lines...) Expand all
40 const char kDeviceTypeTouchpad[] = "touchpad"; 40 const char kDeviceTypeTouchpad[] = "touchpad";
41 const char kDeviceTypeMouse[] = "mouse"; 41 const char kDeviceTypeMouse[] = "mouse";
42 const char kInputControl[] = "/opt/google/input/inputcontrol"; 42 const char kInputControl[] = "/opt/google/input/inputcontrol";
43 43
44 // The name of the xinput device corresponding to the internal touchpad. 44 // The name of the xinput device corresponding to the internal touchpad.
45 const char kInternalTouchpadName[] = "Elan Touchpad"; 45 const char kInternalTouchpadName[] = "Elan Touchpad";
46 46
47 typedef base::RefCountedData<bool> RefCountedBool; 47 typedef base::RefCountedData<bool> RefCountedBool;
48 48
49 bool ScriptExists(const std::string& script) { 49 bool ScriptExists(const std::string& script) {
50 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 50 base::ThreadRestrictions::AssertIOAllowed();
51 return base::PathExists(base::FilePath(script)); 51 return base::PathExists(base::FilePath(script));
52 } 52 }
53 53
54 // Executes the input control script asynchronously, if it exists. 54 // Executes the input control script asynchronously, if it exists.
55 void ExecuteScriptOnFileThread(const std::vector<std::string>& argv) { 55 void ExecuteScriptOnFileThread(const std::vector<std::string>& argv) {
56 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 56 base::ThreadRestrictions::AssertIOAllowed();
57 DCHECK(!argv.empty()); 57 DCHECK(!argv.empty());
58 const std::string& script(argv[0]); 58 const std::string& script(argv[0]);
59 59
60 // Script must exist on device and is of correct format. 60 // Script must exist on device and is of correct format.
61 DCHECK(script.compare(kInputControl) == 0); 61 DCHECK(script.compare(kInputControl) == 0);
62 DCHECK(!base::SysInfo::IsRunningOnChromeOS() || ScriptExists(script)); 62 DCHECK(!base::SysInfo::IsRunningOnChromeOS() || ScriptExists(script));
63 63
64 if (!ScriptExists(script)) 64 if (!ScriptExists(script))
65 return; 65 return;
66 66
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 void AddTPControlArguments(const char* control, 100 void AddTPControlArguments(const char* control,
101 bool enabled, 101 bool enabled,
102 std::vector<std::string>* argv) { 102 std::vector<std::string>* argv) {
103 argv->push_back(base::StringPrintf("--%s=%d", control, enabled ? 1 : 0)); 103 argv->push_back(base::StringPrintf("--%s=%d", control, enabled ? 1 : 0));
104 } 104 }
105 105
106 void DeviceExistsBlockingPool(const char* device_type, 106 void DeviceExistsBlockingPool(const char* device_type,
107 scoped_refptr<RefCountedBool> exists) { 107 scoped_refptr<RefCountedBool> exists) {
108 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 108 base::ThreadRestrictions::AssertIOAllowed();
109 exists->data = false; 109 exists->data = false;
110 if (!ScriptExists(kInputControl)) 110 if (!ScriptExists(kInputControl))
111 return; 111 return;
112 112
113 std::vector<std::string> argv; 113 std::vector<std::string> argv;
114 argv.push_back(kInputControl); 114 argv.push_back(kInputControl);
115 argv.push_back(base::StringPrintf("--type=%s", device_type)); 115 argv.push_back(base::StringPrintf("--type=%s", device_type));
116 argv.push_back("--list"); 116 argv.push_back("--list");
117 std::string output; 117 std::string output;
118 // Output is empty if the device is not found. 118 // Output is empty if the device is not found.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 if (base::SysInfo::IsRunningOnChromeOS()) 352 if (base::SysInfo::IsRunningOnChromeOS())
353 g_instance = new InputDeviceSettingsImplX11; 353 g_instance = new InputDeviceSettingsImplX11;
354 else 354 else
355 g_instance = new FakeInputDeviceSettings; 355 g_instance = new FakeInputDeviceSettings;
356 } 356 }
357 return g_instance; 357 return g_instance;
358 } 358 }
359 359
360 } // namespace system 360 } // namespace system
361 } // namespace chromeos 361 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698