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

Side by Side Diff: ui/events/devices/device_data_manager.cc

Issue 922843002: Fix software mirror mode on Ozone part 2/2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 "ui/events/devices/device_data_manager.h" 5 #include "ui/events/devices/device_data_manager.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/events/devices/input_device_event_observer.h" 10 #include "ui/events/devices/input_device_event_observer.h"
(...skipping 15 matching lines...) Expand all
26 26
27 DeviceDataManager::DeviceDataManager() { 27 DeviceDataManager::DeviceDataManager() {
28 CHECK(!instance_) << "Can not create multiple instances of DeviceDataManager"; 28 CHECK(!instance_) << "Can not create multiple instances of DeviceDataManager";
29 instance_ = this; 29 instance_ = this;
30 30
31 base::AtExitManager::RegisterTask( 31 base::AtExitManager::RegisterTask(
32 base::Bind(&base::DeletePointer<DeviceDataManager>, this)); 32 base::Bind(&base::DeletePointer<DeviceDataManager>, this));
33 33
34 for (int i = 0; i < kMaxDeviceNum; ++i) { 34 for (int i = 0; i < kMaxDeviceNum; ++i) {
35 touch_device_to_display_map_[i] = gfx::Display::kInvalidDisplayID; 35 touch_device_to_display_map_[i] = gfx::Display::kInvalidDisplayID;
36 touch_device_to_target_display_map_[i] = gfx::Display::kInvalidDisplayID;
36 touch_radius_scale_map_[i] = 1.0; 37 touch_radius_scale_map_[i] = 1.0;
37 } 38 }
38 } 39 }
39 40
40 DeviceDataManager::~DeviceDataManager() { 41 DeviceDataManager::~DeviceDataManager() {
41 CHECK_EQ(this, instance_); 42 CHECK_EQ(this, instance_);
42 instance_ = NULL; 43 instance_ = NULL;
43 } 44 }
44 45
45 // static 46 // static
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 113 }
113 } 114 }
114 115
115 int64_t DeviceDataManager::GetDisplayForTouchDevice( 116 int64_t DeviceDataManager::GetDisplayForTouchDevice(
116 unsigned int touch_device_id) const { 117 unsigned int touch_device_id) const {
117 if (IsTouchDeviceIdValid(touch_device_id)) 118 if (IsTouchDeviceIdValid(touch_device_id))
118 return touch_device_to_display_map_[touch_device_id]; 119 return touch_device_to_display_map_[touch_device_id];
119 return gfx::Display::kInvalidDisplayID; 120 return gfx::Display::kInvalidDisplayID;
120 } 121 }
121 122
123 void DeviceDataManager::SetTargetDisplayForTouchDevice(
124 unsigned int touch_device_id,
125 int64_t target_display_id) {
126 if (IsTouchDeviceIdValid(touch_device_id))
127 touch_device_to_target_display_map_[touch_device_id] = target_display_id;
128 }
129
130 int64_t DeviceDataManager::GetTargetDisplayForTouchDevice(
131 unsigned int touch_device_id) {
132 if (IsTouchDeviceIdValid(touch_device_id))
133 return touch_device_to_target_display_map_[touch_device_id];
134 return gfx::Display::kInvalidDisplayID;
135 }
136
122 void DeviceDataManager::OnTouchscreenDevicesUpdated( 137 void DeviceDataManager::OnTouchscreenDevicesUpdated(
123 const std::vector<TouchscreenDevice>& devices) { 138 const std::vector<TouchscreenDevice>& devices) {
124 if (devices.size() == touchscreen_devices_.size() && 139 if (devices.size() == touchscreen_devices_.size() &&
125 std::equal(devices.begin(), 140 std::equal(devices.begin(),
126 devices.end(), 141 devices.end(),
127 touchscreen_devices_.begin(), 142 touchscreen_devices_.begin(),
128 InputDeviceEquals)) { 143 InputDeviceEquals)) {
129 return; 144 return;
130 } 145 }
131 touchscreen_devices_ = devices; 146 touchscreen_devices_ = devices;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 180
166 void DeviceDataManager::AddObserver(InputDeviceEventObserver* observer) { 181 void DeviceDataManager::AddObserver(InputDeviceEventObserver* observer) {
167 observers_.AddObserver(observer); 182 observers_.AddObserver(observer);
168 } 183 }
169 184
170 void DeviceDataManager::RemoveObserver(InputDeviceEventObserver* observer) { 185 void DeviceDataManager::RemoveObserver(InputDeviceEventObserver* observer) {
171 observers_.RemoveObserver(observer); 186 observers_.RemoveObserver(observer);
172 } 187 }
173 188
174 } // namespace ui 189 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698