OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_ | 5 #ifndef CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_ |
6 #define CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_ | 6 #define CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
10 #include "cc/output/output_surface.h" | 10 #include "cc/output/output_surface.h" |
11 #include "components/mus/public/cpp/window_surface.h" | 11 #include "components/mus/public/cpp/window_surface.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/renderer/input/render_widget_input_handler_delegate.h" | 13 #include "content/renderer/input/render_widget_input_handler_delegate.h" |
14 #include "content/renderer/mus/compositor_mus_connection.h" | 14 #include "content/renderer/mus/compositor_mus_connection.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 class InputHandlerManager; | 18 class InputHandlerManager; |
19 | 19 |
20 // Use on main thread. | 20 // Use on main thread. |
21 class CONTENT_EXPORT RenderWidgetMusConnection | 21 class CONTENT_EXPORT RenderWidgetMusConnection |
22 : public RenderWidgetInputHandlerDelegate { | 22 : public RenderWidgetInputHandlerDelegate { |
23 public: | 23 public: |
24 // Bind to a WindowTreeClient request. | 24 // Bind to a WindowTreeClient request. |
25 void Bind(mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request); | 25 void Bind(mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request); |
26 | 26 |
27 // Create a cc output surface. | 27 // Create a cc output surface. |
28 scoped_ptr<cc::OutputSurface> CreateOutputSurface(); | 28 std::unique_ptr<cc::OutputSurface> CreateOutputSurface(); |
29 | 29 |
30 static RenderWidgetMusConnection* Get(int routing_id); | 30 static RenderWidgetMusConnection* Get(int routing_id); |
31 | 31 |
32 // Get the connection from a routing_id, if the connection doesn't exist, | 32 // Get the connection from a routing_id, if the connection doesn't exist, |
33 // a new connection will be created. | 33 // a new connection will be created. |
34 static RenderWidgetMusConnection* GetOrCreate(int routing_id); | 34 static RenderWidgetMusConnection* GetOrCreate(int routing_id); |
35 | 35 |
36 private: | 36 private: |
37 friend class CompositorMusConnection; | 37 friend class CompositorMusConnection; |
38 friend class CompositorMusConnectionTest; | 38 friend class CompositorMusConnectionTest; |
39 | 39 |
40 explicit RenderWidgetMusConnection(int routing_id); | 40 explicit RenderWidgetMusConnection(int routing_id); |
41 ~RenderWidgetMusConnection() override; | 41 ~RenderWidgetMusConnection() override; |
42 | 42 |
43 // RenderWidgetInputHandlerDelegate implementation: | 43 // RenderWidgetInputHandlerDelegate implementation: |
44 void FocusChangeComplete() override; | 44 void FocusChangeComplete() override; |
45 bool HasTouchEventHandlersAt(const gfx::Point& point) const override; | 45 bool HasTouchEventHandlersAt(const gfx::Point& point) const override; |
46 void ObserveWheelEventAndResult(const blink::WebMouseWheelEvent& wheel_event, | 46 void ObserveWheelEventAndResult(const blink::WebMouseWheelEvent& wheel_event, |
47 const gfx::Vector2dF& wheel_unused_delta, | 47 const gfx::Vector2dF& wheel_unused_delta, |
48 bool event_processed) override; | 48 bool event_processed) override; |
49 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event, | 49 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event, |
50 const gfx::Vector2dF& gesture_unused_delta, | 50 const gfx::Vector2dF& gesture_unused_delta, |
51 bool event_processed) override; | 51 bool event_processed) override; |
52 void OnDidHandleKeyEvent() override; | 52 void OnDidHandleKeyEvent() override; |
53 void OnDidOverscroll(const DidOverscrollParams& params) override; | 53 void OnDidOverscroll(const DidOverscrollParams& params) override; |
54 void OnInputEventAck(scoped_ptr<InputEventAck> input_event_ack) override; | 54 void OnInputEventAck(std::unique_ptr<InputEventAck> input_event_ack) override; |
55 void NotifyInputEventHandled( | 55 void NotifyInputEventHandled( |
56 blink::WebInputEvent::Type handled_type) override; | 56 blink::WebInputEvent::Type handled_type) override; |
57 void SetInputHandler(RenderWidgetInputHandler* input_handler) override; | 57 void SetInputHandler(RenderWidgetInputHandler* input_handler) override; |
58 void UpdateTextInputState(ShowIme show_ime, | 58 void UpdateTextInputState(ShowIme show_ime, |
59 ChangeSource change_source) override; | 59 ChangeSource change_source) override; |
60 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override; | 60 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override; |
61 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override; | 61 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override; |
62 | 62 |
63 void OnConnectionLost(); | 63 void OnConnectionLost(); |
64 void OnWindowInputEvent(scoped_ptr<blink::WebInputEvent> input_event, | 64 void OnWindowInputEvent(std::unique_ptr<blink::WebInputEvent> input_event, |
65 const base::Callback<void(bool)>& ack); | 65 const base::Callback<void(bool)>& ack); |
66 | 66 |
67 const int routing_id_; | 67 const int routing_id_; |
68 RenderWidgetInputHandler* input_handler_; | 68 RenderWidgetInputHandler* input_handler_; |
69 scoped_ptr<mus::WindowSurfaceBinding> window_surface_binding_; | 69 std::unique_ptr<mus::WindowSurfaceBinding> window_surface_binding_; |
70 scoped_refptr<CompositorMusConnection> compositor_mus_connection_; | 70 scoped_refptr<CompositorMusConnection> compositor_mus_connection_; |
71 | 71 |
72 base::Callback<void(bool)> pending_ack_; | 72 base::Callback<void(bool)> pending_ack_; |
73 | 73 |
74 // Used to verify single threaded access. | 74 // Used to verify single threaded access. |
75 base::ThreadChecker thread_checker_; | 75 base::ThreadChecker thread_checker_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(RenderWidgetMusConnection); | 77 DISALLOW_COPY_AND_ASSIGN(RenderWidgetMusConnection); |
78 }; | 78 }; |
79 | 79 |
80 } // namespace content | 80 } // namespace content |
81 | 81 |
82 #endif // CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_ | 82 #endif // CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_ |
OLD | NEW |