Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Side by Side Diff: blimp/client/core/blimp_client_context_impl.h

Issue 2292723003: Move remaining Blimp feature code to core. (Closed)
Patch Set: Fix build break Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
29 class CompositorDependencies;
28 class ImeFeature; 30 class ImeFeature;
29 class NavigationFeature; 31 class NavigationFeature;
32 class RenderWidgetFeature;
33 class SettingsFeature;
30 class TabControlFeature; 34 class TabControlFeature;
31 35
32 // BlimpClientContextImpl is the implementation of the main context-class for 36 // BlimpClientContextImpl is the implementation of the main context-class for
33 // the blimp client. 37 // the blimp client.
34 class BlimpClientContextImpl : public BlimpClientContext, 38 class BlimpClientContextImpl : public BlimpClientContext,
35 public NetworkEventObserver { 39 public NetworkEventObserver {
36 public: 40 public:
37 // The |io_thread_task_runner| must be the task runner to use for IO 41 // The |io_thread_task_runner| must be the task runner to use for IO
38 // operations. 42 // operations.
39 // The |file_thread_task_runner| must be the task runner to use for file 43 // The |file_thread_task_runner| must be the task runner to use for file
40 // operations. 44 // operations.
41 BlimpClientContextImpl( 45 BlimpClientContextImpl(
42 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, 46 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner,
43 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner); 47 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
48 std::unique_ptr<CompositorDependencies> compositor_dependencies);
44 ~BlimpClientContextImpl() override; 49 ~BlimpClientContextImpl() override;
45 50
46 IdentitySource* GetIdentitySource(); 51 IdentitySource* GetIdentitySource();
47 52
48 // BlimpClientContext implementation. 53 // BlimpClientContext implementation.
49 void SetDelegate(BlimpClientContextDelegate* delegate) override; 54 void SetDelegate(BlimpClientContextDelegate* delegate) override;
50 std::unique_ptr<BlimpContents> CreateBlimpContents() override; 55 std::unique_ptr<BlimpContents> CreateBlimpContents() override;
51 void Connect() override; 56 void Connect() override;
52 57
53 // NetworkEventObserver implementation. 58 // NetworkEventObserver implementation.
54 void OnConnected() override; 59 void OnConnected() override;
55 void OnDisconnected(int result) override; 60 void OnDisconnected(int result) override;
56 61
57 TabControlFeature* GetTabControlFeature() const; 62 TabControlFeature* GetTabControlFeature() const;
58 63
59 protected: 64 protected:
60 // Returns the URL to use for connections to the assigner. Used to construct 65 // Returns the URL to use for connections to the assigner. Used to construct
61 // the AssignmentSource. 66 // the AssignmentSource.
62 virtual GURL GetAssignerURL(); 67 virtual GURL GetAssignerURL();
63 68
64 // Create IdentitySource which provides user sign in states and OAuth2 token
65 // service.
66 void CreateIdentitySource();
67
68 // Provide OAuth2 token and propagate account sign in states change.
69 std::unique_ptr<IdentitySource> identity_source_;
70
71 private: 69 private:
72 // Connect to assignment source with OAuth2 token to get an assignment. 70 // Connect to assignment source with OAuth2 token to get an assignment.
73 virtual void ConnectToAssignmentSource(const std::string& client_auth_token); 71 virtual void ConnectToAssignmentSource(const std::string& client_auth_token);
74 72
75 // The AssignmentCallback for when an assignment is ready. This will trigger 73 // The AssignmentCallback for when an assignment is ready. This will trigger
76 // a connection to the engine. 74 // a connection to the engine.
77 virtual void ConnectWithAssignment(AssignmentRequestResult result, 75 virtual void ConnectWithAssignment(AssignmentRequestResult result,
78 const Assignment& assignment); 76 const Assignment& assignment);
79 77
80 void RegisterFeatures(); 78 void RegisterFeatures();
79 void InitializeSettings();
80
81 // Create IdentitySource which provides user sign in states and OAuth2 token
82 // service.
83 void CreateIdentitySource();
81 84
82 // Provides functionality from the embedder. 85 // Provides functionality from the embedder.
83 BlimpClientContextDelegate* delegate_ = nullptr; 86 BlimpClientContextDelegate* delegate_ = nullptr;
84 87
85 // The task runner to use for IO operations. 88 // The task runner to use for IO operations.
86 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; 89 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
87 90
88 // The task runner to use for file operations. 91 // The task runner to use for file operations.
89 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; 92 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_;
90 93
91 // The AssignmentSource is used when the user of BlimpClientContextImpl calls 94 // The AssignmentSource is used when the user of BlimpClientContextImpl calls
92 // Connect() to get a valid assignment and later connect to the engine. 95 // Connect() to get a valid assignment and later connect to the engine.
93 std::unique_ptr<AssignmentSource> assignment_source_; 96 std::unique_ptr<AssignmentSource> assignment_source_;
94 97
98 // A set of dependencies required by all BlimpCompositor instances.
99 std::unique_ptr<BlimpCompositorDependencies> blimp_compositor_dependencies_;
100
95 // Features to handle all incoming and outgoing protobuf messages. 101 // Features to handle all incoming and outgoing protobuf messages.
96 std::unique_ptr<ImeFeature> ime_feature_; 102 std::unique_ptr<ImeFeature> ime_feature_;
97 std::unique_ptr<NavigationFeature> navigation_feature_; 103 std::unique_ptr<NavigationFeature> navigation_feature_;
104 std::unique_ptr<RenderWidgetFeature> render_widget_feature_;
105 std::unique_ptr<SettingsFeature> settings_feature_;
98 std::unique_ptr<TabControlFeature> tab_control_feature_; 106 std::unique_ptr<TabControlFeature> tab_control_feature_;
99 107
100 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_; 108 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_;
101 109
102 // Container struct for network components. 110 // Container struct for network components.
103 // Must be deleted on the IO thread. 111 // Must be deleted on the IO thread.
104 std::unique_ptr<ClientNetworkComponents> net_components_; 112 std::unique_ptr<ClientNetworkComponents> net_components_;
105 113
106 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; 114 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
107 115
116 // Provide OAuth2 token and propagate account sign in states change.
117 std::unique_ptr<IdentitySource> identity_source_;
118
108 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; 119 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_;
109 120
110 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); 121 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl);
111 }; 122 };
112 123
113 } // namespace client 124 } // namespace client
114 } // namespace blimp 125 } // namespace blimp
115 126
116 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ 127 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_
OLDNEW
« no previous file with comments | « blimp/client/core/android/blimp_client_context_impl_android.cc ('k') | blimp/client/core/blimp_client_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698