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 // Presents the client's single screen. | 173 // Presents the client's single screen. |
175 // Screen should be deleted after browser context (crbug.com/613372). | 174 // Screen should be deleted after browser context (crbug.com/613372). |
176 std::unique_ptr<BlimpScreen> screen_; | 175 std::unique_ptr<BlimpScreen> screen_; |
177 | 176 |
178 // Content BrowserContext for this session. | 177 // Content BrowserContext for this session. |
179 std::unique_ptr<BlimpBrowserContext> browser_context_; | 178 std::unique_ptr<BlimpBrowserContext> browser_context_; |
180 | 179 |
181 // Engine configuration including assigned client token. | 180 // Engine configuration including assigned client token. |
182 BlimpEngineConfig* engine_config_; | 181 BlimpEngineConfig* engine_config_; |
183 | 182 |
184 // Represents the (currently single) browser window into which tab(s) will | 183 // Represents the (currently single) browser window into which tab(s) will |
185 // be rendered. | 184 // be rendered. |
186 std::unique_ptr<BlimpWindowTreeHost> window_tree_host_; | 185 std::unique_ptr<BlimpWindowTreeHost> window_tree_host_; |
187 | 186 |
188 // Used to apply standard focus conventions to the windows in the | 187 // Used to apply standard focus conventions to the windows in the |
189 // WindowTreeHost hierarchy. | 188 // WindowTreeHost hierarchy. |
190 std::unique_ptr<wm::FocusController> focus_client_; | 189 std::unique_ptr<wm::FocusController> focus_client_; |
191 | 190 |
192 // Used to manage input capture. | 191 // Used to manage input capture. |
193 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; | 192 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; |
194 | 193 |
195 // Used to attach null-parented windows (e.g. popups) to the root window. | 194 // Used to attach null-parented windows (e.g. popups) to the root window. |
196 std::unique_ptr<aura::client::WindowTreeClient> window_tree_client_; | 195 std::unique_ptr<aura::client::WindowTreeClient> window_tree_client_; |
197 | 196 |
198 // Only one web_contents is supported for blimp 0.5 | 197 // Only one web_contents is supported for blimp 0.5 |
199 std::unique_ptr<content::WebContents> web_contents_; | 198 std::unique_ptr<content::WebContents> web_contents_; |
200 | 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 |
201 // Manages all global settings for the engine session. | 204 // Manages all global settings for the engine session. |
202 SettingsManager* settings_manager_; | 205 SettingsManager* settings_manager_; |
203 | 206 |
204 // Handles all incoming messages for type SETTINGS. | 207 // Handles all incoming messages for type SETTINGS. |
205 EngineSettingsFeature settings_feature_; | 208 EngineSettingsFeature settings_feature_; |
206 | 209 |
207 // Handles all incoming and outgoing messages related to RenderWidget, | 210 // Handles all incoming and outgoing messages related to RenderWidget, |
208 // including INPUT, COMPOSITOR and RENDER_WIDGET messages. | 211 // including INPUT, COMPOSITOR and RENDER_WIDGET messages. |
209 EngineRenderWidgetFeature render_widget_feature_; | 212 EngineRenderWidgetFeature render_widget_feature_; |
210 | 213 |
211 // Container for connection manager, authentication handler, and | 214 // Container for connection manager, authentication handler, and |
212 // browser connection handler. The components run on the I/O thread, and | 215 // browser connection handler. The components run on the I/O thread, and |
213 // this object is destroyed there. | 216 // this object is destroyed there. |
214 std::unique_ptr<EngineNetworkComponents> net_components_; | 217 std::unique_ptr<EngineNetworkComponents> net_components_; |
215 | 218 |
216 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; | 219 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; |
217 | 220 |
218 // Used to send TAB_CONTROL or NAVIGATION messages to client. | 221 // Used to send TAB_CONTROL or NAVIGATION messages to client. |
219 std::unique_ptr<BlimpMessageProcessor> tab_control_message_sender_; | 222 std::unique_ptr<BlimpMessageProcessor> tab_control_message_sender_; |
220 std::unique_ptr<BlimpMessageProcessor> navigation_message_sender_; | 223 std::unique_ptr<BlimpMessageProcessor> navigation_message_sender_; |
221 | 224 |
222 DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession); | 225 DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession); |
223 }; | 226 }; |
224 | 227 |
225 } // namespace engine | 228 } // namespace engine |
226 } // namespace blimp | 229 } // namespace blimp |
227 | 230 |
228 #endif // BLIMP_ENGINE_SESSION_BLIMP_ENGINE_SESSION_H_ | 231 #endif // BLIMP_ENGINE_SESSION_BLIMP_ENGINE_SESSION_H_ |
OLD | NEW |