Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/events/test/device_data_manager_test_api.h" | |
| 6 | |
| 7 #define DEVICE_DATA_MANAGER_IS_AVAILABLE() \ | |
|
Alexei Svitkine (slow)
2015/07/09 15:17:05
Nit: I would define this without ()'s. I think ()'
bruthig
2015/07/10 15:38:42
Done.
| |
| 8 (defined(USE_OZONE) || defined(USE_X11)) | |
| 9 | |
| 10 #if DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 11 #include "ui/events/devices/device_data_manager.h" | |
| 12 #endif // DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 13 | |
| 14 namespace ui { | |
| 15 namespace test { | |
| 16 | |
| 17 DeviceDataManagerTestAPI::DeviceDataManagerTestAPI() { | |
| 18 } | |
| 19 | |
| 20 DeviceDataManagerTestAPI::~DeviceDataManagerTestAPI() { | |
| 21 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 22 NOTREACHED(); | |
| 23 #else | |
| 24 if (DeviceDataManager::instance() == device_data_manager_.get()) | |
| 25 DeviceDataManager::set_instance(nullptr); | |
| 26 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 27 } | |
| 28 | |
| 29 bool DeviceDataManagerTestAPI::CreateDeviceDataManagerInstance() { | |
| 30 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 31 return false; | |
| 32 #else | |
| 33 if (DeviceDataManager::instance()) | |
| 34 DeviceDataManager::set_instance(nullptr); | |
| 35 | |
| 36 device_data_manager_.reset(new DeviceDataManager()); | |
| 37 DeviceDataManager::set_instance(device_data_manager_.get()); | |
| 38 | |
| 39 return true; | |
| 40 | |
|
Alexei Svitkine (slow)
2015/07/09 15:17:05
Nit: Remove empty line.
bruthig
2015/07/10 15:38:42
Done.
| |
| 41 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 42 } | |
| 43 | |
| 44 void DeviceDataManagerTestAPI:: | |
| 45 NotifyObserversTouchscreenDeviceConfigurationChanged() { | |
| 46 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 47 NOTREACHED(); | |
| 48 #else | |
| 49 device_data_manager_->NotifyObserversTouchscreenDeviceConfigurationChanged(); | |
| 50 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 51 } | |
| 52 | |
| 53 void DeviceDataManagerTestAPI:: | |
| 54 NotifyObserversKeyboardDeviceConfigurationChanged() { | |
| 55 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 56 NOTREACHED(); | |
| 57 #else | |
| 58 device_data_manager_->NotifyObserversKeyboardDeviceConfigurationChanged(); | |
| 59 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 60 } | |
| 61 | |
| 62 void DeviceDataManagerTestAPI:: | |
| 63 NotifyObserversMouseDeviceConfigurationChanged() { | |
| 64 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 65 NOTREACHED(); | |
| 66 #else | |
| 67 device_data_manager_->NotifyObserversMouseDeviceConfigurationChanged(); | |
| 68 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 69 } | |
| 70 | |
| 71 void DeviceDataManagerTestAPI:: | |
| 72 NotifyObserversTouchpadDeviceConfigurationChanged() { | |
| 73 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 74 NOTREACHED(); | |
| 75 #else | |
| 76 device_data_manager_->NotifyObserversTouchpadDeviceConfigurationChanged(); | |
| 77 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 78 } | |
| 79 | |
| 80 void DeviceDataManagerTestAPI::NotifyObserversDeviceListsComplete() { | |
| 81 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 82 NOTREACHED(); | |
| 83 #else | |
| 84 device_data_manager_->NotifyObserversDeviceListsComplete(); | |
| 85 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 86 } | |
| 87 | |
| 88 void DeviceDataManagerTestAPI::OnDeviceListsComplete() { | |
| 89 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 90 NOTREACHED(); | |
| 91 #else | |
| 92 device_data_manager_->OnDeviceListsComplete(); | |
| 93 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE() | |
| 94 } | |
| 95 | |
| 96 } // namespace test | |
| 97 } // namespace ui | |
| OLD | NEW |