| Index: ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h
|
| diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h
|
| deleted file mode 100644
|
| index dd7afb2aa0e85f0fbb8583862601c876b0c72646..0000000000000000000000000000000000000000
|
| --- a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h
|
| +++ /dev/null
|
| @@ -1,263 +0,0 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#ifndef UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_PROPERTY_PROVIDER_H_
|
| -#define UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_PROPERTY_PROVIDER_H_
|
| -
|
| -#include <gestures/gestures.h>
|
| -#include <libevdev/libevdev.h>
|
| -
|
| -#include <map>
|
| -#include <string>
|
| -
|
| -#include "base/containers/scoped_ptr_hash_map.h"
|
| -#include "base/memory/scoped_vector.h"
|
| -#include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
|
| -
|
| -namespace ui {
|
| -
|
| -class GesturesPropFunctionsWrapper;
|
| -class GestureInterpreterLibevdevCros;
|
| -
|
| -// Not for public consumption, so we wrap it in namespace internal.
|
| -namespace internal {
|
| -struct GestureDevicePropertyData;
|
| -class MatchCriteria;
|
| -struct ConfigurationSection;
|
| -}
|
| -
|
| -// A struct holding device properties that are useful when interacting with
|
| -// the gestures lib.
|
| -struct GestureDeviceProperties {
|
| - int area_left;
|
| - int area_right;
|
| - int area_top;
|
| - int area_bottom;
|
| - int res_y;
|
| - int res_x;
|
| - int orientation_minimum;
|
| - int orientation_maximum;
|
| - GesturesPropBool raw_passthrough;
|
| - GesturesPropBool dump_debug_log;
|
| -};
|
| -
|
| -// Provide the interface to access the CrOS gesture library properties.
|
| -// It maintains the property data for all input devices that runs with
|
| -// the gesture library.
|
| -//
|
| -// The class also parses the configuration files on the system to
|
| -// initialize the specified property values. The configuration files are
|
| -// currently in the xorg-conf format so that they can be shared with non-Ozone
|
| -// builds.
|
| -class EVENTS_OZONE_EVDEV_EXPORT GesturePropertyProvider {
|
| - public:
|
| - // Device types.
|
| - enum DeviceType {
|
| - DT_MOUSE,
|
| - DT_TOUCHPAD,
|
| - DT_TOUCHSCREEN,
|
| - DT_MULTITOUCH,
|
| - DT_MULTITOUCH_MOUSE,
|
| - DT_ALL,
|
| - };
|
| -
|
| - // Property types.
|
| - enum PropertyType {
|
| - PT_INT,
|
| - PT_SHORT,
|
| - PT_BOOL,
|
| - PT_STRING,
|
| - PT_REAL,
|
| - };
|
| -
|
| - // Pointer that leads to the device info.
|
| - typedef Evdev* DevicePtr;
|
| -
|
| - // The device ids are only maintained by EventFactoryEvdev to identify the
|
| - // input devices and are not to be confused with the Evdev input node id, for
|
| - // example.
|
| - typedef int DeviceId;
|
| -
|
| - GesturePropertyProvider();
|
| - ~GesturePropertyProvider();
|
| -
|
| - // Get a list of device ids that matches a device type.
|
| - void GetDeviceIdsByType(const DeviceType type,
|
| - std::vector<DeviceId>* device_ids);
|
| -
|
| - // Get the GesturesProp object. Returns NULL if not found.
|
| - //
|
| - // The user may use the object returned to set/get the property value in the
|
| - // gesture library's memory. Note that the values in preferences are not
|
| - // synced with the ones here in realtime - they are only applied from the
|
| - // preference side in a single way once appropriate (e.g., when the user
|
| - // clicked "OK").
|
| - GesturesProp* GetProperty(const DeviceId device_id, const std::string& name);
|
| -
|
| - private:
|
| - friend class GesturesPropFunctionsWrapper;
|
| -
|
| - // Mapping table from a device id to its device pointer.
|
| - typedef std::map<DeviceId, DevicePtr> DeviceMap;
|
| -
|
| - // Mapping table from a device id to its property data.
|
| - // GestureDevicePropertyData contains both properties in use and default
|
| - // properties whose values will be applied upon the device attachment.
|
| - typedef base::ScopedPtrHashMap<DeviceId, internal::GestureDevicePropertyData>
|
| - ScopedDeviceDataMap;
|
| -
|
| - // Register a device. Setup data-structures and the device's default
|
| - // properties.
|
| - void RegisterDevice(const DeviceId id, const DevicePtr device);
|
| -
|
| - // Unregister a device. Remove all of its properties being tracked.
|
| - void UnregisterDevice(const DeviceId id);
|
| -
|
| - // Called by functions in GesturesPropFunctionsWrapper to manipulate
|
| - // properties. Note these functions do not new/delete the GesturesProp
|
| - // pointers. It is caller's responsibility to manage them.
|
| - void AddProperty(const DeviceId device_id,
|
| - const std::string& name,
|
| - GesturesProp* property);
|
| - void DeleteProperty(const DeviceId device_id, const std::string& name);
|
| -
|
| - // Check if a property exists for a device. Return if it is found.
|
| - GesturesProp* FindProperty(const DeviceId device_id, const std::string& name);
|
| -
|
| - // Get the default value of a property based on the configuration files.
|
| - GesturesProp* GetDefaultProperty(const DeviceId device_id,
|
| - const std::string& name);
|
| -
|
| - // The device configuration files are parsed and stored in the memory upon
|
| - // Chrome starts. The default property values are then applied to each device
|
| - // when it is attached/detected.
|
| - void LoadDeviceConfigurations();
|
| -
|
| - // Parse a xorg-conf file. We ignore all sections other than InputClass.
|
| - // Check the xorg-conf spec for more infomation about its format.
|
| - void ParseXorgConfFile(const std::string& content);
|
| -
|
| - // Create a match criteria.
|
| - internal::MatchCriteria* CreateMatchCriteria(const std::string& match_type,
|
| - const std::string& arg);
|
| -
|
| - // Create a property that comes from the conf files.
|
| - GesturesProp* CreateDefaultProperty(const std::string& name,
|
| - const std::string& value);
|
| -
|
| - // Setup default property values for a newly found device.
|
| - void SetupDefaultProperties(const DeviceId device_id, const DevicePtr device);
|
| -
|
| - // Map from device ids to device pointers.
|
| - DeviceMap device_map_;
|
| -
|
| - // GestureDevicePropertyData indexed by their respective device ids. Owns the
|
| - // objects.
|
| - ScopedDeviceDataMap device_data_map_;
|
| -
|
| - // A vector of parsed sections in configuration files. Owns MatchCriterias,
|
| - // GesturesProps and ConfigurationSections in it.
|
| - ScopedVector<internal::ConfigurationSection> configurations_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(GesturePropertyProvider);
|
| -};
|
| -
|
| -// Wrapper of GesturesProp related functions. We group them together so that we
|
| -// can friend them all at once.
|
| -class GesturesPropFunctionsWrapper {
|
| - public:
|
| - // Property provider interface implementation.
|
| - //
|
| - // These functions will create a GesturesProp object that can link back to the
|
| - // memory that holds the real value, which is often declared in the gesture
|
| - // lib.
|
| - static GesturesProp* CreateInt(void* device_data,
|
| - const char* name,
|
| - int* value,
|
| - size_t count,
|
| - const int* init);
|
| - static GesturesProp* CreateShort(void* device_data,
|
| - const char* name,
|
| - short* value,
|
| - size_t count,
|
| - const short* init);
|
| - static GesturesProp* CreateBool(void* device_data,
|
| - const char* name,
|
| - GesturesPropBool* value,
|
| - size_t count,
|
| - const GesturesPropBool* init);
|
| -
|
| - // String GestureProps needs special care due to the use of const char* in the
|
| - // gesture lib. Its argument list is also different from numeric properties'.
|
| - static GesturesProp* CreateString(void* device_data,
|
| - const char* name,
|
| - const char** value,
|
| - const char* init);
|
| -
|
| - static GesturesProp* CreateReal(void* device_data,
|
| - const char* name,
|
| - double* value,
|
| - size_t count,
|
| - const double* init);
|
| -
|
| - // Set the handlers to call when a property is accessed.
|
| - static void RegisterHandlers(void* device_data,
|
| - GesturesProp* property,
|
| - void* handler_data,
|
| - GesturesPropGetHandler get,
|
| - GesturesPropSetHandler set);
|
| -
|
| - // Free a property.
|
| - static void Free(void* device_data, GesturesProp* property);
|
| -
|
| - // Initialize hardware-related device properties which will be used in the
|
| - // gesture lib.
|
| - static bool InitializeDeviceProperties(void* device_data,
|
| - GestureDeviceProperties* properties);
|
| -
|
| - // Unregister device from the gesture property provider.
|
| - static void UnregisterDevice(void* device_data);
|
| -
|
| - private:
|
| - // Property helper functions.
|
| - // Core template function for creating GestureProps. Used by numerical types.
|
| - template <typename T, class PROPTYPE>
|
| - static GesturesProp* CreateProperty(void* device_data,
|
| - const char* name,
|
| - T* value,
|
| - size_t count,
|
| - const T* init);
|
| -
|
| - // Do things that should happen BEFORE we create the property.
|
| - static bool PreCreateProperty(void* device_data,
|
| - const char* name,
|
| - GesturesProp** default_property);
|
| -
|
| - // Do things that should happen AFTER we create the property.
|
| - static void PostCreateProperty(void* device_data,
|
| - const char* name,
|
| - GesturesProp* property);
|
| -
|
| - // Some other utility functions used in InitializeDeviceProperties.
|
| - static GesturesProp* CreateIntSingle(void* device_data,
|
| - const char* name,
|
| - int* value,
|
| - int init);
|
| - static GesturesProp* CreateBoolSingle(void* device_data,
|
| - const char* name,
|
| - GesturesPropBool* value,
|
| - GesturesPropBool init);
|
| -
|
| - // Routines to extract information from the GestureInterpreterLibevdevCros
|
| - // pointer.
|
| - static GesturePropertyProvider* GetPropertyProvider(void* device_data);
|
| - static GesturePropertyProvider::DevicePtr GetDevicePointer(void* device_data);
|
| - static GesturePropertyProvider::DeviceId GetDeviceId(void* device_data);
|
| -};
|
| -
|
| -extern const GesturesPropProvider kGesturePropProvider;
|
| -
|
| -} // namspace ui
|
| -
|
| -#endif // UI_EVENTS_OZONE_EVDEV_LIBGESTURES_GLUE_GESTURE_PROPERTY_PROVIDER_H_
|
|
|