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

Side by Side Diff: blimp/engine/feature/engine_render_widget_feature.h

Issue 1810213009: blimp: Add settings to allow the client to download the whole page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@record_full_document
Patch Set: Created 4 years, 9 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
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 BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ 5 #ifndef BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_
6 #define BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ 6 #define BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/atomic_sequence_num.h" 13 #include "base/atomic_sequence_num.h"
14 #include "base/containers/small_map.h" 14 #include "base/containers/small_map.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "blimp/engine/feature/engine_settings_feature.h"
17 #include "blimp/net/blimp_message_processor.h" 18 #include "blimp/net/blimp_message_processor.h"
18 #include "blimp/net/input_message_converter.h" 19 #include "blimp/net/input_message_converter.h"
19 20
20 namespace blink { 21 namespace blink {
21 class WebGestureEvent; 22 class WebGestureEvent;
22 } 23 }
23 24
24 namespace content { 25 namespace content {
25 class RenderWidgetHost; 26 class RenderWidgetHost;
26 } 27 }
27 28
28 namespace blimp { 29 namespace blimp {
29 30
30 // Handles all incoming and outgoing protobuf message types tied to a specific 31 // Handles all incoming and outgoing protobuf message types tied to a specific
31 // RenderWidget. This includes BlimpMessage::INPUT, BlimpMessage::COMPOSITOR, 32 // RenderWidget. This includes BlimpMessage::INPUT, BlimpMessage::COMPOSITOR,
32 // and BlimpMessage::RENDER_WIDGET messages. Delegates can be added to be 33 // and BlimpMessage::RENDER_WIDGET messages. Delegates can be added to be
33 // notified of incoming messages. This class automatically handles dropping 34 // notified of incoming messages. This class automatically handles dropping
34 // stale BlimpMessage::RENDER_WIDGET messages from the client after a 35 // stale BlimpMessage::RENDER_WIDGET messages from the client after a
35 // RenderWidgetMessage::INITIALIZE message is sent. 36 // RenderWidgetMessage::INITIALIZE message is sent.
36 class EngineRenderWidgetFeature : public BlimpMessageProcessor { 37 class EngineRenderWidgetFeature : public BlimpMessageProcessor,
38 public EngineSettingsFeature::Observer {
37 public: 39 public:
38 // A delegate to be notified of specific RenderWidget related incoming events. 40 // A delegate to be notified of specific RenderWidget related incoming events.
39 class RenderWidgetMessageDelegate { 41 class RenderWidgetMessageDelegate {
40 public: 42 public:
41 // Called when the client is sending a WebGestureEvent to the engine. 43 // Called when the client is sending a WebGestureEvent to the engine.
42 virtual void OnWebGestureEvent( 44 virtual void OnWebGestureEvent(
43 content::RenderWidgetHost* render_widget_host, 45 content::RenderWidgetHost* render_widget_host,
44 scoped_ptr<blink::WebGestureEvent> event) = 0; 46 scoped_ptr<blink::WebGestureEvent> event) = 0;
45 47
46 // Called when the client sent a CompositorMessage. These messages should 48 // Called when the client sent a CompositorMessage. These messages should
47 // be sent to the engine's render process so they can be processed by the 49 // be sent to the engine's render process so they can be processed by the
48 // RemoteChannel of the compositor. 50 // RemoteChannel of the compositor.
49 virtual void OnCompositorMessageReceived( 51 virtual void OnCompositorMessageReceived(
50 content::RenderWidgetHost* render_widget_host, 52 content::RenderWidgetHost* render_widget_host,
51 const std::vector<uint8_t>& message) = 0; 53 const std::vector<uint8_t>& message) = 0;
52 }; 54 };
53 55
54 EngineRenderWidgetFeature(); 56 explicit EngineRenderWidgetFeature(EngineSettingsFeature* settings);
55 ~EngineRenderWidgetFeature() override; 57 ~EngineRenderWidgetFeature() override;
56 58
57 void set_render_widget_message_sender( 59 void set_render_widget_message_sender(
58 scoped_ptr<BlimpMessageProcessor> message_processor); 60 scoped_ptr<BlimpMessageProcessor> message_processor);
59 61
60 void set_input_message_sender( 62 void set_input_message_sender(
61 scoped_ptr<BlimpMessageProcessor> message_processor); 63 scoped_ptr<BlimpMessageProcessor> message_processor);
62 64
63 void set_compositor_message_sender( 65 void set_compositor_message_sender(
64 scoped_ptr<BlimpMessageProcessor> message_processor); 66 scoped_ptr<BlimpMessageProcessor> message_processor);
(...skipping 26 matching lines...) Expand all
91 // Sets a RenderWidgetMessageDelegate to be notified of all incoming 93 // Sets a RenderWidgetMessageDelegate to be notified of all incoming
92 // RenderWidget related messages for |tab_id| from the client. There can only 94 // RenderWidget related messages for |tab_id| from the client. There can only
93 // be one RenderWidgetMessageDelegate per tab. 95 // be one RenderWidgetMessageDelegate per tab.
94 void SetDelegate(const int tab_id, RenderWidgetMessageDelegate* delegate); 96 void SetDelegate(const int tab_id, RenderWidgetMessageDelegate* delegate);
95 void RemoveDelegate(const int tab_id); 97 void RemoveDelegate(const int tab_id);
96 98
97 // BlimpMessageProcessor implementation. 99 // BlimpMessageProcessor implementation.
98 void ProcessMessage(scoped_ptr<BlimpMessage> message, 100 void ProcessMessage(scoped_ptr<BlimpMessage> message,
99 const net::CompletionCallback& callback) override; 101 const net::CompletionCallback& callback) override;
100 102
103 // EngineSettingsFeature::Observer implementation.
104 void OnWebPreferencesChanged() override;
105
101 private: 106 private:
102 typedef base::SmallMap<std::map<int, RenderWidgetMessageDelegate*> > 107 typedef base::SmallMap<std::map<int, RenderWidgetMessageDelegate*> >
103 DelegateMap; 108 DelegateMap;
104 109
105 typedef base::SmallMap<std::map<content::RenderWidgetHost*, int>> 110 typedef base::SmallMap<std::map<content::RenderWidgetHost*, int>>
106 RenderWidgetToIdMap; 111 RenderWidgetToIdMap;
107 112
108 typedef base::SmallMap<std::map<int, content::RenderWidgetHost*>> 113 typedef base::SmallMap<std::map<int, content::RenderWidgetHost*>>
109 IdToRenderWidgetMap; 114 IdToRenderWidgetMap;
110 115
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // But we generate our own ids to avoid having the render widget protocol tied 149 // But we generate our own ids to avoid having the render widget protocol tied
145 // to always using a combination of these ids, generated by the content layer. 150 // to always using a combination of these ids, generated by the content layer.
146 // By using an AtomicSequenceNumber for identifying render widgets across 151 // By using an AtomicSequenceNumber for identifying render widgets across
147 // tabs, we can be sure that there will always be a 1:1 mapping between the 152 // tabs, we can be sure that there will always be a 1:1 mapping between the
148 // render widget and the consumer of the features tied to this widget on the 153 // render widget and the consumer of the features tied to this widget on the
149 // client, which is the BlimpCompositor. 154 // client, which is the BlimpCompositor.
150 base::AtomicSequenceNumber next_widget_id_; 155 base::AtomicSequenceNumber next_widget_id_;
151 156
152 InputMessageConverter input_message_converter_; 157 InputMessageConverter input_message_converter_;
153 158
159 EngineSettingsFeature* settings_feature_;
160
154 // Outgoing message processors for RENDER_WIDGET, COMPOSITOR and INPUT types. 161 // Outgoing message processors for RENDER_WIDGET, COMPOSITOR and INPUT types.
155 scoped_ptr<BlimpMessageProcessor> render_widget_message_sender_; 162 scoped_ptr<BlimpMessageProcessor> render_widget_message_sender_;
156 scoped_ptr<BlimpMessageProcessor> compositor_message_sender_; 163 scoped_ptr<BlimpMessageProcessor> compositor_message_sender_;
157 scoped_ptr<BlimpMessageProcessor> input_message_sender_; 164 scoped_ptr<BlimpMessageProcessor> input_message_sender_;
158 165
159 DISALLOW_COPY_AND_ASSIGN(EngineRenderWidgetFeature); 166 DISALLOW_COPY_AND_ASSIGN(EngineRenderWidgetFeature);
160 }; 167 };
161 168
162 } // namespace blimp 169 } // namespace blimp
163 170
164 #endif // BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ 171 #endif // BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698