| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class BlimpMessageProcessor; | 25 class BlimpMessageProcessor; |
| 26 class BlimpMessageThreadPipe; | 26 class BlimpMessageThreadPipe; |
| 27 class BrowserConnectionHandler; | 27 class BrowserConnectionHandler; |
| 28 class ClientConnectionManager; | 28 class ClientConnectionManager; |
| 29 class ThreadPipeManager; | 29 class ThreadPipeManager; |
| 30 | 30 |
| 31 namespace client { | 31 namespace client { |
| 32 | 32 |
| 33 class ClientNetworkComponents; | 33 class ClientNetworkComponents; |
| 34 class NavigationFeature; | 34 class NavigationFeature; |
| 35 class ImeFeature; |
| 35 class RenderWidgetFeature; | 36 class RenderWidgetFeature; |
| 36 class TabControlFeature; | 37 class TabControlFeature; |
| 37 | 38 |
| 38 class NetworkEventObserver { | 39 class NetworkEventObserver { |
| 39 public: | 40 public: |
| 40 NetworkEventObserver() {} | 41 NetworkEventObserver() {} |
| 41 virtual ~NetworkEventObserver() {} | 42 virtual ~NetworkEventObserver() {} |
| 42 | 43 |
| 43 virtual void OnConnected() = 0; | 44 virtual void OnConnected() = 0; |
| 44 virtual void OnDisconnected(int result) = 0; | 45 virtual void OnDisconnected(int result) = 0; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 58 | 59 |
| 59 // Uses the AssignmentSource to get an Assignment and then uses the assignment | 60 // Uses the AssignmentSource to get an Assignment and then uses the assignment |
| 60 // configuration to connect to the Blimplet. | 61 // configuration to connect to the Blimplet. |
| 61 // |client_auth_token| is the OAuth2 access token to use when querying | 62 // |client_auth_token| is the OAuth2 access token to use when querying |
| 62 // for an assignment. This token needs the OAuth2 scope of userinfo.email and | 63 // for an assignment. This token needs the OAuth2 scope of userinfo.email and |
| 63 // only needs to be an access token, not a refresh token. | 64 // only needs to be an access token, not a refresh token. |
| 64 void Connect(const std::string& client_auth_token); | 65 void Connect(const std::string& client_auth_token); |
| 65 | 66 |
| 66 TabControlFeature* GetTabControlFeature() const; | 67 TabControlFeature* GetTabControlFeature() const; |
| 67 NavigationFeature* GetNavigationFeature() const; | 68 NavigationFeature* GetNavigationFeature() const; |
| 69 ImeFeature* GetImeFeature() const; |
| 68 RenderWidgetFeature* GetRenderWidgetFeature() const; | 70 RenderWidgetFeature* GetRenderWidgetFeature() const; |
| 69 | 71 |
| 70 // The AssignmentCallback for when an assignment is ready. This will trigger | 72 // The AssignmentCallback for when an assignment is ready. This will trigger |
| 71 // a connection to the engine. | 73 // a connection to the engine. |
| 72 virtual void ConnectWithAssignment(AssignmentSource::Result result, | 74 virtual void ConnectWithAssignment(AssignmentSource::Result result, |
| 73 const Assignment& assignment); | 75 const Assignment& assignment); |
| 74 | 76 |
| 75 protected: | 77 protected: |
| 76 ~BlimpClientSession() override; | 78 ~BlimpClientSession() override; |
| 77 | 79 |
| 78 // Notified every time the AssignmentSource returns the result of an attempted | 80 // Notified every time the AssignmentSource returns the result of an attempted |
| 79 // assignment request. | 81 // assignment request. |
| 80 virtual void OnAssignmentConnectionAttempted(AssignmentSource::Result result); | 82 virtual void OnAssignmentConnectionAttempted(AssignmentSource::Result result); |
| 81 | 83 |
| 82 private: | 84 private: |
| 83 void RegisterFeatures(); | 85 void RegisterFeatures(); |
| 84 | 86 |
| 85 // NetworkEventObserver implementation. | 87 // NetworkEventObserver implementation. |
| 86 void OnConnected() override; | 88 void OnConnected() override; |
| 87 void OnDisconnected(int result) override; | 89 void OnDisconnected(int result) override; |
| 88 | 90 |
| 89 base::Thread io_thread_; | 91 base::Thread io_thread_; |
| 90 scoped_ptr<TabControlFeature> tab_control_feature_; | 92 scoped_ptr<TabControlFeature> tab_control_feature_; |
| 91 scoped_ptr<NavigationFeature> navigation_feature_; | 93 scoped_ptr<NavigationFeature> navigation_feature_; |
| 94 scoped_ptr<ImeFeature> ime_feature_; |
| 92 scoped_ptr<RenderWidgetFeature> render_widget_feature_; | 95 scoped_ptr<RenderWidgetFeature> render_widget_feature_; |
| 93 | 96 |
| 94 // The AssignmentSource is used when the user of BlimpClientSession calls | 97 // The AssignmentSource is used when the user of BlimpClientSession calls |
| 95 // Connect() to get a valid assignment and later connect to the engine. | 98 // Connect() to get a valid assignment and later connect to the engine. |
| 96 scoped_ptr<AssignmentSource> assignment_source_; | 99 scoped_ptr<AssignmentSource> assignment_source_; |
| 97 | 100 |
| 98 // Container struct for network components. | 101 // Container struct for network components. |
| 99 // Must be deleted on the IO thread. | 102 // Must be deleted on the IO thread. |
| 100 scoped_ptr<ClientNetworkComponents> net_components_; | 103 scoped_ptr<ClientNetworkComponents> net_components_; |
| 101 | 104 |
| 102 scoped_ptr<ThreadPipeManager> thread_pipe_manager_; | 105 scoped_ptr<ThreadPipeManager> thread_pipe_manager_; |
| 103 | 106 |
| 104 base::WeakPtrFactory<BlimpClientSession> weak_factory_; | 107 base::WeakPtrFactory<BlimpClientSession> weak_factory_; |
| 105 | 108 |
| 106 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); | 109 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); |
| 107 }; | 110 }; |
| 108 | 111 |
| 109 } // namespace client | 112 } // namespace client |
| 110 } // namespace blimp | 113 } // namespace blimp |
| 111 | 114 |
| 112 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ | 115 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ |
| OLD | NEW |