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 "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 // BlimpClientSession represents a single active session of Blimp on the client | 35 // BlimpClientSession represents a single active session of Blimp on the client |
36 // regardless of whether or not the client application is in the background or | 36 // regardless of whether or not the client application is in the background or |
37 // foreground. The only time this session is invalid is during initialization | 37 // foreground. The only time this session is invalid is during initialization |
38 // and shutdown of this particular client process (or Activity on Android). | 38 // and shutdown of this particular client process (or Activity on Android). |
39 // | 39 // |
40 // This session glues together the feature proxy components and the network | 40 // This session glues together the feature proxy components and the network |
41 // layer. The network components must be interacted with on the IO thread. The | 41 // layer. The network components must be interacted with on the IO thread. The |
42 // feature proxies must be interacted with on the UI thread. | 42 // feature proxies must be interacted with on the UI thread. |
43 class BLIMP_CLIENT_EXPORT BlimpClientSession { | 43 class BLIMP_CLIENT_EXPORT BlimpClientSession { |
44 public: | 44 public: |
45 explicit BlimpClientSession(scoped_ptr<AssignmentSource> assignment_source); | 45 BlimpClientSession(); |
46 | 46 |
47 // Uses the AssignmentSource to get an Assignment and then uses the assignment | 47 // Uses the AssignmentSource to get an Assignment and then uses the assignment |
48 // configuration to connect to the Blimplet. | 48 // configuration to connect to the Blimplet. |
49 void Connect(); | 49 // |token| is the login authentication token to use when querying for an |
50 // assignment. | |
51 void Connect(const std::string& token); | |
Kevin M
2016/02/12 19:45:27
auth_token to distinguish it from other tokens
David Trainor- moved to gerrit
2016/02/17 21:09:48
Done.
| |
50 | 52 |
51 TabControlFeature* GetTabControlFeature() const; | 53 TabControlFeature* GetTabControlFeature() const; |
52 NavigationFeature* GetNavigationFeature() const; | 54 NavigationFeature* GetNavigationFeature() const; |
53 RenderWidgetFeature* GetRenderWidgetFeature() const; | 55 RenderWidgetFeature* GetRenderWidgetFeature() const; |
54 | 56 |
57 // The AssignmentCallback for when an assignment is ready. This will trigger | |
58 // a connection to the engine. | |
59 virtual void ConnectWithAssignment(AssignmentSourceResult result, | |
60 const Assignment& assignment); | |
61 | |
55 protected: | 62 protected: |
56 virtual ~BlimpClientSession(); | 63 virtual ~BlimpClientSession(); |
57 | 64 |
58 private: | 65 private: |
59 // Registers a message processor which will receive all messages of the |type| | 66 // Registers a message processor which will receive all messages of the |type| |
60 // specified. Returns a BlimpMessageProcessor object for sending messages of | 67 // specified. Returns a BlimpMessageProcessor object for sending messages of |
61 // type |type|. | 68 // type |type|. |
62 scoped_ptr<BlimpMessageProcessor> RegisterFeature( | 69 scoped_ptr<BlimpMessageProcessor> RegisterFeature( |
63 BlimpMessage::Type type, | 70 BlimpMessage::Type type, |
64 BlimpMessageProcessor* incoming_processor); | 71 BlimpMessageProcessor* incoming_processor); |
65 | 72 |
66 // The AssignmentCallback for when an assignment is ready. This will trigger | |
67 // a connection to the engine. | |
68 void ConnectWithAssignment(const Assignment& assignment); | |
69 | |
70 // The AssignmentSource is used when the user of BlimpClientSession calls | |
71 // Connect() to get a valid assignment and later connect to the engine. | |
72 scoped_ptr<AssignmentSource> assignment_source_; | |
73 | |
74 base::Thread io_thread_; | 73 base::Thread io_thread_; |
75 scoped_ptr<TabControlFeature> tab_control_feature_; | 74 scoped_ptr<TabControlFeature> tab_control_feature_; |
76 scoped_ptr<NavigationFeature> navigation_feature_; | 75 scoped_ptr<NavigationFeature> navigation_feature_; |
77 scoped_ptr<RenderWidgetFeature> render_widget_feature_; | 76 scoped_ptr<RenderWidgetFeature> render_widget_feature_; |
78 | 77 |
78 // The AssignmentSource is used when the user of BlimpClientSession calls | |
79 // Connect() to get a valid assignment and later connect to the engine. | |
80 scoped_ptr<AssignmentSource> assignment_source_; | |
81 | |
79 // Container struct for network components. | 82 // Container struct for network components. |
80 // Must be deleted on the IO thread. | 83 // Must be deleted on the IO thread. |
81 scoped_ptr<ClientNetworkComponents> net_components_; | 84 scoped_ptr<ClientNetworkComponents> net_components_; |
82 | 85 |
83 // Pipes for receiving BlimpMessages from IO thread. | 86 // Pipes for receiving BlimpMessages from IO thread. |
84 // Incoming messages are only routed to the UI thread since all features run | 87 // Incoming messages are only routed to the UI thread since all features run |
85 // on the UI thread. | 88 // on the UI thread. |
86 std::vector<scoped_ptr<BlimpMessageThreadPipe>> incoming_pipes_; | 89 std::vector<scoped_ptr<BlimpMessageThreadPipe>> incoming_pipes_; |
87 | 90 |
88 base::WeakPtrFactory<BlimpClientSession> weak_factory_; | 91 base::WeakPtrFactory<BlimpClientSession> weak_factory_; |
89 | 92 |
90 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); | 93 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); |
91 }; | 94 }; |
92 | 95 |
93 } // namespace client | 96 } // namespace client |
94 } // namespace blimp | 97 } // namespace blimp |
95 | 98 |
96 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ | 99 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ |
OLD | NEW |