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

Side by Side Diff: content/renderer/compositor_mus_connection.h

Issue 1484013003: mustash: Implement basic input event routing in renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed dependency for unit test Created 5 years 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
« no previous file with comments | « content/renderer/BUILD.gn ('k') | content/renderer/compositor_mus_connection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_RENDERER_COMPOSITOR_MUS_CONNECTION_H_
6 #define CONTENT_RENDERER_COMPOSITOR_MUS_CONNECTION_H_
7
8 #include "base/bind.h"
9 #include "base/macros.h"
10 #include "components/mus/public/cpp/window.h"
11 #include "components/mus/public/cpp/window_observer.h"
12 #include "components/mus/public/cpp/window_tree_connection.h"
13 #include "components/mus/public/cpp/window_tree_delegate.h"
14 #include "third_party/WebKit/public/web/WebInputEvent.h"
15
16 namespace content {
17
18 class InputHandlerManager;
19
20 // CompositorMusConnection manages the connection to the Mandoline UI Service
21 // (Mus) on the compositor thread. For operations that need to happen on the
22 // main thread, CompositorMusConnection deals with passing information across
23 // threads. CompositorMusConnection is constructed on the main thread. By
24 // default all other methods are assumed to run on the compositor thread unless
25 // explicited suffixed with OnMainThread.
26 class CompositorMusConnection
27 : public mus::WindowTreeDelegate,
28 public mus::WindowObserver,
29 public base::RefCountedThreadSafe<CompositorMusConnection> {
30 public:
31 // Created on main thread.
32 CompositorMusConnection(
33 int routing_id,
34 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner,
35 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
36 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request,
37 InputHandlerManager* input_handler_manager);
38
39 // Attaches the provided |surface_binding| with the mus::Window for the
40 // renderer once it becomes available.
41 void AttachSurfaceOnMainThread(
42 scoped_ptr<mus::WindowSurfaceBinding> surface_binding);
43
44 private:
45 friend class base::RefCountedThreadSafe<CompositorMusConnection>;
46
47 ~CompositorMusConnection() override;
48
49 void AttachSurfaceOnCompositorThread(
50 scoped_ptr<mus::WindowSurfaceBinding> surface_binding);
51
52 void CreateWindowTreeConnectionOnCompositorThread(
53 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request);
54
55 void OnConnectionLostOnMainThread();
56
57 void OnWindowInputEventOnMainThread(
58 scoped_ptr<blink::WebInputEvent> web_event,
59 const base::Closure& ack);
60
61 void OnWindowInputEventAckOnMainThread(const base::Closure& ack);
62
63 // WindowTreeDelegate implementation:
64 void OnConnectionLost(mus::WindowTreeConnection* connection) override;
65 void OnEmbed(mus::Window* root) override;
66
67 // WindowObserver implementation:
68 void OnWindowInputEvent(mus::Window* window,
69 const mus::mojom::EventPtr& event) override;
70
71 const int routing_id_;
72 mus::Window* root_;
73 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
74 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
75 InputHandlerManager* const input_handler_manager_;
76 scoped_ptr<mus::WindowSurfaceBinding> window_surface_binding_;
77
78 DISALLOW_COPY_AND_ASSIGN(CompositorMusConnection);
79 };
80
81 } // namespace content
82
83 #endif // CONTENT_RENDERER_COMPOSITOR_MUS_CONNECTION_H_
OLDNEW
« no previous file with comments | « content/renderer/BUILD.gn ('k') | content/renderer/compositor_mus_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698