blob: 0792095c7e0def5792d94f3893bdbcf9eac5b86b (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// 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.
#ifndef CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_
#define CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_
#include "base/macros.h"
#include "base/threading/thread_checker.h"
#include "cc/output/output_surface.h"
#include "components/mus/public/cpp/window_surface.h"
#include "content/common/content_export.h"
#include "content/renderer/input/render_widget_input_handler_delegate.h"
#include "content/renderer/mus/compositor_mus_connection.h"
namespace content {
class InputHandlerManager;
// Use on main thread.
class CONTENT_EXPORT RenderWidgetMusConnection
: public RenderWidgetInputHandlerDelegate {
public:
// Bind to a WindowTreeClient request.
void Bind(mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request);
// Create a cc output surface.
scoped_ptr<cc::OutputSurface> CreateOutputSurface();
static RenderWidgetMusConnection* Get(int routing_id);
// Get the connection from a routing_id, if the connection doesn't exist,
// a new connection will be created.
static RenderWidgetMusConnection* GetOrCreate(int routing_id);
private:
friend class CompositorMusConnection;
friend class CompositorMusConnectionTest;
explicit RenderWidgetMusConnection(int routing_id);
~RenderWidgetMusConnection() override;
// RenderWidgetInputHandlerDelegate implementation:
void FocusChangeComplete() override;
bool HasTouchEventHandlersAt(const gfx::Point& point) const override;
void ObserveWheelEventAndResult(const blink::WebMouseWheelEvent& wheel_event,
const gfx::Vector2dF& wheel_unused_delta,
bool event_processed) override;
void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event,
const gfx::Vector2dF& gesture_unused_delta,
bool event_processed) override;
void OnDidHandleKeyEvent() override;
void OnDidOverscroll(const DidOverscrollParams& params) override;
void OnInputEventAck(scoped_ptr<InputEventAck> input_event_ack) override;
void NotifyInputEventHandled(
blink::WebInputEvent::Type handled_type) override;
void SetInputHandler(RenderWidgetInputHandler* input_handler) override;
void UpdateTextInputState(ShowIme show_ime,
ChangeSource change_source) override;
bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override;
bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override;
void OnConnectionLost();
void OnWindowInputEvent(scoped_ptr<blink::WebInputEvent> input_event,
const base::Callback<void(bool)>& ack);
const int routing_id_;
RenderWidgetInputHandler* input_handler_;
scoped_ptr<mus::WindowSurfaceBinding> window_surface_binding_;
scoped_refptr<CompositorMusConnection> compositor_mus_connection_;
base::Callback<void(bool)> pending_ack_;
// Used to verify single threaded access.
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(RenderWidgetMusConnection);
};
} // namespace content
#endif // CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_
|