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

Side by Side Diff: blimp/client/session/blimp_client_session.h

Issue 1962393004: Added a debug info UI for Blimp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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_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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "blimp/client/session/assignment_source.h" 14 #include "blimp/client/session/assignment_source.h"
15 #include "blimp/common/proto/blimp_message.pb.h" 15 #include "blimp/common/proto/blimp_message.pb.h"
16 #include "blimp/net/blimp_connection_details.h"
16 #include "blimp/net/blimp_message_processor.h" 17 #include "blimp/net/blimp_message_processor.h"
17 18
18 namespace net { 19 namespace net {
19 class IPEndPoint; 20 class IPEndPoint;
20 } 21 }
21 22
22 namespace blimp { 23 namespace blimp {
23 24
24 class BlimpMessageProcessor; 25 class BlimpMessageProcessor;
25 class BlimpMessageThreadPipe; 26 class BlimpMessageThreadPipe;
(...skipping 20 matching lines...) Expand all
46 }; 47 };
47 48
48 // BlimpClientSession represents a single active session of Blimp on the client 49 // BlimpClientSession represents a single active session of Blimp on the client
49 // regardless of whether or not the client application is in the background or 50 // regardless of whether or not the client application is in the background or
50 // foreground. The only time this session is invalid is during initialization 51 // foreground. The only time this session is invalid is during initialization
51 // and shutdown of this particular client process (or Activity on Android). 52 // and shutdown of this particular client process (or Activity on Android).
52 // 53 //
53 // This session glues together the feature proxy components and the network 54 // This session glues together the feature proxy components and the network
54 // layer. The network components must be interacted with on the IO thread. The 55 // layer. The network components must be interacted with on the IO thread. The
55 // feature proxies must be interacted with on the UI thread. 56 // feature proxies must be interacted with on the UI thread.
56 class BlimpClientSession : public NetworkEventObserver { 57 class BlimpClientSession : public NetworkEventObserver,
58 NetworkActivityObserver {
Kevin M 2016/05/10 23:54:24 public NetworkActivityObserver
57 public: 59 public:
58 explicit BlimpClientSession(const GURL& assigner_endpoint); 60 explicit BlimpClientSession(const GURL& assigner_endpoint);
59 61
60 // Uses the AssignmentSource to get an Assignment and then uses the assignment 62 // Uses the AssignmentSource to get an Assignment and then uses the assignment
61 // configuration to connect to the Blimplet. 63 // configuration to connect to the Blimplet.
62 // |client_auth_token| is the OAuth2 access token to use when querying 64 // |client_auth_token| is the OAuth2 access token to use when querying
63 // for an assignment. This token needs the OAuth2 scope of userinfo.email and 65 // 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. 66 // only needs to be an access token, not a refresh token.
65 void Connect(const std::string& client_auth_token); 67 void Connect(const std::string& client_auth_token);
66 68
67 TabControlFeature* GetTabControlFeature() const; 69 TabControlFeature* GetTabControlFeature() const;
68 NavigationFeature* GetNavigationFeature() const; 70 NavigationFeature* GetNavigationFeature() const;
69 ImeFeature* GetImeFeature() const; 71 ImeFeature* GetImeFeature() const;
70 RenderWidgetFeature* GetRenderWidgetFeature() const; 72 RenderWidgetFeature* GetRenderWidgetFeature() const;
71 SettingsFeature* GetSettingsFeature() const; 73 SettingsFeature* GetSettingsFeature() const;
72 74
73 // The AssignmentCallback for when an assignment is ready. This will trigger 75 // The AssignmentCallback for when an assignment is ready. This will trigger
74 // a connection to the engine. 76 // a connection to the engine.
75 virtual void ConnectWithAssignment(AssignmentSource::Result result, 77 virtual void ConnectWithAssignment(AssignmentSource::Result result,
76 const Assignment& assignment); 78 const Assignment& assignment);
79 void OnPacketReceived(int bytes) override;
80 void OnPacketSent(int bytes) override;
77 81
78 protected: 82 protected:
79 ~BlimpClientSession() override; 83 ~BlimpClientSession() override;
80 84
81 // Notified every time the AssignmentSource returns the result of an attempted 85 // Notified every time the AssignmentSource returns the result of an attempted
82 // assignment request. 86 // assignment request.
83 virtual void OnAssignmentConnectionAttempted(AssignmentSource::Result result, 87 virtual void OnAssignmentConnectionAttempted(AssignmentSource::Result result,
84 const Assignment& assignment); 88 const Assignment& assignment);
85 89
86 private: 90 private:
87 void RegisterFeatures(); 91 void RegisterFeatures();
88 92
89 // NetworkEventObserver implementation. 93 // NetworkEventObserver implementation.
90 void OnConnected() override; 94 void OnConnected() override;
91 void OnDisconnected(int result) override; 95 void OnDisconnected(int result) override;
92 96
93 base::Thread io_thread_; 97 base::Thread io_thread_;
98
99 std::unique_ptr<BlimpConnectionDetails> blimp_connection_details_;
100
94 std::unique_ptr<TabControlFeature> tab_control_feature_; 101 std::unique_ptr<TabControlFeature> tab_control_feature_;
95 std::unique_ptr<NavigationFeature> navigation_feature_; 102 std::unique_ptr<NavigationFeature> navigation_feature_;
96 std::unique_ptr<ImeFeature> ime_feature_; 103 std::unique_ptr<ImeFeature> ime_feature_;
97 std::unique_ptr<RenderWidgetFeature> render_widget_feature_; 104 std::unique_ptr<RenderWidgetFeature> render_widget_feature_;
98 std::unique_ptr<SettingsFeature> settings_feature_; 105 std::unique_ptr<SettingsFeature> settings_feature_;
99 106
100 // The AssignmentSource is used when the user of BlimpClientSession calls 107 // The AssignmentSource is used when the user of BlimpClientSession calls
101 // Connect() to get a valid assignment and later connect to the engine. 108 // Connect() to get a valid assignment and later connect to the engine.
102 std::unique_ptr<AssignmentSource> assignment_source_; 109 std::unique_ptr<AssignmentSource> assignment_source_;
103 110
104 // Container struct for network components. 111 // Container struct for network components.
105 // Must be deleted on the IO thread. 112 // Must be deleted on the IO thread.
106 std::unique_ptr<ClientNetworkComponents> net_components_; 113 std::unique_ptr<ClientNetworkComponents> net_components_;
107 114
108 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; 115 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
109 116
110 base::WeakPtrFactory<BlimpClientSession> weak_factory_; 117 base::WeakPtrFactory<BlimpClientSession> weak_factory_;
111 118
112 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); 119 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession);
113 }; 120 };
114 121
115 } // namespace client 122 } // namespace client
116 } // namespace blimp 123 } // namespace blimp
117 124
118 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ 125 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698