blob: 34b0ae349e60197e55ce8b876147569deacc3413 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// 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 "ui/mojo/init/ui_init.h"
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "build/build_config.h"
#include "ui/mojo/init/screen_mojo.h"
#if defined(OS_ANDROID)
#include "ui/events/gesture_detection/gesture_configuration.h" // nogncheck
#endif
namespace ui {
namespace mojo {
#if defined(OS_ANDROID)
// TODO(sky): this needs to come from system.
class GestureConfigurationMojo : public ui::GestureConfiguration {
public:
GestureConfigurationMojo() : GestureConfiguration() {
set_double_tap_enabled(false);
set_double_tap_timeout_in_ms(semi_long_press_time_in_ms());
set_gesture_begin_end_types_enabled(true);
set_min_gesture_bounds_length(default_radius());
set_min_pinch_update_span_delta(0);
set_min_scaling_touch_major(default_radius() * 2);
set_velocity_tracker_strategy(
ui::VelocityTracker::Strategy::LSQ2_RESTRICTED);
set_span_slop(max_touch_move_in_pixels_for_click() * 2);
set_swipe_enabled(true);
set_two_finger_tap_enabled(true);
}
~GestureConfigurationMojo() override {}
private:
DISALLOW_COPY_AND_ASSIGN(GestureConfigurationMojo);
};
#endif
UIInit::UIInit(const std::vector<gfx::Display>& displays)
: screen_(new ScreenMojo(displays)) {
gfx::Screen::SetScreenInstance(screen_.get());
#if defined(OS_ANDROID)
gesture_configuration_.reset(new GestureConfigurationMojo);
ui::GestureConfiguration::SetInstance(gesture_configuration_.get());
#endif
}
UIInit::~UIInit() {
gfx::Screen::SetScreenInstance(nullptr);
#if defined(OS_ANDROID)
ui::GestureConfiguration::SetInstance(nullptr);
#endif
}
} // namespace mojo
} // namespace ui
|