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

Side by Side Diff: blimp/client/core/render_widget/render_widget_feature.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_RENDER_WIDGET_RENDER_WIDGET_FEATURE_H_
6 #define BLIMP_CLIENT_CORE_RENDER_WIDGET_RENDER_WIDGET_FEATURE_H_
7
8 #include <stdint.h>
9
10 #include <map>
11 #include <memory>
12
13 #include "base/containers/small_map.h"
14 #include "base/macros.h"
15 #include "blimp/net/blimp_message_processor.h"
16 #include "blimp/net/input_message_generator.h"
17
18 namespace blink {
19 class WebGestureEvent;
20 }
21
22 namespace cc {
23 namespace proto {
24 class CompositorMessage;
25 }
26 }
27
28 namespace blimp {
29 class RenderWidgetMessage;
30 class CompositorMessage;
31
32 namespace client {
33
34 // Handles all incoming and outgoing protobuf message types tied to a specific
35 // RenderWidget. This includes BlimpMessage::INPUT, BlimpMessage::COMPOSITOR,
36 // and BlimpMessage::RENDER_WIDGET messages. Delegates can be added to be
37 // notified of incoming messages. This class automatically attaches a specific
38 // id so that the engine can drop stale RenderWidget related messages after it
39 // sends a RenderWidgetMessage::INITIALIZE message.
40 class RenderWidgetFeature : public BlimpMessageProcessor {
41 public:
42 // A delegate to be notified of specific RenderWidget related incoming events.
43 class RenderWidgetFeatureDelegate {
44 public:
45 virtual ~RenderWidgetFeatureDelegate() {}
46 virtual void OnRenderWidgetCreated(int render_widget_id) = 0;
47
48 // Called when the engine's RenderWidget has changed for a particular
49 // WebContents. When this is received all state related to the existing
50 // client RenderWidget should be reset.
51 virtual void OnRenderWidgetInitialized(int render_widget_id) = 0;
52
53 virtual void OnRenderWidgetDeleted(int render_widget_id) = 0;
54
55 // Called when the engine sent a CompositorMessage. These messages should
56 // be sent to the client's RemoteChannel of the compositor.
57 virtual void OnCompositorMessageReceived(
58 int render_widget_id,
59 std::unique_ptr<cc::proto::CompositorMessage> message) = 0;
60 };
61
62 RenderWidgetFeature();
63 ~RenderWidgetFeature() override;
64
65 // Set the BlimpMessageProcessor that will be used to send BlimpMessage::INPUT
66 // messages to the engine.
67 void set_outgoing_input_message_processor(
68 std::unique_ptr<BlimpMessageProcessor> processor);
69
70 // Set the BlimpMessageProcessor that will be used to send
71 // BlimpMessage::COMPOSITOR messages to the engine.
72 void set_outgoing_compositor_message_processor(
73 std::unique_ptr<BlimpMessageProcessor> processor);
74
75 // Sends a WebGestureEvent for |tab_id| to the engine.
76 // virtual for testing.
77 virtual void SendWebGestureEvent(const int tab_id,
78 const int render_widget_id,
79 const blink::WebGestureEvent& event);
80
81 // Sends a CompositorMessage for |tab_id| to the engine.
82 // virtual for testing.
83 virtual void SendCompositorMessage(
84 const int tab_id,
85 const int render_widget_id,
86 const cc::proto::CompositorMessage& message);
87
88 // Sets a RenderWidgetMessageDelegate to be notified of all incoming
89 // RenderWidget related messages for |tab_id| from the engine. There can only
90 // be one RenderWidgetMessageDelegate per tab.
91 // virtual for testing.
92 virtual void SetDelegate(int tab_id, RenderWidgetFeatureDelegate* delegate);
93 virtual void RemoveDelegate(const int tab_id);
94
95 // BlimpMessageProcessor implementation.
96 void ProcessMessage(std::unique_ptr<BlimpMessage> message,
97 const net::CompletionCallback& callback) override;
98
99 private:
100 void ProcessRenderWidgetMessage(RenderWidgetFeatureDelegate* delegate,
101 const RenderWidgetMessage& message);
102
103 void ProcessCompositorMessage(RenderWidgetFeatureDelegate* delegate,
104 const CompositorMessage& message);
105
106 // Returns nullptr if no delegate is found.
107 RenderWidgetFeatureDelegate* FindDelegate(const int tab_id);
108
109 typedef base::SmallMap<std::map<int, RenderWidgetFeatureDelegate*>>
110 DelegateMap;
111
112 DelegateMap delegates_;
113
114 InputMessageGenerator input_message_generator_;
115
116 // Used to send BlimpMessage::INPUT type messages to the engine.
117 std::unique_ptr<BlimpMessageProcessor> outgoing_input_message_processor_;
118
119 // Used to send BlimpMessage::COMPOSITOR messages to the engine.
120 std::unique_ptr<BlimpMessageProcessor> outgoing_compositor_message_processor_;
121
122 DISALLOW_COPY_AND_ASSIGN(RenderWidgetFeature);
123 };
124
125 } // namespace client
126 } // namespace blimp
127
128 #endif // BLIMP_CLIENT_CORE_RENDER_WIDGET_RENDER_WIDGET_FEATURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698