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

Side by Side Diff: blimp/client/session/render_widget_feature.h

Issue 1636163002: Restructure contents of blimp/client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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_SESSION_RENDER_WIDGET_FEATURE_H_
6 #define BLIMP_CLIENT_SESSION_RENDER_WIDGET_FEATURE_H_
7
8 #include <stdint.h>
9
10 #include "base/containers/small_map.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "blimp/client/blimp_client_export.h"
14 #include "blimp/net/blimp_message_processor.h"
15 #include "blimp/net/input_message_generator.h"
16
17 namespace blink {
18 class WebInputEvent;
19 }
20
21 namespace cc {
22 namespace proto {
23 class CompositorMessage;
24 }
25 }
26
27 namespace blimp {
28 namespace client {
29
30 // Handles all incoming and outgoing protobuf message types tied to a specific
31 // RenderWidget. This includes BlimpMessage::INPUT, BlimpMessage::COMPOSITOR,
32 // and BlimpMessage::RENDER_WIDGET messages. Delegates can be added to be
33 // notified of incoming messages. This class automatically attaches a specific
34 // id so that the engine can drop stale RenderWidget related messages after it
35 // sends a RenderWidgetMessage::INITIALIZE message.
36 class BLIMP_CLIENT_EXPORT RenderWidgetFeature : public BlimpMessageProcessor {
37 public:
38 // A delegate to be notified of specific RenderWidget related incoming events.
39 class RenderWidgetFeatureDelegate {
40 public:
41 // Called when the engine's RenderWidget has changed for a particular
42 // WebContents. When this is received all state related to the existing
43 // client RenderWidget should be reset.
44 virtual void OnRenderWidgetInitialized() = 0;
45
46 // Called when the engine sent a CompositorMessage. These messages should
47 // be sent to the client's RemoteChannel of the compositor.
48 virtual void OnCompositorMessageReceived(
49 scoped_ptr<cc::proto::CompositorMessage> message) = 0;
50 };
51
52 RenderWidgetFeature();
53 ~RenderWidgetFeature() override;
54
55 // Set the BlimpMessageProcessor that will be used to send BlimpMessage::INPUT
56 // messages to the engine.
57 void set_outgoing_input_message_processor(
58 scoped_ptr<BlimpMessageProcessor> processor);
59
60 // Set the BlimpMessageProcessor that will be used to send
61 // BlimpMessage::COMPOSITOR messages to the engine.
62 void set_outgoing_compositor_message_processor(
63 scoped_ptr<BlimpMessageProcessor> processor);
64
65 // Sends a WebInputEvent for |tab_id| to the engine.
66 void SendInputEvent(const int tab_id, const blink::WebInputEvent& event);
67
68 // Sends a CompositorMessage for |tab_id| to the engine.
69 void SendCompositorMessage(const int tab_id,
70 const cc::proto::CompositorMessage& message);
71
72 // Sets a RenderWidgetMessageDelegate to be notified of all incoming
73 // RenderWidget related messages for |tab_id| from the engine. There can only
74 // be one RenderWidgetMessageDelegate per tab.
75 void SetDelegate(const int tab_id, RenderWidgetFeatureDelegate* delegate);
76 void RemoveDelegate(const int tab_id);
77
78 private:
79 // BlimpMessageProcessor implementation.
80 void ProcessMessage(scoped_ptr<BlimpMessage> message,
81 const net::CompletionCallback& callback) override;
82
83 // Returns nullptr if no delegate is found.
84 RenderWidgetFeatureDelegate* FindDelegate(const int tab_id);
85
86 // Returns 0 if no id is found.
87 uint32_t GetRenderWidgetId(const int tab_id);
88
89 typedef base::SmallMap<std::map<int, RenderWidgetFeatureDelegate*>>
90 DelegateMap;
91 typedef base::SmallMap<std::map<int, uint32_t>> RenderWidgetIdMap;
92
93 DelegateMap delegates_;
94 RenderWidgetIdMap render_widget_ids_;
95
96 InputMessageGenerator input_message_generator_;
97
98 // Used to send BlimpMessage::INPUT type messages to the engine.
99 scoped_ptr<BlimpMessageProcessor> outgoing_input_message_processor_;
100
101 // Used to send BlimpMessage::COMPOSITOR messages to the engine.
102 scoped_ptr<BlimpMessageProcessor> outgoing_compositor_message_processor_;
103
104 DISALLOW_COPY_AND_ASSIGN(RenderWidgetFeature);
105 };
106
107 } // namespace client
108 } // namespace blimp
109
110 #endif // BLIMP_CLIENT_SESSION_RENDER_WIDGET_FEATURE_H_
OLDNEW
« no previous file with comments | « blimp/client/session/navigation_feature_unittest.cc ('k') | blimp/client/session/render_widget_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698