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_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ | 5 #ifndef BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ |
6 #define BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ | 6 #define BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ |
7 | 7 |
8 #include <blimp/net/blimp_connection_statistics.h> | |
Kevin M
2016/05/20 01:02:03
Angle brackets are reserved for standard headers.
shaktisahu
2016/05/22 22:36:56
Done.
| |
8 #include <memory> | 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
14 #include "blimp/client/session/assignment_source.h" | 15 #include "blimp/client/session/assignment_source.h" |
15 #include "blimp/common/proto/blimp_message.pb.h" | 16 #include "blimp/common/proto/blimp_message.pb.h" |
16 #include "blimp/net/blimp_message_processor.h" | 17 #include "blimp/net/blimp_message_processor.h" |
17 | 18 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 // for an assignment. This token needs the OAuth2 scope of userinfo.email and | 64 // for an assignment. This token needs the OAuth2 scope of userinfo.email and |
64 // only needs to be an access token, not a refresh token. | 65 // only needs to be an access token, not a refresh token. |
65 void Connect(const std::string& client_auth_token); | 66 void Connect(const std::string& client_auth_token); |
66 | 67 |
67 TabControlFeature* GetTabControlFeature() const; | 68 TabControlFeature* GetTabControlFeature() const; |
68 NavigationFeature* GetNavigationFeature() const; | 69 NavigationFeature* GetNavigationFeature() const; |
69 ImeFeature* GetImeFeature() const; | 70 ImeFeature* GetImeFeature() const; |
70 RenderWidgetFeature* GetRenderWidgetFeature() const; | 71 RenderWidgetFeature* GetRenderWidgetFeature() const; |
71 SettingsFeature* GetSettingsFeature() const; | 72 SettingsFeature* GetSettingsFeature() const; |
72 | 73 |
74 BlimpConnectionStatistics* GetBlimpConnectionStatistics() const; | |
75 | |
73 // The AssignmentCallback for when an assignment is ready. This will trigger | 76 // The AssignmentCallback for when an assignment is ready. This will trigger |
74 // a connection to the engine. | 77 // a connection to the engine. |
75 virtual void ConnectWithAssignment(AssignmentSource::Result result, | 78 virtual void ConnectWithAssignment(AssignmentSource::Result result, |
76 const Assignment& assignment); | 79 const Assignment& assignment); |
77 | 80 |
81 void GetDebugInfo(); | |
Kevin M
2016/05/20 01:02:03
Can we standardize the names here? DebugInfo or Co
| |
82 virtual void UpdateDebugInfo(BlimpConnectionStatistics::StatisticsMap stats); | |
Kevin M
2016/05/20 01:02:03
Just take a const BlimpConnectionStatistics& ?
| |
83 | |
78 protected: | 84 protected: |
79 ~BlimpClientSession() override; | 85 ~BlimpClientSession() override; |
80 | 86 |
81 // Notified every time the AssignmentSource returns the result of an attempted | 87 // Notified every time the AssignmentSource returns the result of an attempted |
82 // assignment request. | 88 // assignment request. |
83 virtual void OnAssignmentConnectionAttempted(AssignmentSource::Result result, | 89 virtual void OnAssignmentConnectionAttempted(AssignmentSource::Result result, |
84 const Assignment& assignment); | 90 const Assignment& assignment); |
85 | 91 |
86 private: | 92 private: |
87 void RegisterFeatures(); | 93 void RegisterFeatures(); |
88 | 94 |
89 // NetworkEventObserver implementation. | 95 // NetworkEventObserver implementation. |
90 void OnConnected() override; | 96 void OnConnected() override; |
91 void OnDisconnected(int result) override; | 97 void OnDisconnected(int result) override; |
92 | 98 |
93 base::Thread io_thread_; | 99 base::Thread io_thread_; |
94 std::unique_ptr<TabControlFeature> tab_control_feature_; | 100 std::unique_ptr<TabControlFeature> tab_control_feature_; |
95 std::unique_ptr<NavigationFeature> navigation_feature_; | 101 std::unique_ptr<NavigationFeature> navigation_feature_; |
96 std::unique_ptr<ImeFeature> ime_feature_; | 102 std::unique_ptr<ImeFeature> ime_feature_; |
97 std::unique_ptr<RenderWidgetFeature> render_widget_feature_; | 103 std::unique_ptr<RenderWidgetFeature> render_widget_feature_; |
98 std::unique_ptr<SettingsFeature> settings_feature_; | 104 std::unique_ptr<SettingsFeature> settings_feature_; |
99 | 105 |
100 // The AssignmentSource is used when the user of BlimpClientSession calls | 106 // The AssignmentSource is used when the user of BlimpClientSession calls |
101 // Connect() to get a valid assignment and later connect to the engine. | 107 // Connect() to get a valid assignment and later connect to the engine. |
102 std::unique_ptr<AssignmentSource> assignment_source_; | 108 std::unique_ptr<AssignmentSource> assignment_source_; |
103 | 109 |
110 // Collects details of network, such as number of commits and bytes | |
111 // transferred over network. | |
112 std::unique_ptr<BlimpConnectionStatistics> blimp_connection_statistics_; | |
113 | |
104 // Container struct for network components. | 114 // Container struct for network components. |
105 // Must be deleted on the IO thread. | 115 // Must be deleted on the IO thread. |
106 std::unique_ptr<ClientNetworkComponents> net_components_; | 116 std::unique_ptr<ClientNetworkComponents> net_components_; |
107 | 117 |
108 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; | 118 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; |
109 | 119 |
110 base::WeakPtrFactory<BlimpClientSession> weak_factory_; | 120 base::WeakPtrFactory<BlimpClientSession> weak_factory_; |
111 | 121 |
112 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); | 122 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); |
113 }; | 123 }; |
114 | 124 |
115 } // namespace client | 125 } // namespace client |
116 } // namespace blimp | 126 } // namespace blimp |
117 | 127 |
118 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ | 128 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ |
OLD | NEW |