OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ | 5 #ifndef BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ |
6 #define BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ | 6 #define BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "blimp/client/core/compositor/blob_image_serialization_processor.h" |
16 #include "blimp/client/core/session/client_network_components.h" | 17 #include "blimp/client/core/session/client_network_components.h" |
17 #include "blimp/client/core/session/identity_source.h" | 18 #include "blimp/client/core/session/identity_source.h" |
18 #include "blimp/client/core/session/network_event_observer.h" | 19 #include "blimp/client/core/session/network_event_observer.h" |
19 #include "blimp/client/public/blimp_client_context.h" | 20 #include "blimp/client/public/blimp_client_context.h" |
20 #include "blimp/client/public/contents/blimp_contents.h" | 21 #include "blimp/client/public/contents/blimp_contents.h" |
21 #include "blimp/client/public/session/assignment.h" | 22 #include "blimp/client/public/session/assignment.h" |
22 #include "blimp/net/thread_pipe_manager.h" | 23 #include "blimp/net/thread_pipe_manager.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
24 | 25 |
25 namespace blimp { | 26 namespace blimp { |
26 namespace client { | 27 namespace client { |
27 | 28 |
28 class BlimpCompositorDependencies; | 29 class BlimpCompositorDependencies; |
29 class BlimpContentsManager; | 30 class BlimpContentsManager; |
| 31 class BlobChannelFeature; |
30 class CompositorDependencies; | 32 class CompositorDependencies; |
31 class GeolocationFeature; | 33 class GeolocationFeature; |
32 class ImeFeature; | 34 class ImeFeature; |
33 class NavigationFeature; | 35 class NavigationFeature; |
34 class RenderWidgetFeature; | 36 class RenderWidgetFeature; |
35 class SettingsFeature; | 37 class SettingsFeature; |
36 class TabControlFeature; | 38 class TabControlFeature; |
37 | 39 |
38 // BlimpClientContextImpl is the implementation of the main context-class for | 40 // BlimpClientContextImpl is the implementation of the main context-class for |
39 // the blimp client. | 41 // the blimp client. |
40 class BlimpClientContextImpl : public BlimpClientContext, | 42 class BlimpClientContextImpl |
41 public NetworkEventObserver { | 43 : public BlimpClientContext, |
| 44 public BlobImageSerializationProcessor::ErrorDelegate, |
| 45 public NetworkEventObserver { |
42 public: | 46 public: |
43 // The |io_thread_task_runner| must be the task runner to use for IO | 47 // The |io_thread_task_runner| must be the task runner to use for IO |
44 // operations. | 48 // operations. |
45 // The |file_thread_task_runner| must be the task runner to use for file | 49 // The |file_thread_task_runner| must be the task runner to use for file |
46 // operations. | 50 // operations. |
47 BlimpClientContextImpl( | 51 BlimpClientContextImpl( |
48 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 52 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
49 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, | 53 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
50 std::unique_ptr<CompositorDependencies> compositor_dependencies); | 54 std::unique_ptr<CompositorDependencies> compositor_dependencies); |
51 ~BlimpClientContextImpl() override; | 55 ~BlimpClientContextImpl() override; |
(...skipping 24 matching lines...) Expand all Loading... |
76 virtual void ConnectWithAssignment(AssignmentRequestResult result, | 80 virtual void ConnectWithAssignment(AssignmentRequestResult result, |
77 const Assignment& assignment); | 81 const Assignment& assignment); |
78 | 82 |
79 void RegisterFeatures(); | 83 void RegisterFeatures(); |
80 void InitializeSettings(); | 84 void InitializeSettings(); |
81 | 85 |
82 // Create IdentitySource which provides user sign in states and OAuth2 token | 86 // Create IdentitySource which provides user sign in states and OAuth2 token |
83 // service. | 87 // service. |
84 void CreateIdentitySource(); | 88 void CreateIdentitySource(); |
85 | 89 |
| 90 // BlobImageSerializationProcessor::ErrorDelegate implementation. |
| 91 void OnImageDecodeError() override; |
| 92 |
86 // Provides functionality from the embedder. | 93 // Provides functionality from the embedder. |
87 BlimpClientContextDelegate* delegate_ = nullptr; | 94 BlimpClientContextDelegate* delegate_ = nullptr; |
88 | 95 |
89 // The task runner to use for IO operations. | 96 // The task runner to use for IO operations. |
90 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; | 97 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; |
91 | 98 |
92 // The task runner to use for file operations. | 99 // The task runner to use for file operations. |
93 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; | 100 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; |
94 | 101 |
95 // The AssignmentSource is used when the user of BlimpClientContextImpl calls | 102 // The AssignmentSource is used when the user of BlimpClientContextImpl calls |
96 // Connect() to get a valid assignment and later connect to the engine. | 103 // Connect() to get a valid assignment and later connect to the engine. |
97 std::unique_ptr<AssignmentSource> assignment_source_; | 104 std::unique_ptr<AssignmentSource> assignment_source_; |
98 | 105 |
99 // A set of dependencies required by all BlimpCompositor instances. | 106 // A set of dependencies required by all BlimpCompositor instances. |
100 std::unique_ptr<BlimpCompositorDependencies> blimp_compositor_dependencies_; | 107 std::unique_ptr<BlimpCompositorDependencies> blimp_compositor_dependencies_; |
101 | 108 |
102 // Features to handle all incoming and outgoing protobuf messages. | 109 // Features to handle all incoming and outgoing protobuf messages. |
| 110 std::unique_ptr<BlobChannelFeature> blob_channel_feature_; |
103 std::unique_ptr<GeolocationFeature> geolocation_feature_; | 111 std::unique_ptr<GeolocationFeature> geolocation_feature_; |
104 std::unique_ptr<ImeFeature> ime_feature_; | 112 std::unique_ptr<ImeFeature> ime_feature_; |
105 std::unique_ptr<NavigationFeature> navigation_feature_; | 113 std::unique_ptr<NavigationFeature> navigation_feature_; |
106 std::unique_ptr<RenderWidgetFeature> render_widget_feature_; | 114 std::unique_ptr<RenderWidgetFeature> render_widget_feature_; |
107 std::unique_ptr<SettingsFeature> settings_feature_; | 115 std::unique_ptr<SettingsFeature> settings_feature_; |
108 std::unique_ptr<TabControlFeature> tab_control_feature_; | 116 std::unique_ptr<TabControlFeature> tab_control_feature_; |
109 | 117 |
110 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_; | 118 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_; |
111 | 119 |
112 // Container struct for network components. | 120 // Container struct for network components. |
113 // Must be deleted on the IO thread. | 121 // Must be deleted on the IO thread. |
114 std::unique_ptr<ClientNetworkComponents> net_components_; | 122 std::unique_ptr<ClientNetworkComponents> net_components_; |
115 | 123 |
116 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; | 124 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; |
117 | 125 |
118 // Provide OAuth2 token and propagate account sign in states change. | 126 // Provide OAuth2 token and propagate account sign in states change. |
119 std::unique_ptr<IdentitySource> identity_source_; | 127 std::unique_ptr<IdentitySource> identity_source_; |
120 | 128 |
121 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; | 129 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; |
122 | 130 |
123 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); | 131 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); |
124 }; | 132 }; |
125 | 133 |
126 } // namespace client | 134 } // namespace client |
127 } // namespace blimp | 135 } // namespace blimp |
128 | 136 |
129 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ | 137 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ |
OLD | NEW |