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

Side by Side Diff: blimp/engine/session/blimp_engine_session.h

Issue 2035543002: [Blimp] Creates engine tab class to handle tab related operations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « blimp/engine/BUILD.gn ('k') | blimp/engine/session/blimp_engine_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SESSION_BLIMP_ENGINE_SESSION_H_ 5 #ifndef BLIMP_ENGINE_SESSION_BLIMP_ENGINE_SESSION_H_
6 #define BLIMP_ENGINE_SESSION_BLIMP_ENGINE_SESSION_H_ 6 #define BLIMP_ENGINE_SESSION_BLIMP_ENGINE_SESSION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "blimp/common/proto/blimp_message.pb.h" 14 #include "blimp/common/proto/blimp_message.pb.h"
15 #include "blimp/engine/feature/engine_render_widget_feature.h" 15 #include "blimp/engine/feature/engine_render_widget_feature.h"
16 #include "blimp/engine/feature/engine_settings_feature.h" 16 #include "blimp/engine/feature/engine_settings_feature.h"
17 #include "blimp/engine/session/page_load_tracker.h"
18 #include "blimp/net/blimp_message_processor.h" 17 #include "blimp/net/blimp_message_processor.h"
19 #include "blimp/net/connection_error_observer.h" 18 #include "blimp/net/connection_error_observer.h"
20 #include "content/public/browser/invalidate_type.h" 19 #include "content/public/browser/invalidate_type.h"
21 #include "content/public/browser/web_contents_delegate.h" 20 #include "content/public/browser/web_contents_delegate.h"
22 #include "content/public/browser/web_contents_observer.h"
23 #include "net/base/completion_callback.h" 21 #include "net/base/completion_callback.h"
24 #include "ui/base/ime/input_method_observer.h" 22 #include "ui/base/ime/input_method_observer.h"
25 #include "ui/gfx/geometry/size.h" 23 #include "ui/gfx/geometry/size.h"
26 24
27 namespace aura { 25 namespace aura {
28 class WindowTreeHost; 26 class WindowTreeHost;
29 27
30 namespace client { 28 namespace client {
31 class DefaultCaptureClient; 29 class DefaultCaptureClient;
32 class WindowTreeClient; 30 class WindowTreeClient;
(...skipping 27 matching lines...) Expand all
60 class SettingsManager; 58 class SettingsManager;
61 59
62 namespace engine { 60 namespace engine {
63 61
64 class BlimpBrowserContext; 62 class BlimpBrowserContext;
65 class BlimpEngineConfig; 63 class BlimpEngineConfig;
66 class BlimpFocusClient; 64 class BlimpFocusClient;
67 class BlimpScreen; 65 class BlimpScreen;
68 class BlimpWindowTreeHost; 66 class BlimpWindowTreeHost;
69 class EngineNetworkComponents; 67 class EngineNetworkComponents;
68 class Tab;
70 69
71 class BlimpEngineSession 70 class BlimpEngineSession
72 : public BlimpMessageProcessor, 71 : public BlimpMessageProcessor,
73 public content::WebContentsDelegate, 72 public content::WebContentsDelegate,
74 public content::WebContentsObserver,
75 public ui::InputMethodObserver, 73 public ui::InputMethodObserver,
76 public EngineRenderWidgetFeature::RenderWidgetMessageDelegate, 74 public EngineRenderWidgetFeature::RenderWidgetMessageDelegate {
77 public PageLoadTrackerClient {
78 public: 75 public:
79 using GetPortCallback = base::Callback<void(uint16_t)>; 76 using GetPortCallback = base::Callback<void(uint16_t)>;
80 77
81 BlimpEngineSession(std::unique_ptr<BlimpBrowserContext> browser_context, 78 BlimpEngineSession(std::unique_ptr<BlimpBrowserContext> browser_context,
82 net::NetLog* net_log, 79 net::NetLog* net_log,
83 BlimpEngineConfig* config, 80 BlimpEngineConfig* config,
84 SettingsManager* settings_manager); 81 SettingsManager* settings_manager);
85 ~BlimpEngineSession() override; 82 ~BlimpEngineSession() override;
86 83
87 // Starts the network stack on the IO thread, and sets default placeholder 84 // Starts the network stack on the IO thread, and sets default placeholder
(...skipping 10 matching lines...) Expand all
98 // This object handles incoming TAB_CONTROL and NAVIGATION messages directly. 95 // This object handles incoming TAB_CONTROL and NAVIGATION messages directly.
99 void ProcessMessage(std::unique_ptr<BlimpMessage> message, 96 void ProcessMessage(std::unique_ptr<BlimpMessage> message,
100 const net::CompletionCallback& callback) override; 97 const net::CompletionCallback& callback) override;
101 98
102 private: 99 private:
103 // Creates ThreadPipeManager, registers features, and then starts to accept 100 // Creates ThreadPipeManager, registers features, and then starts to accept
104 // incoming connection. 101 // incoming connection.
105 void RegisterFeatures(); 102 void RegisterFeatures();
106 103
107 // TabControlMessage handler methods. 104 // TabControlMessage handler methods.
108 // Creates a new WebContents, which will be indexed by |target_tab_id|. 105 // Creates a new tab, which will be indexed by |target_tab_id|.
109 // Returns true if a new WebContents is created, false otherwise. 106 // Returns true if a new tab is created, false otherwise.
110 bool CreateWebContents(const int target_tab_id); 107 bool CreateTab(const int target_tab_id);
111 108
112 void CloseWebContents(const int target_tab_id); 109 // Closes an existing tab, indexed by |target_tab_id|.
110 void CloseTab(const int target_tab_id);
111
112 // Resizes screen to |size| in pixels, and updates its device pixel ratio to
113 // |device_pixel_ratio|.
113 void HandleResize(float device_pixel_ratio, const gfx::Size& size); 114 void HandleResize(float device_pixel_ratio, const gfx::Size& size);
114 115
115 // NavigationMessage handler methods.
116 // Navigates the target tab to the |url|.
117 void LoadUrl(const int target_tab_id, const GURL& url);
118 void GoBack(const int target_tab_id);
119 void GoForward(const int target_tab_id);
120 void Reload(const int target_tab_id);
121
122 // RenderWidgetMessage handler methods. 116 // RenderWidgetMessage handler methods.
123 // RenderWidgetMessageDelegate implementation. 117 // RenderWidgetMessageDelegate implementation.
124 void OnWebGestureEvent( 118 void OnWebGestureEvent(
125 content::RenderWidgetHost* render_widget_host, 119 content::RenderWidgetHost* render_widget_host,
126 std::unique_ptr<blink::WebGestureEvent> event) override; 120 std::unique_ptr<blink::WebGestureEvent> event) override;
127 void OnCompositorMessageReceived( 121 void OnCompositorMessageReceived(
128 content::RenderWidgetHost* render_widget_host, 122 content::RenderWidgetHost* render_widget_host,
129 const std::vector<uint8_t>& message) override; 123 const std::vector<uint8_t>& message) override;
130 124
131 // content::WebContentsDelegate implementation. 125 // content::WebContentsDelegate implementation.
(...skipping 19 matching lines...) Expand all
151 145
152 // ui::InputMethodObserver overrides. 146 // ui::InputMethodObserver overrides.
153 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; 147 void OnTextInputTypeChanged(const ui::TextInputClient* client) override;
154 void OnFocus() override; 148 void OnFocus() override;
155 void OnBlur() override; 149 void OnBlur() override;
156 void OnCaretBoundsChanged(const ui::TextInputClient* client) override; 150 void OnCaretBoundsChanged(const ui::TextInputClient* client) override;
157 void OnTextInputStateChanged(const ui::TextInputClient* client) override; 151 void OnTextInputStateChanged(const ui::TextInputClient* client) override;
158 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override; 152 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override;
159 void OnShowImeIfNeeded() override; 153 void OnShowImeIfNeeded() override;
160 154
161 // content::WebContentsObserver implementation. 155 // Sets up |new_contents| to be associated with the root window.
162 void RenderViewCreated(content::RenderViewHost* render_view_host) override; 156 void PlatformSetContents(std::unique_ptr<content::WebContents> new_contents,
163 void RenderViewHostChanged(content::RenderViewHost* old_host, 157 const int target_tab_id);
164 content::RenderViewHost* new_host) override;
165 void RenderViewDeleted(content::RenderViewHost* render_view_host) override;
166
167 // PageLoadTrackerClient implementation.
168 void SendPageLoadStatusUpdate(PageLoadStatus load_status) override;
169
170 // Sets up and owns |new_contents|.
171 void PlatformSetContents(std::unique_ptr<content::WebContents> new_contents);
172 158
173 // Presents the client's single screen. 159 // Presents the client's single screen.
174 // Screen should be deleted after browser context (crbug.com/613372). 160 // Screen should be deleted after browser context (crbug.com/613372).
175 std::unique_ptr<BlimpScreen> screen_; 161 std::unique_ptr<BlimpScreen> screen_;
176 162
177 // Content BrowserContext for this session. 163 // Content BrowserContext for this session.
178 std::unique_ptr<BlimpBrowserContext> browser_context_; 164 std::unique_ptr<BlimpBrowserContext> browser_context_;
179 165
180 // Engine configuration including assigned client token. 166 // Engine configuration including assigned client token.
181 BlimpEngineConfig* engine_config_; 167 BlimpEngineConfig* engine_config_;
182 168
183 // Represents the (currently single) browser window into which tab(s) will 169 // Represents the (currently single) browser window into which tab(s) will
184 // be rendered. 170 // be rendered.
185 std::unique_ptr<BlimpWindowTreeHost> window_tree_host_; 171 std::unique_ptr<BlimpWindowTreeHost> window_tree_host_;
186 172
187 // Used to apply standard focus conventions to the windows in the 173 // Used to apply standard focus conventions to the windows in the
188 // WindowTreeHost hierarchy. 174 // WindowTreeHost hierarchy.
189 std::unique_ptr<wm::FocusController> focus_client_; 175 std::unique_ptr<wm::FocusController> focus_client_;
190 176
191 // Used to manage input capture. 177 // Used to manage input capture.
192 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; 178 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_;
193 179
194 // Used to attach null-parented windows (e.g. popups) to the root window. 180 // Used to attach null-parented windows (e.g. popups) to the root window.
195 std::unique_ptr<aura::client::WindowTreeClient> window_tree_client_; 181 std::unique_ptr<aura::client::WindowTreeClient> window_tree_client_;
196 182
197 // Only one web_contents is supported for blimp 0.5
198 std::unique_ptr<content::WebContents> web_contents_;
199
200 // Tracks the page load status for a tab. Each PageLoadTracker is tied to a
201 // WebContents.
202 std::unique_ptr<PageLoadTracker> page_load_tracker_;
203
204 // Manages all global settings for the engine session. 183 // Manages all global settings for the engine session.
205 SettingsManager* settings_manager_; 184 SettingsManager* settings_manager_;
206 185
207 // Handles all incoming messages for type SETTINGS. 186 // Handles all incoming messages for type SETTINGS.
208 EngineSettingsFeature settings_feature_; 187 EngineSettingsFeature settings_feature_;
209 188
210 // Handles all incoming and outgoing messages related to RenderWidget, 189 // Handles all incoming and outgoing messages related to RenderWidget,
211 // including INPUT, COMPOSITOR and RENDER_WIDGET messages. 190 // including INPUT, COMPOSITOR and RENDER_WIDGET messages.
212 EngineRenderWidgetFeature render_widget_feature_; 191 EngineRenderWidgetFeature render_widget_feature_;
213 192
214 // Container for connection manager, authentication handler, and 193 // Container for connection manager, authentication handler, and
215 // browser connection handler. The components run on the I/O thread, and 194 // browser connection handler. The components run on the I/O thread, and
216 // this object is destroyed there. 195 // this object is destroyed there.
217 std::unique_ptr<EngineNetworkComponents> net_components_; 196 std::unique_ptr<EngineNetworkComponents> net_components_;
218 197
219 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; 198 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
220 199
221 // Used to send TAB_CONTROL or NAVIGATION messages to client. 200 // Used to send TAB_CONTROL or NAVIGATION messages to client.
222 std::unique_ptr<BlimpMessageProcessor> tab_control_message_sender_; 201 std::unique_ptr<BlimpMessageProcessor> tab_control_message_sender_;
223 std::unique_ptr<BlimpMessageProcessor> navigation_message_sender_; 202 std::unique_ptr<BlimpMessageProcessor> navigation_message_sender_;
224 203
204 // TODO(haibinlu): Support more than one tab (crbug/547231)
205 std::unique_ptr<Tab> tab_;
206
225 DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession); 207 DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession);
226 }; 208 };
227 209
228 } // namespace engine 210 } // namespace engine
229 } // namespace blimp 211 } // namespace blimp
230 212
231 #endif // BLIMP_ENGINE_SESSION_BLIMP_ENGINE_SESSION_H_ 213 #endif // BLIMP_ENGINE_SESSION_BLIMP_ENGINE_SESSION_H_
OLDNEW
« no previous file with comments | « blimp/engine/BUILD.gn ('k') | blimp/engine/session/blimp_engine_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698