OLD | NEW |
---|---|
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" | |
17 #include "blimp/net/blimp_message_processor.h" | 18 #include "blimp/net/blimp_message_processor.h" |
18 #include "blimp/net/connection_error_observer.h" | 19 #include "blimp/net/connection_error_observer.h" |
19 #include "content/public/browser/invalidate_type.h" | 20 #include "content/public/browser/invalidate_type.h" |
20 #include "content/public/browser/web_contents_delegate.h" | 21 #include "content/public/browser/web_contents_delegate.h" |
21 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
22 #include "net/base/completion_callback.h" | 23 #include "net/base/completion_callback.h" |
23 #include "ui/base/ime/input_method_observer.h" | 24 #include "ui/base/ime/input_method_observer.h" |
24 #include "ui/gfx/geometry/size.h" | 25 #include "ui/gfx/geometry/size.h" |
25 | 26 |
26 namespace aura { | 27 namespace aura { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 class BlimpFocusClient; | 66 class BlimpFocusClient; |
66 class BlimpScreen; | 67 class BlimpScreen; |
67 class BlimpWindowTreeHost; | 68 class BlimpWindowTreeHost; |
68 class EngineNetworkComponents; | 69 class EngineNetworkComponents; |
69 | 70 |
70 class BlimpEngineSession | 71 class BlimpEngineSession |
71 : public BlimpMessageProcessor, | 72 : public BlimpMessageProcessor, |
72 public content::WebContentsDelegate, | 73 public content::WebContentsDelegate, |
73 public content::WebContentsObserver, | 74 public content::WebContentsObserver, |
74 public ui::InputMethodObserver, | 75 public ui::InputMethodObserver, |
75 public EngineRenderWidgetFeature::RenderWidgetMessageDelegate { | 76 public EngineRenderWidgetFeature::RenderWidgetMessageDelegate, |
77 public PageLoadTrackerClient { | |
76 public: | 78 public: |
77 using GetPortCallback = base::Callback<void(uint16_t)>; | 79 using GetPortCallback = base::Callback<void(uint16_t)>; |
78 | 80 |
79 BlimpEngineSession(std::unique_ptr<BlimpBrowserContext> browser_context, | 81 BlimpEngineSession(std::unique_ptr<BlimpBrowserContext> browser_context, |
80 net::NetLog* net_log, | 82 net::NetLog* net_log, |
81 BlimpEngineConfig* config, | 83 BlimpEngineConfig* config, |
82 SettingsManager* settings_manager); | 84 SettingsManager* settings_manager); |
83 ~BlimpEngineSession() override; | 85 ~BlimpEngineSession() override; |
84 | 86 |
85 // Starts the network stack on the IO thread, and sets default placeholder | 87 // Starts the network stack on the IO thread, and sets default placeholder |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 void RequestToLockMouse(content::WebContents* web_contents, | 141 void RequestToLockMouse(content::WebContents* web_contents, |
140 bool user_gesture, | 142 bool user_gesture, |
141 bool last_unlocked_by_target) override; | 143 bool last_unlocked_by_target) override; |
142 void CloseContents(content::WebContents* source) override; | 144 void CloseContents(content::WebContents* source) override; |
143 void ActivateContents(content::WebContents* contents) override; | 145 void ActivateContents(content::WebContents* contents) override; |
144 void ForwardCompositorProto( | 146 void ForwardCompositorProto( |
145 content::RenderWidgetHost* render_widget_host, | 147 content::RenderWidgetHost* render_widget_host, |
146 const std::vector<uint8_t>& proto) override; | 148 const std::vector<uint8_t>& proto) override; |
147 void NavigationStateChanged(content::WebContents* source, | 149 void NavigationStateChanged(content::WebContents* source, |
148 content::InvalidateTypes changed_flags) override; | 150 content::InvalidateTypes changed_flags) override; |
149 void LoadProgressChanged(content::WebContents* source, | |
150 double progress) override; | |
151 | 151 |
152 // ui::InputMethodObserver overrides. | 152 // ui::InputMethodObserver overrides. |
153 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; | 153 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; |
154 void OnFocus() override; | 154 void OnFocus() override; |
155 void OnBlur() override; | 155 void OnBlur() override; |
156 void OnCaretBoundsChanged(const ui::TextInputClient* client) override; | 156 void OnCaretBoundsChanged(const ui::TextInputClient* client) override; |
157 void OnTextInputStateChanged(const ui::TextInputClient* client) override; | 157 void OnTextInputStateChanged(const ui::TextInputClient* client) override; |
158 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override; | 158 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override; |
159 void OnShowImeIfNeeded() override; | 159 void OnShowImeIfNeeded() override; |
160 | 160 |
161 // content::WebContentsObserver implementation. | 161 // content::WebContentsObserver implementation. |
162 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | 162 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
163 void RenderViewHostChanged(content::RenderViewHost* old_host, | 163 void RenderViewHostChanged(content::RenderViewHost* old_host, |
164 content::RenderViewHost* new_host) override; | 164 content::RenderViewHost* new_host) override; |
165 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; | 165 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; |
166 | 166 |
167 // PageLoadTrackerClient implementation. | |
168 void SendPageLoadStatusUpdate(PageLoadStatus load_status) override; | |
169 | |
167 // Sets up and owns |new_contents|. | 170 // Sets up and owns |new_contents|. |
168 void PlatformSetContents(std::unique_ptr<content::WebContents> new_contents); | 171 void PlatformSetContents(std::unique_ptr<content::WebContents> new_contents); |
169 | 172 |
170 // Stores the value of the last page load completed update sent to the client. | |
171 // This field is used per tab. | |
172 bool last_page_load_completed_value_; | |
173 | |
174 // Content BrowserContext for this session. | 173 // Content BrowserContext for this session. |
175 std::unique_ptr<BlimpBrowserContext> browser_context_; | 174 std::unique_ptr<BlimpBrowserContext> browser_context_; |
176 | 175 |
177 // Engine configuration including assigned client token. | 176 // Engine configuration including assigned client token. |
178 BlimpEngineConfig* engine_config_; | 177 BlimpEngineConfig* engine_config_; |
179 | 178 |
180 // Presents the client's single screen. | 179 // Presents the client's single screen. |
181 std::unique_ptr<BlimpScreen> screen_; | 180 std::unique_ptr<BlimpScreen> screen_; |
182 | 181 |
183 // Represents the (currently single) browser window into which tab(s) will | 182 // Represents the (currently single) browser window into which tab(s) will |
184 // be rendered. | 183 // be rendered. |
185 std::unique_ptr<BlimpWindowTreeHost> window_tree_host_; | 184 std::unique_ptr<BlimpWindowTreeHost> window_tree_host_; |
186 | 185 |
187 // Used to apply standard focus conventions to the windows in the | 186 // Used to apply standard focus conventions to the windows in the |
188 // WindowTreeHost hierarchy. | 187 // WindowTreeHost hierarchy. |
189 std::unique_ptr<wm::FocusController> focus_client_; | 188 std::unique_ptr<wm::FocusController> focus_client_; |
190 | 189 |
191 // Used to manage input capture. | 190 // Used to manage input capture. |
192 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; | 191 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; |
193 | 192 |
194 // Used to attach null-parented windows (e.g. popups) to the root window. | 193 // Used to attach null-parented windows (e.g. popups) to the root window. |
195 std::unique_ptr<aura::client::WindowTreeClient> window_tree_client_; | 194 std::unique_ptr<aura::client::WindowTreeClient> window_tree_client_; |
196 | 195 |
197 // Only one web_contents is supported for blimp 0.5 | 196 // Only one web_contents is supported for blimp 0.5 |
198 std::unique_ptr<content::WebContents> web_contents_; | 197 std::unique_ptr<content::WebContents> web_contents_; |
199 | 198 |
199 // Tracks the page load status for a tab. Each PageLoadTracker is tied to a | |
200 // WebContents. | |
201 std::unique_ptr<PageLoadTracker> page_load_tracker_; | |
Wez
2016/05/25 03:33:10
nit: You could re-use the tracker across multiple
Khushal
2016/05/25 04:24:23
The PageLoadTracker has state tied to a WebContent
nasko
2016/05/25 11:46:50
+1 on having 1:1 objects instead of reuse. It is m
| |
202 | |
200 // Manages all global settings for the engine session. | 203 // Manages all global settings for the engine session. |
201 SettingsManager* settings_manager_; | 204 SettingsManager* settings_manager_; |
202 | 205 |
203 // Handles all incoming messages for type SETTINGS. | 206 // Handles all incoming messages for type SETTINGS. |
204 EngineSettingsFeature settings_feature_; | 207 EngineSettingsFeature settings_feature_; |
205 | 208 |
206 // Handles all incoming and outgoing messages related to RenderWidget, | 209 // Handles all incoming and outgoing messages related to RenderWidget, |
207 // including INPUT, COMPOSITOR and RENDER_WIDGET messages. | 210 // including INPUT, COMPOSITOR and RENDER_WIDGET messages. |
208 EngineRenderWidgetFeature render_widget_feature_; | 211 EngineRenderWidgetFeature render_widget_feature_; |
209 | 212 |
210 // Container for connection manager, authentication handler, and | 213 // Container for connection manager, authentication handler, and |
211 // browser connection handler. The components run on the I/O thread, and | 214 // browser connection handler. The components run on the I/O thread, and |
212 // this object is destroyed there. | 215 // this object is destroyed there. |
213 std::unique_ptr<EngineNetworkComponents> net_components_; | 216 std::unique_ptr<EngineNetworkComponents> net_components_; |
214 | 217 |
215 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; | 218 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; |
216 | 219 |
217 // Used to send TAB_CONTROL or NAVIGATION messages to client. | 220 // Used to send TAB_CONTROL or NAVIGATION messages to client. |
218 std::unique_ptr<BlimpMessageProcessor> tab_control_message_sender_; | 221 std::unique_ptr<BlimpMessageProcessor> tab_control_message_sender_; |
219 std::unique_ptr<BlimpMessageProcessor> navigation_message_sender_; | 222 std::unique_ptr<BlimpMessageProcessor> navigation_message_sender_; |
220 | 223 |
221 DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession); | 224 DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession); |
222 }; | 225 }; |
223 | 226 |
224 } // namespace engine | 227 } // namespace engine |
225 } // namespace blimp | 228 } // namespace blimp |
226 | 229 |
227 #endif // BLIMP_ENGINE_SESSION_BLIMP_ENGINE_SESSION_H_ | 230 #endif // BLIMP_ENGINE_SESSION_BLIMP_ENGINE_SESSION_H_ |
OLD | NEW |