summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/input/input_device_capabilities.cc
blob: d590db7e8e891efa1112864deb8f850f5d29b763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2015 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.

#include "third_party/blink/renderer/core/input/input_device_capabilities.h"

#include "third_party/blink/renderer/bindings/core/v8/v8_input_device_capabilities_init.h"

namespace blink {

InputDeviceCapabilities::InputDeviceCapabilities(bool fires_touch_events) {
  fires_touch_events_ = fires_touch_events;
}

InputDeviceCapabilities::InputDeviceCapabilities(
    const InputDeviceCapabilitiesInit* initializer) {
  fires_touch_events_ = initializer->firesTouchEvents();
}

InputDeviceCapabilities* InputDeviceCapabilitiesConstants::FiresTouchEvents(
    bool fires_touch) {
  if (fires_touch) {
    if (!fires_touch_events_)
      fires_touch_events_ = InputDeviceCapabilities::Create(true);
    return fires_touch_events_;
  }
  if (!doesnt_fire_touch_events_)
    doesnt_fire_touch_events_ = InputDeviceCapabilities::Create(false);
  return doesnt_fire_touch_events_;
}

}  // namespace blink