| 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 WebInputFeature; | 
| 35 class RenderWidgetFeature; | 36 class RenderWidgetFeature; | 
| 36 class TabControlFeature; | 37 class TabControlFeature; | 
| 37 | 38 | 
| 38 // BlimpClientSession represents a single active session of Blimp on the client | 39 // BlimpClientSession represents a single active session of Blimp on the client | 
| 39 // regardless of whether or not the client application is in the background or | 40 // regardless of whether or not the client application is in the background or | 
| 40 // foreground.  The only time this session is invalid is during initialization | 41 // foreground.  The only time this session is invalid is during initialization | 
| 41 // and shutdown of this particular client process (or Activity on Android). | 42 // and shutdown of this particular client process (or Activity on Android). | 
| 42 // | 43 // | 
| 43 // This session glues together the feature proxy components and the network | 44 // This session glues together the feature proxy components and the network | 
| 44 // layer.  The network components must be interacted with on the IO thread.  The | 45 // layer.  The network components must be interacted with on the IO thread.  The | 
| 45 // feature proxies must be interacted with on the UI thread. | 46 // feature proxies must be interacted with on the UI thread. | 
| 46 class BLIMP_CLIENT_EXPORT BlimpClientSession { | 47 class BLIMP_CLIENT_EXPORT BlimpClientSession { | 
| 47  public: | 48  public: | 
| 48   BlimpClientSession(); | 49   BlimpClientSession(); | 
| 49 | 50 | 
| 50   // Uses the AssignmentSource to get an Assignment and then uses the assignment | 51   // Uses the AssignmentSource to get an Assignment and then uses the assignment | 
| 51   // configuration to connect to the Blimplet. | 52   // configuration to connect to the Blimplet. | 
| 52   // |client_auth_token| is the OAuth2 access token to use when querying | 53   // |client_auth_token| is the OAuth2 access token to use when querying | 
| 53   // for an assignment.  This token needs the OAuth2 scope of userinfo.email and | 54   // for an assignment.  This token needs the OAuth2 scope of userinfo.email and | 
| 54   // only needs to be an access token, not a refresh token. | 55   // only needs to be an access token, not a refresh token. | 
| 55   void Connect(const std::string& client_auth_token); | 56   void Connect(const std::string& client_auth_token); | 
| 56 | 57 | 
| 57   TabControlFeature* GetTabControlFeature() const; | 58   TabControlFeature* GetTabControlFeature() const; | 
| 58   NavigationFeature* GetNavigationFeature() const; | 59   NavigationFeature* GetNavigationFeature() const; | 
|  | 60   WebInputFeature* GetWebInputFeature() const; | 
| 59   RenderWidgetFeature* GetRenderWidgetFeature() const; | 61   RenderWidgetFeature* GetRenderWidgetFeature() const; | 
| 60 | 62 | 
| 61   // The AssignmentCallback for when an assignment is ready. This will trigger | 63   // The AssignmentCallback for when an assignment is ready. This will trigger | 
| 62   // a connection to the engine. | 64   // a connection to the engine. | 
| 63   virtual void ConnectWithAssignment(AssignmentSource::Result result, | 65   virtual void ConnectWithAssignment(AssignmentSource::Result result, | 
| 64                                      const Assignment& assignment); | 66                                      const Assignment& assignment); | 
| 65 | 67 | 
| 66  protected: | 68  protected: | 
| 67   virtual ~BlimpClientSession(); | 69   virtual ~BlimpClientSession(); | 
| 68 | 70 | 
| 69   // Notified every time the AssignmentSource returns the result of an attempted | 71   // Notified every time the AssignmentSource returns the result of an attempted | 
| 70   // assignment request. | 72   // assignment request. | 
| 71   virtual void OnAssignmentConnectionAttempted(AssignmentSource::Result result); | 73   virtual void OnAssignmentConnectionAttempted(AssignmentSource::Result result); | 
| 72 | 74 | 
| 73  private: | 75  private: | 
| 74   void RegisterFeatures(); | 76   void RegisterFeatures(); | 
| 75 | 77 | 
| 76   base::Thread io_thread_; | 78   base::Thread io_thread_; | 
| 77   scoped_ptr<TabControlFeature> tab_control_feature_; | 79   scoped_ptr<TabControlFeature> tab_control_feature_; | 
| 78   scoped_ptr<NavigationFeature> navigation_feature_; | 80   scoped_ptr<NavigationFeature> navigation_feature_; | 
|  | 81   scoped_ptr<WebInputFeature> web_input_feature_; | 
| 79   scoped_ptr<RenderWidgetFeature> render_widget_feature_; | 82   scoped_ptr<RenderWidgetFeature> render_widget_feature_; | 
| 80 | 83 | 
| 81   // The AssignmentSource is used when the user of BlimpClientSession calls | 84   // The AssignmentSource is used when the user of BlimpClientSession calls | 
| 82   // Connect() to get a valid assignment and later connect to the engine. | 85   // Connect() to get a valid assignment and later connect to the engine. | 
| 83   scoped_ptr<AssignmentSource> assignment_source_; | 86   scoped_ptr<AssignmentSource> assignment_source_; | 
| 84 | 87 | 
| 85   // Container struct for network components. | 88   // Container struct for network components. | 
| 86   // Must be deleted on the IO thread. | 89   // Must be deleted on the IO thread. | 
| 87   scoped_ptr<ClientNetworkComponents> net_components_; | 90   scoped_ptr<ClientNetworkComponents> net_components_; | 
| 88 | 91 | 
| 89   scoped_ptr<ThreadPipeManager> thread_pipe_manager_; | 92   scoped_ptr<ThreadPipeManager> thread_pipe_manager_; | 
| 90 | 93 | 
| 91   base::WeakPtrFactory<BlimpClientSession> weak_factory_; | 94   base::WeakPtrFactory<BlimpClientSession> weak_factory_; | 
| 92 | 95 | 
| 93   DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); | 96   DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); | 
| 94 }; | 97 }; | 
| 95 | 98 | 
| 96 }  // namespace client | 99 }  // namespace client | 
| 97 }  // namespace blimp | 100 }  // namespace blimp | 
| 98 | 101 | 
| 99 #endif  // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ | 102 #endif  // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ | 
| OLD | NEW | 
|---|