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

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: Use ContentBrowserClient to override prefs. 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/app/settings_manager.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 #include "ui/base/ime/text_input_client.h" 20 #include "ui/base/ime/text_input_client.h"
20 21
21 namespace blink { 22 namespace blink {
22 class WebGestureEvent; 23 class WebGestureEvent;
23 } 24 }
24 25
25 namespace content { 26 namespace content {
26 class RenderWidgetHost; 27 class RenderWidgetHost;
27 } 28 }
28 29
29 namespace blimp { 30 namespace blimp {
31 namespace engine {
30 32
31 // Handles all incoming and outgoing protobuf message types tied to a specific 33 // Handles all incoming and outgoing protobuf message types tied to a specific
32 // RenderWidget. This includes BlimpMessage::INPUT, BlimpMessage::COMPOSITOR, 34 // RenderWidget. This includes BlimpMessage::INPUT, BlimpMessage::COMPOSITOR,
33 // and BlimpMessage::RENDER_WIDGET messages. Delegates can be added to be 35 // and BlimpMessage::RENDER_WIDGET messages. Delegates can be added to be
34 // notified of incoming messages. This class automatically handles dropping 36 // notified of incoming messages. This class automatically handles dropping
35 // stale BlimpMessage::RENDER_WIDGET messages from the client after a 37 // stale BlimpMessage::RENDER_WIDGET messages from the client after a
36 // RenderWidgetMessage::INITIALIZE message is sent. 38 // RenderWidgetMessage::INITIALIZE message is sent.
37 class EngineRenderWidgetFeature : public BlimpMessageProcessor { 39 class EngineRenderWidgetFeature : public BlimpMessageProcessor,
40 public SettingsManager::Observer {
38 public: 41 public:
39 // A delegate to be notified of specific RenderWidget related incoming events. 42 // A delegate to be notified of specific RenderWidget related incoming events.
40 class RenderWidgetMessageDelegate { 43 class RenderWidgetMessageDelegate {
41 public: 44 public:
42 // Called when the client is sending a WebGestureEvent to the engine. 45 // Called when the client is sending a WebGestureEvent to the engine.
43 virtual void OnWebGestureEvent( 46 virtual void OnWebGestureEvent(
44 content::RenderWidgetHost* render_widget_host, 47 content::RenderWidgetHost* render_widget_host,
45 scoped_ptr<blink::WebGestureEvent> event) = 0; 48 scoped_ptr<blink::WebGestureEvent> event) = 0;
46 49
47 // Called when the client sent a CompositorMessage. These messages should 50 // Called when the client sent a CompositorMessage. These messages should
48 // be sent to the engine's render process so they can be processed by the 51 // be sent to the engine's render process so they can be processed by the
49 // RemoteChannel of the compositor. 52 // RemoteChannel of the compositor.
50 virtual void OnCompositorMessageReceived( 53 virtual void OnCompositorMessageReceived(
51 content::RenderWidgetHost* render_widget_host, 54 content::RenderWidgetHost* render_widget_host,
52 const std::vector<uint8_t>& message) = 0; 55 const std::vector<uint8_t>& message) = 0;
53 }; 56 };
54 57
55 EngineRenderWidgetFeature(); 58 explicit EngineRenderWidgetFeature(SettingsManager* settings);
56 ~EngineRenderWidgetFeature() override; 59 ~EngineRenderWidgetFeature() override;
57 60
58 void set_render_widget_message_sender( 61 void set_render_widget_message_sender(
59 scoped_ptr<BlimpMessageProcessor> message_processor); 62 scoped_ptr<BlimpMessageProcessor> message_processor);
60 63
61 void set_input_message_sender( 64 void set_input_message_sender(
62 scoped_ptr<BlimpMessageProcessor> message_processor); 65 scoped_ptr<BlimpMessageProcessor> message_processor);
63 66
64 void set_compositor_message_sender( 67 void set_compositor_message_sender(
65 scoped_ptr<BlimpMessageProcessor> message_processor); 68 scoped_ptr<BlimpMessageProcessor> message_processor);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Sets a RenderWidgetMessageDelegate to be notified of all incoming 105 // Sets a RenderWidgetMessageDelegate to be notified of all incoming
103 // RenderWidget related messages for |tab_id| from the client. There can only 106 // RenderWidget related messages for |tab_id| from the client. There can only
104 // be one RenderWidgetMessageDelegate per tab. 107 // be one RenderWidgetMessageDelegate per tab.
105 void SetDelegate(const int tab_id, RenderWidgetMessageDelegate* delegate); 108 void SetDelegate(const int tab_id, RenderWidgetMessageDelegate* delegate);
106 void RemoveDelegate(const int tab_id); 109 void RemoveDelegate(const int tab_id);
107 110
108 // BlimpMessageProcessor implementation. 111 // BlimpMessageProcessor implementation.
109 void ProcessMessage(scoped_ptr<BlimpMessage> message, 112 void ProcessMessage(scoped_ptr<BlimpMessage> message,
110 const net::CompletionCallback& callback) override; 113 const net::CompletionCallback& callback) override;
111 114
115 // Settings::Observer implementation.
116 void OnWebPreferencesChanged() override;
117
112 private: 118 private:
113 typedef base::SmallMap<std::map<int, RenderWidgetMessageDelegate*> > 119 typedef base::SmallMap<std::map<int, RenderWidgetMessageDelegate*> >
114 DelegateMap; 120 DelegateMap;
115 121
116 typedef base::SmallMap<std::map<content::RenderWidgetHost*, int>> 122 typedef base::SmallMap<std::map<content::RenderWidgetHost*, int>>
117 RenderWidgetToIdMap; 123 RenderWidgetToIdMap;
118 124
119 typedef base::SmallMap<std::map<int, content::RenderWidgetHost*>> 125 typedef base::SmallMap<std::map<int, content::RenderWidgetHost*>>
120 IdToRenderWidgetMap; 126 IdToRenderWidgetMap;
121 127
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // But we generate our own ids to avoid having the render widget protocol tied 165 // But we generate our own ids to avoid having the render widget protocol tied
160 // to always using a combination of these ids, generated by the content layer. 166 // to always using a combination of these ids, generated by the content layer.
161 // By using an AtomicSequenceNumber for identifying render widgets across 167 // By using an AtomicSequenceNumber for identifying render widgets across
162 // tabs, we can be sure that there will always be a 1:1 mapping between the 168 // tabs, we can be sure that there will always be a 1:1 mapping between the
163 // render widget and the consumer of the features tied to this widget on the 169 // render widget and the consumer of the features tied to this widget on the
164 // client, which is the BlimpCompositor. 170 // client, which is the BlimpCompositor.
165 base::AtomicSequenceNumber next_widget_id_; 171 base::AtomicSequenceNumber next_widget_id_;
166 172
167 InputMessageConverter input_message_converter_; 173 InputMessageConverter input_message_converter_;
168 174
175 SettingsManager* settings_manager_;
176
169 // Outgoing message processors for RENDER_WIDGET, COMPOSITOR and INPUT types. 177 // Outgoing message processors for RENDER_WIDGET, COMPOSITOR and INPUT types.
170 scoped_ptr<BlimpMessageProcessor> render_widget_message_sender_; 178 scoped_ptr<BlimpMessageProcessor> render_widget_message_sender_;
171 scoped_ptr<BlimpMessageProcessor> compositor_message_sender_; 179 scoped_ptr<BlimpMessageProcessor> compositor_message_sender_;
172 scoped_ptr<BlimpMessageProcessor> input_message_sender_; 180 scoped_ptr<BlimpMessageProcessor> input_message_sender_;
173 scoped_ptr<BlimpMessageProcessor> ime_message_sender_; 181 scoped_ptr<BlimpMessageProcessor> ime_message_sender_;
174 182
175 DISALLOW_COPY_AND_ASSIGN(EngineRenderWidgetFeature); 183 DISALLOW_COPY_AND_ASSIGN(EngineRenderWidgetFeature);
176 }; 184 };
177 185
186 } // namespace engine
178 } // namespace blimp 187 } // namespace blimp
179 188
180 #endif // BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ 189 #endif // BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_
OLDNEW
« no previous file with comments | « blimp/engine/app/settings_manager_unittest.cc ('k') | blimp/engine/feature/engine_render_widget_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698