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/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/threading/thread.h" | |
10 #include "blimp/client/blimp_client_export.h" | 12 #include "blimp/client/blimp_client_export.h" |
13 #include "blimp/common/proto/blimp_message.pb.h" | |
14 #include "blimp/net/blimp_message_processor.h" | |
11 | 15 |
12 namespace blimp { | 16 namespace blimp { |
13 | 17 |
14 class BrowserConnectionHandler; | 18 class BrowserConnectionHandler; |
19 class ClientConnectionManager; | |
20 class ClientNetworkComponents; | |
15 class NavigationFeature; | 21 class NavigationFeature; |
16 class RenderWidgetFeature; | 22 class RenderWidgetFeature; |
17 class TabControlFeature; | 23 class TabControlFeature; |
18 | 24 |
19 // BlimpClientSession represents a single active session of Blimp on the client | 25 // BlimpClientSession represents a single active session of Blimp on the client |
20 // regardless of whether or not the client application is in the background or | 26 // regardless of whether or not the client application is in the background or |
21 // foreground. The only time this session is invalid is during initialization | 27 // foreground. The only time this session is invalid is during initialization |
22 // and shutdown of this particular client process (or Activity on Android). | 28 // and shutdown of this particular client process (or Activity on Android). |
23 // | 29 // |
24 // This session glues together the feature proxy components and the network | 30 // This session glues together the feature proxy components and the network |
25 // layer. The network components must be interacted with on the IO thread. The | 31 // layer. The network components must be interacted with on the IO thread. The |
26 // feature proxies must be interacted with on the UI thread. | 32 // feature proxies must be interacted with on the UI thread. |
27 class BLIMP_CLIENT_EXPORT BlimpClientSession { | 33 class BLIMP_CLIENT_EXPORT BlimpClientSession { |
28 public: | 34 public: |
29 BlimpClientSession(); | 35 BlimpClientSession(); |
30 | 36 |
31 TabControlFeature* GetTabControlFeature() const; | 37 TabControlFeature* GetTabControlFeature() const; |
32 NavigationFeature* GetNavigationFeature() const; | 38 NavigationFeature* GetNavigationFeature() const; |
33 RenderWidgetFeature* GetRenderWidgetFeature() const; | 39 RenderWidgetFeature* GetRenderWidgetFeature() const; |
34 | 40 |
41 // Tells |connection_manager_| to start connecting to the remote host. | |
42 // Must be called on the IO thread. | |
43 void Connect(); | |
44 | |
35 protected: | 45 protected: |
36 virtual ~BlimpClientSession(); | 46 virtual ~BlimpClientSession(); |
37 | 47 |
48 ClientConnectionManager* GetConnectionManager() const; | |
haibinlu
2016/01/04 19:45:45
why expose connection manager?
Kevin M
2016/01/04 20:42:12
Not needed anymore, removed.
| |
49 | |
38 private: | 50 private: |
39 // The BrowserConnectionHandler is here so that the BlimpClientSession can | 51 base::Thread io_thread_; |
40 // glue the feature-specific handlers to the actual network connection. | |
41 scoped_ptr<BrowserConnectionHandler> connection_handler_; | |
42 | |
43 scoped_ptr<TabControlFeature> tab_control_feature_; | 52 scoped_ptr<TabControlFeature> tab_control_feature_; |
44 scoped_ptr<NavigationFeature> navigation_feature_; | 53 scoped_ptr<NavigationFeature> navigation_feature_; |
45 scoped_ptr<RenderWidgetFeature> render_widget_feature_; | 54 scoped_ptr<RenderWidgetFeature> render_widget_feature_; |
46 | 55 |
56 // Container struct for network components. | |
57 // Must be deleted on the IO thread. | |
58 scoped_ptr<ClientNetworkComponents> network_components_; | |
59 | |
47 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); | 60 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); |
48 }; | 61 }; |
49 | 62 |
50 } // namespace blimp | 63 } // namespace blimp |
51 | 64 |
52 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ | 65 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ |
OLD | NEW |