| 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_APP_SESSION_BLIMP_CLIENT_SESSION_H_ | 5 #ifndef BLIMP_CLIENT_APP_SESSION_BLIMP_CLIENT_SESSION_H_ |
| 6 #define BLIMP_CLIENT_APP_SESSION_BLIMP_CLIENT_SESSION_H_ | 6 #define BLIMP_CLIENT_APP_SESSION_BLIMP_CLIENT_SESSION_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class HeliumBlobReceiverDelegate; | 33 class HeliumBlobReceiverDelegate; |
| 34 class ThreadPipeManager; | 34 class ThreadPipeManager; |
| 35 | 35 |
| 36 namespace client { | 36 namespace client { |
| 37 | 37 |
| 38 class ClientNetworkComponents; | 38 class ClientNetworkComponents; |
| 39 class GeolocationFeature; | 39 class GeolocationFeature; |
| 40 class NavigationFeature; | 40 class NavigationFeature; |
| 41 class ImeFeature; | 41 class ImeFeature; |
| 42 class RenderWidgetFeature; | 42 class RenderWidgetFeature; |
| 43 class SettingsFeature; | |
| 44 class TabControlFeature; | 43 class TabControlFeature; |
| 45 | 44 |
| 46 // BlimpClientSession represents a single active session of Blimp on the client | 45 // BlimpClientSession represents a single active session of Blimp on the client |
| 47 // regardless of whether or not the client application is in the background or | 46 // regardless of whether or not the client application is in the background or |
| 48 // foreground. The only time this session is invalid is during initialization | 47 // foreground. The only time this session is invalid is during initialization |
| 49 // and shutdown of this particular client process (or Activity on Android). | 48 // and shutdown of this particular client process (or Activity on Android). |
| 50 // | 49 // |
| 51 // This session glues together the feature proxy components and the network | 50 // This session glues together the feature proxy components and the network |
| 52 // layer. The network components must be interacted with on the IO thread. The | 51 // layer. The network components must be interacted with on the IO thread. The |
| 53 // feature proxies must be interacted with on the UI thread. | 52 // feature proxies must be interacted with on the UI thread. |
| 54 class BlimpClientSession | 53 class BlimpClientSession |
| 55 : public NetworkEventObserver, | 54 : public NetworkEventObserver, |
| 56 public BlobImageSerializationProcessor::ErrorDelegate { | 55 public BlobImageSerializationProcessor::ErrorDelegate { |
| 57 public: | 56 public: |
| 58 explicit BlimpClientSession(const GURL& assigner_endpoint); | 57 explicit BlimpClientSession(const GURL& assigner_endpoint); |
| 59 | 58 |
| 60 // Uses the AssignmentSource to get an Assignment and then uses the assignment | 59 // Uses the AssignmentSource to get an Assignment and then uses the assignment |
| 61 // configuration to connect to the Blimplet. | 60 // configuration to connect to the Blimplet. |
| 62 // |client_auth_token| is the OAuth2 access token to use when querying | 61 // |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 | 62 // 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. | 63 // only needs to be an access token, not a refresh token. |
| 65 void Connect(const std::string& client_auth_token); | 64 void Connect(const std::string& client_auth_token); |
| 66 | 65 |
| 67 TabControlFeature* GetTabControlFeature() const; | 66 TabControlFeature* GetTabControlFeature() const; |
| 68 NavigationFeature* GetNavigationFeature() const; | 67 NavigationFeature* GetNavigationFeature() const; |
| 69 ImeFeature* GetImeFeature() const; | 68 ImeFeature* GetImeFeature() const; |
| 70 RenderWidgetFeature* GetRenderWidgetFeature() const; | 69 RenderWidgetFeature* GetRenderWidgetFeature() const; |
| 71 SettingsFeature* GetSettingsFeature() const; | |
| 72 | 70 |
| 73 // The AssignmentCallback for when an assignment is ready. This will trigger | 71 // The AssignmentCallback for when an assignment is ready. This will trigger |
| 74 // a connection to the engine. | 72 // a connection to the engine. |
| 75 virtual void ConnectWithAssignment(AssignmentRequestResult result, | 73 virtual void ConnectWithAssignment(AssignmentRequestResult result, |
| 76 const Assignment& assignment); | 74 const Assignment& assignment); |
| 77 | 75 |
| 78 protected: | 76 protected: |
| 79 ~BlimpClientSession() override; | 77 ~BlimpClientSession() override; |
| 80 | 78 |
| 81 // Notified every time the AssignmentSource returns the result of an attempted | 79 // Notified every time the AssignmentSource returns the result of an attempted |
| (...skipping 24 matching lines...) Expand all Loading... |
| 106 // Retrieves and decodes image data from |blob_receiver_|. Must outlive | 104 // Retrieves and decodes image data from |blob_receiver_|. Must outlive |
| 107 // |blob_receiver_|. | 105 // |blob_receiver_|. |
| 108 BlobImageSerializationProcessor blob_image_processor_; | 106 BlobImageSerializationProcessor blob_image_processor_; |
| 109 | 107 |
| 110 std::unique_ptr<BlobChannelReceiver> blob_receiver_; | 108 std::unique_ptr<BlobChannelReceiver> blob_receiver_; |
| 111 std::unique_ptr<GeolocationFeature> geolocation_feature_; | 109 std::unique_ptr<GeolocationFeature> geolocation_feature_; |
| 112 std::unique_ptr<TabControlFeature> tab_control_feature_; | 110 std::unique_ptr<TabControlFeature> tab_control_feature_; |
| 113 std::unique_ptr<NavigationFeature> navigation_feature_; | 111 std::unique_ptr<NavigationFeature> navigation_feature_; |
| 114 std::unique_ptr<ImeFeature> ime_feature_; | 112 std::unique_ptr<ImeFeature> ime_feature_; |
| 115 std::unique_ptr<RenderWidgetFeature> render_widget_feature_; | 113 std::unique_ptr<RenderWidgetFeature> render_widget_feature_; |
| 116 std::unique_ptr<SettingsFeature> settings_feature_; | |
| 117 | 114 |
| 118 // The AssignmentSource is used when the user of BlimpClientSession calls | 115 // The AssignmentSource is used when the user of BlimpClientSession calls |
| 119 // Connect() to get a valid assignment and later connect to the engine. | 116 // Connect() to get a valid assignment and later connect to the engine. |
| 120 std::unique_ptr<AssignmentSource> assignment_source_; | 117 std::unique_ptr<AssignmentSource> assignment_source_; |
| 121 | 118 |
| 122 // Container struct for network components. | 119 // Container struct for network components. |
| 123 // Must be deleted on the IO thread. | 120 // Must be deleted on the IO thread. |
| 124 std::unique_ptr<ClientNetworkComponents> net_components_; | 121 std::unique_ptr<ClientNetworkComponents> net_components_; |
| 125 | 122 |
| 126 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; | 123 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; |
| 127 | 124 |
| 128 base::WeakPtrFactory<BlimpClientSession> weak_factory_; | 125 base::WeakPtrFactory<BlimpClientSession> weak_factory_; |
| 129 | 126 |
| 130 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); | 127 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); |
| 131 }; | 128 }; |
| 132 | 129 |
| 133 } // namespace client | 130 } // namespace client |
| 134 } // namespace blimp | 131 } // namespace blimp |
| 135 | 132 |
| 136 #endif // BLIMP_CLIENT_APP_SESSION_BLIMP_CLIENT_SESSION_H_ | 133 #endif // BLIMP_CLIENT_APP_SESSION_BLIMP_CLIENT_SESSION_H_ |
| OLD | NEW |