| 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 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "blimp/client/core/session/client_network_components.h" | 15 #include "blimp/client/core/session/client_network_components.h" |
| 16 #include "blimp/client/core/session/identity_source.h" | 16 #include "blimp/client/core/session/identity_source.h" |
| 17 #include "blimp/client/core/session/network_event_observer.h" | 17 #include "blimp/client/core/session/network_event_observer.h" |
| 18 #include "blimp/client/public/blimp_client_context.h" | 18 #include "blimp/client/public/blimp_client_context.h" |
| 19 #include "blimp/client/public/contents/blimp_contents.h" | 19 #include "blimp/client/public/contents/blimp_contents.h" |
| 20 #include "blimp/client/public/session/assignment.h" | 20 #include "blimp/client/public/session/assignment.h" |
| 21 #include "blimp/net/thread_pipe_manager.h" | 21 #include "blimp/net/thread_pipe_manager.h" |
| 22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 23 | 23 |
| 24 namespace blimp { | 24 namespace blimp { |
| 25 namespace client { | 25 namespace client { |
| 26 | 26 |
| 27 class BlimpCompositorDependencies; |
| 27 class BlimpContentsManager; | 28 class BlimpContentsManager; |
| 28 class ImeFeature; | 29 class ImeFeature; |
| 29 class NavigationFeature; | 30 class NavigationFeature; |
| 30 class TabControlFeature; | 31 class TabControlFeature; |
| 31 | 32 |
| 32 // BlimpClientContextImpl is the implementation of the main context-class for | 33 // BlimpClientContextImpl is the implementation of the main context-class for |
| 33 // the blimp client. | 34 // the blimp client. |
| 34 class BlimpClientContextImpl : public BlimpClientContext, | 35 class BlimpClientContextImpl : public BlimpClientContext, |
| 35 public NetworkEventObserver { | 36 public NetworkEventObserver { |
| 36 public: | 37 public: |
| 37 // The |io_thread_task_runner| must be the task runner to use for IO | 38 // The |io_thread_task_runner| must be the task runner to use for IO |
| 38 // operations. | 39 // operations. |
| 39 // The |file_thread_task_runner| must be the task runner to use for file | 40 // The |file_thread_task_runner| must be the task runner to use for file |
| 40 // operations. | 41 // operations. |
| 41 BlimpClientContextImpl( | 42 BlimpClientContextImpl( |
| 42 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 43 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
| 43 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner); | 44 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
| 45 std::unique_ptr<CompositorDependencies> compositor_dependencies); |
| 44 ~BlimpClientContextImpl() override; | 46 ~BlimpClientContextImpl() override; |
| 45 | 47 |
| 46 // BlimpClientContext implementation. | 48 // BlimpClientContext implementation. |
| 47 void SetDelegate(BlimpClientContextDelegate* delegate) override; | 49 void SetDelegate(BlimpClientContextDelegate* delegate) override; |
| 48 std::unique_ptr<BlimpContents> CreateBlimpContents() override; | 50 std::unique_ptr<BlimpContents> CreateBlimpContents() override; |
| 49 void Connect() override; | 51 void Connect() override; |
| 50 | 52 |
| 51 // NetworkEventObserver implementation. | 53 // NetworkEventObserver implementation. |
| 52 void OnConnected() override; | 54 void OnConnected() override; |
| 53 void OnDisconnected(int result) override; | 55 void OnDisconnected(int result) override; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 72 | 74 |
| 73 // Provides functionality from the embedder. | 75 // Provides functionality from the embedder. |
| 74 BlimpClientContextDelegate* delegate_ = nullptr; | 76 BlimpClientContextDelegate* delegate_ = nullptr; |
| 75 | 77 |
| 76 // The task runner to use for IO operations. | 78 // The task runner to use for IO operations. |
| 77 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; | 79 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; |
| 78 | 80 |
| 79 // The task runner to use for file operations. | 81 // The task runner to use for file operations. |
| 80 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; | 82 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; |
| 81 | 83 |
| 84 std::unique_ptr<BlimpCompositorDependencies> blimp_compositor_dependencies_; |
| 85 |
| 82 // The AssignmentSource is used when the user of BlimpClientContextImpl calls | 86 // The AssignmentSource is used when the user of BlimpClientContextImpl calls |
| 83 // Connect() to get a valid assignment and later connect to the engine. | 87 // Connect() to get a valid assignment and later connect to the engine. |
| 84 std::unique_ptr<AssignmentSource> assignment_source_; | 88 std::unique_ptr<AssignmentSource> assignment_source_; |
| 85 | 89 |
| 86 // Features to handle all incoming and outgoing protobuf messages. | 90 // Features to handle all incoming and outgoing protobuf messages. |
| 87 std::unique_ptr<ImeFeature> ime_feature_; | 91 std::unique_ptr<ImeFeature> ime_feature_; |
| 88 std::unique_ptr<NavigationFeature> navigation_feature_; | 92 std::unique_ptr<NavigationFeature> navigation_feature_; |
| 89 std::unique_ptr<TabControlFeature> tab_control_feature_; | 93 std::unique_ptr<TabControlFeature> tab_control_feature_; |
| 90 | 94 |
| 91 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_; | 95 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_; |
| 92 | 96 |
| 93 // Container struct for network components. | 97 // Container struct for network components. |
| 94 // Must be deleted on the IO thread. | 98 // Must be deleted on the IO thread. |
| 95 std::unique_ptr<ClientNetworkComponents> net_components_; | 99 std::unique_ptr<ClientNetworkComponents> net_components_; |
| 96 | 100 |
| 97 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; | 101 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; |
| 98 | 102 |
| 99 // Provide OAuth2 token and propagate account sign in states change. | 103 // Provide OAuth2 token and propagate account sign in states change. |
| 100 std::unique_ptr<IdentitySource> identity_source_; | 104 std::unique_ptr<IdentitySource> identity_source_; |
| 101 | 105 |
| 102 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; | 106 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; |
| 103 | 107 |
| 104 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); | 108 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); |
| 105 }; | 109 }; |
| 106 | 110 |
| 107 } // namespace client | 111 } // namespace client |
| 108 } // namespace blimp | 112 } // namespace blimp |
| 109 | 113 |
| 110 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ | 114 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ |
| OLD | NEW |