Record MTU discovery packets in net-internals log.
[chromium-blink-merge.git] / ui / mojo / init / ui_init.cc
blob937112eeb4d1721e342b3d51ed9f6c12eb5bdc53
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.
5 #include "ui/mojo/init/ui_init.h"
7 #include "base/memory/singleton.h"
8 #include "ui/mojo/init/screen_mojo.h"
10 #if defined(OS_ANDROID)
11 #include "ui/events/gesture_detection/gesture_configuration.h"
12 #endif
14 namespace ui {
15 namespace mojo {
17 #if defined(OS_ANDROID)
18 // TODO(sky): this needs to come from system.
19 class GestureConfigurationMojo : public ui::GestureConfiguration {
20 public:
21 GestureConfigurationMojo() : GestureConfiguration() {
22 set_double_tap_enabled(false);
23 set_double_tap_timeout_in_ms(semi_long_press_time_in_ms());
24 set_gesture_begin_end_types_enabled(true);
25 set_min_gesture_bounds_length(default_radius());
26 set_min_pinch_update_span_delta(0);
27 set_min_scaling_touch_major(default_radius() * 2);
28 set_velocity_tracker_strategy(
29 ui::VelocityTracker::Strategy::LSQ2_RESTRICTED);
30 set_span_slop(max_touch_move_in_pixels_for_click() * 2);
31 set_swipe_enabled(true);
32 set_two_finger_tap_enabled(true);
35 ~GestureConfigurationMojo() override {}
37 private:
38 DISALLOW_COPY_AND_ASSIGN(GestureConfigurationMojo);
40 #endif
42 UIInit::UIInit(const gfx::Size& screen_size_in_pixels, float device_pixel_ratio)
43 : screen_(new ScreenMojo(screen_size_in_pixels, device_pixel_ratio)) {
44 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
45 #if defined(OS_ANDROID)
46 gesture_configuration_.reset(new GestureConfigurationMojo);
47 ui::GestureConfiguration::SetInstance(gesture_configuration_.get());
48 #endif
51 UIInit::~UIInit() {
52 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, nullptr);
53 #if defined(OS_ANDROID)
54 ui::GestureConfiguration::SetInstance(nullptr);
55 #endif
58 } // namespace mojo
59 } // namespace ui