Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: blimp/client/core/input/blimp_input_manager.h

Issue 2624903006: Remove all blimp client code. (Closed)
Patch Set: Update buildbot configuration Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #ifndef BLIMP_CLIENT_CORE_INPUT_BLIMP_INPUT_MANAGER_H_
6 #define BLIMP_CLIENT_CORE_INPUT_BLIMP_INPUT_MANAGER_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/single_thread_task_runner.h"
13 #include "base/synchronization/waitable_event.h"
14 #include "base/threading/thread_checker.h"
15 #include "third_party/WebKit/public/platform/WebGestureEvent.h"
16 #include "third_party/WebKit/public/platform/WebInputEvent.h"
17 #include "ui/events/gesture_detection/filtered_gesture_provider.h"
18 #include "ui/events/gesture_detection/motion_event.h"
19
20 namespace cc {
21 class InputHandler;
22 } // namespace cc
23
24 namespace blimp {
25 namespace client {
26 class BlimpInputHandlerWrapper;
27
28 class BlimpInputManagerClient {
29 public:
30 virtual void SendWebGestureEvent(
31 const blink::WebGestureEvent& gesture_event) = 0;
32 };
33
34 // The BlimpInputManager handles input events for a specific web widget. The
35 // class processes ui::events to generate web gesture events which are forwarded
36 // to the compositor to be handled on the compositor thread. If the event can
37 // not be handled locally by the compositor, it is given to the
38 // BlimpInputManagerClient to be sent to the engine.
39 // The class is created on and lives on the main thread.
40 class BlimpInputManager : public ui::GestureProviderClient {
41 public:
42 static std::unique_ptr<BlimpInputManager> Create(
43 BlimpInputManagerClient* client,
44 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
45 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
46 const base::WeakPtr<cc::InputHandler>& input_handler);
47
48 ~BlimpInputManager() override;
49
50 // Called to process a ui::MotionEvent. Returns true if the event was
51 // successfully processed.
52 bool OnTouchEvent(const ui::MotionEvent& motion_event);
53
54 // Called by the BlimpInputHandlerWrapper after an input event was handled on
55 // the compositor thread.
56 // |consumed| is false if the event was not handled by the compositor and
57 // should be sent to the engine.
58 void DidHandleWebGestureEvent(const blink::WebGestureEvent& gesture_event,
59 bool consumed);
60
61 void OnInputHandlerWrapperInitialized(
62 base::WeakPtr<BlimpInputHandlerWrapper> input_handler_wrapper_weak_ptr);
63
64 private:
65 BlimpInputManager(
66 BlimpInputManagerClient* client,
67 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
68 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
69 const base::WeakPtr<cc::InputHandler>& input_handler);
70
71 static void CreateInputHandlerWrapperOnCompositorThread(
72 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
73 const base::WeakPtr<BlimpInputManager>& input_manager_weak_ptr,
74 const base::WeakPtr<cc::InputHandler>& input_handler);
75
76 // ui::GestureProviderClient implementation.
77 void OnGestureEvent(const ui::GestureEventData& gesture) override;
78
79 BlimpInputManagerClient* client_;
80
81 ui::FilteredGestureProvider gesture_provider_;
82
83 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
84
85 std::unique_ptr<BlimpInputHandlerWrapper> input_handler_wrapper_;
86
87 // WeakPtr used to post tasks to the wrapper on the compositor thread.
88 base::WeakPtr<BlimpInputHandlerWrapper> input_handler_wrapper_weak_ptr_;
89
90 base::ThreadChecker thread_checker_;
91
92 base::WeakPtrFactory<BlimpInputManager> weak_factory_;
93
94 DISALLOW_COPY_AND_ASSIGN(BlimpInputManager);
95 };
96
97 } // namespace client
98 } // namespace blimp
99
100 #endif // BLIMP_CLIENT_CORE_INPUT_BLIMP_INPUT_MANAGER_H_
OLDNEW
« no previous file with comments | « blimp/client/core/input/blimp_input_handler_wrapper.cc ('k') | blimp/client/core/input/blimp_input_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698