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

Side by Side Diff: ui/events/devices/x11/touch_factory_x11.cc

Issue 819223002: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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 (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 "ui/events/devices/x11/touch_factory_x11.h" 5 #include "ui/events/devices/x11/touch_factory_x11.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 #include <X11/extensions/XInput.h> 9 #include <X11/extensions/XInput.h>
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 21 matching lines...) Expand all
32 touch_device_list_(), 32 touch_device_list_(),
33 max_touch_points_(-1), 33 max_touch_points_(-1),
34 virtual_core_keyboard_device_(-1), 34 virtual_core_keyboard_device_(-1),
35 id_generator_(0) { 35 id_generator_(0) {
36 if (!DeviceDataManagerX11::GetInstance()->IsXInput2Available()) 36 if (!DeviceDataManagerX11::GetInstance()->IsXInput2Available())
37 return; 37 return;
38 38
39 XDisplay* display = gfx::GetXDisplay(); 39 XDisplay* display = gfx::GetXDisplay();
40 UpdateDeviceList(display); 40 UpdateDeviceList(display);
41 41
42 CommandLine* cmdline = CommandLine::ForCurrentProcess(); 42 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
43 touch_events_disabled_ = cmdline->HasSwitch(switches::kTouchEvents) && 43 touch_events_disabled_ = cmdline->HasSwitch(switches::kTouchEvents) &&
44 cmdline->GetSwitchValueASCII(switches::kTouchEvents) == 44 cmdline->GetSwitchValueASCII(switches::kTouchEvents) ==
45 switches::kTouchEventsDisabled; 45 switches::kTouchEventsDisabled;
46 } 46 }
47 47
48 TouchFactory::~TouchFactory() { 48 TouchFactory::~TouchFactory() {
49 } 49 }
50 50
51 // static 51 // static
52 TouchFactory* TouchFactory::GetInstance() { 52 TouchFactory* TouchFactory::GetInstance() {
53 return Singleton<TouchFactory>::get(); 53 return Singleton<TouchFactory>::get();
54 } 54 }
55 55
56 // static 56 // static
57 void TouchFactory::SetTouchDeviceListFromCommandLine() { 57 void TouchFactory::SetTouchDeviceListFromCommandLine() {
58 // Get a list of pointer-devices that should be treated as touch-devices. 58 // Get a list of pointer-devices that should be treated as touch-devices.
59 // This is primarily used for testing/debugging touch-event processing when a 59 // This is primarily used for testing/debugging touch-event processing when a
60 // touch-device isn't available. 60 // touch-device isn't available.
61 std::string touch_devices = 61 std::string touch_devices =
62 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 62 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
63 switches::kTouchDevices); 63 switches::kTouchDevices);
64 64
65 if (!touch_devices.empty()) { 65 if (!touch_devices.empty()) {
66 std::vector<std::string> devs; 66 std::vector<std::string> devs;
67 std::vector<unsigned int> device_ids; 67 std::vector<unsigned int> device_ids;
68 unsigned int devid; 68 unsigned int devid;
69 base::SplitString(touch_devices, ',', &devs); 69 base::SplitString(touch_devices, ',', &devs);
70 for (std::vector<std::string>::iterator iter = devs.begin(); 70 for (std::vector<std::string>::iterator iter = devs.begin();
71 iter != devs.end(); ++iter) { 71 iter != devs.end(); ++iter) {
72 if (base::StringToInt(*iter, reinterpret_cast<int*>(&devid))) 72 if (base::StringToInt(*iter, reinterpret_cast<int*>(&devid)))
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 if (ptr[0] || ptr[1]) 338 if (ptr[0] || ptr[1])
339 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1])); 339 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1]));
340 } 340 }
341 XFree(prop_return); 341 XFree(prop_return);
342 } 342 }
343 343
344 XCloseDevice(display, device); 344 XCloseDevice(display, device);
345 } 345 }
346 346
347 } // namespace ui 347 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/test/in_process_context_factory.cc ('k') | ui/events/gesture_detection/gesture_configuration_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698