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 #include "blimp/client/session/blimp_client_session.h" | 5 #include "blimp/client/session/blimp_client_session.h" |
6 | 6 |
7 #include "blimp/client/session/navigation_feature.h" | 7 #include "blimp/client/session/navigation_feature.h" |
8 #include "blimp/client/session/render_widget_feature.h" | 8 #include "blimp/client/session/render_widget_feature.h" |
9 #include "blimp/client/session/tab_control_feature.h" | 9 #include "blimp/client/session/tab_control_feature.h" |
10 #include "blimp/net/browser_connection_handler.h" | 10 #include "blimp/net/browser_connection_handler.h" |
| 11 #include "blimp/net/client_connection_manager.h" |
11 | 12 |
12 namespace blimp { | 13 namespace blimp { |
| 14 namespace { |
| 15 // TODO(kmarshall): Read token from config. |
| 16 const char kDummyClientToken[] = "MyVoiceIsMyPassport"; |
| 17 } // namespace |
13 | 18 |
14 BlimpClientSession::BlimpClientSession() | 19 BlimpClientSession::BlimpClientSession() |
15 : connection_handler_(new BrowserConnectionHandler), | 20 : connection_handler_(new BrowserConnectionHandler), |
| 21 connection_manager_( |
| 22 new ClientConnectionManager(connection_handler_.get())), |
16 tab_control_feature_(new TabControlFeature), | 23 tab_control_feature_(new TabControlFeature), |
17 navigation_feature_(new NavigationFeature), | 24 navigation_feature_(new NavigationFeature), |
18 render_widget_feature_(new RenderWidgetFeature) { | 25 render_widget_feature_(new RenderWidgetFeature) { |
| 26 connection_manager_->set_client_token(kDummyClientToken); |
| 27 |
19 // Connect the features with the network layer. | 28 // Connect the features with the network layer. |
20 tab_control_feature_->set_outgoing_message_processor( | 29 tab_control_feature_->set_outgoing_message_processor( |
21 connection_handler_->RegisterFeature(BlimpMessage::TAB_CONTROL, | 30 connection_handler_->RegisterFeature(BlimpMessage::TAB_CONTROL, |
22 tab_control_feature_.get())); | 31 tab_control_feature_.get())); |
23 navigation_feature_->set_outgoing_message_processor( | 32 navigation_feature_->set_outgoing_message_processor( |
24 connection_handler_->RegisterFeature(BlimpMessage::NAVIGATION, | 33 connection_handler_->RegisterFeature(BlimpMessage::NAVIGATION, |
25 navigation_feature_.get())); | 34 navigation_feature_.get())); |
26 render_widget_feature_->set_outgoing_input_message_processor( | 35 render_widget_feature_->set_outgoing_input_message_processor( |
27 connection_handler_->RegisterFeature(BlimpMessage::INPUT, | 36 connection_handler_->RegisterFeature(BlimpMessage::INPUT, |
28 render_widget_feature_.get())); | 37 render_widget_feature_.get())); |
(...skipping 13 matching lines...) Expand all Loading... |
42 } | 51 } |
43 | 52 |
44 NavigationFeature* BlimpClientSession::GetNavigationFeature() const { | 53 NavigationFeature* BlimpClientSession::GetNavigationFeature() const { |
45 return navigation_feature_.get(); | 54 return navigation_feature_.get(); |
46 } | 55 } |
47 | 56 |
48 RenderWidgetFeature* BlimpClientSession::GetRenderWidgetFeature() const { | 57 RenderWidgetFeature* BlimpClientSession::GetRenderWidgetFeature() const { |
49 return render_widget_feature_.get(); | 58 return render_widget_feature_.get(); |
50 } | 59 } |
51 | 60 |
| 61 ClientConnectionManager* BlimpClientSession::GetConnectionManager() const { |
| 62 return connection_manager_.get(); |
| 63 } |
| 64 |
| 65 void BlimpClientSession::Connect() { |
| 66 connection_manager_->Connect(); |
| 67 } |
| 68 |
52 } // namespace blimp | 69 } // namespace blimp |
OLD | NEW |