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

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

Issue 2255533002: Add TabControlFeature to BlimpClientContextImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync to head Created 4 years, 4 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
« no previous file with comments | « blimp/client/core/BUILD.gn ('k') | blimp/client/core/blimp_client_context_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 BlimpContentsManager; 27 class BlimpContentsManager;
28 class TabControlFeature;
28 29
29 // BlimpClientContextImpl is the implementation of the main context-class for 30 // BlimpClientContextImpl is the implementation of the main context-class for
30 // the blimp client. 31 // the blimp client.
31 class BlimpClientContextImpl : public BlimpClientContext, 32 class BlimpClientContextImpl : public BlimpClientContext,
32 public NetworkEventObserver { 33 public NetworkEventObserver {
33 public: 34 public:
34 // The |io_thread_task_runner| must be the task runner to use for IO 35 // The |io_thread_task_runner| must be the task runner to use for IO
35 // operations. 36 // operations.
36 // The |file_thread_task_runner| must be the task runner to use for file 37 // The |file_thread_task_runner| must be the task runner to use for file
37 // operations. 38 // operations.
38 BlimpClientContextImpl( 39 BlimpClientContextImpl(
39 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, 40 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner,
40 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner); 41 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner);
41 ~BlimpClientContextImpl() override; 42 ~BlimpClientContextImpl() override;
42 43
43 // BlimpClientContext implementation. 44 // BlimpClientContext implementation.
44 void SetDelegate(BlimpClientContextDelegate* delegate) override; 45 void SetDelegate(BlimpClientContextDelegate* delegate) override;
45 std::unique_ptr<BlimpContents> CreateBlimpContents() override; 46 std::unique_ptr<BlimpContents> CreateBlimpContents() override;
46 void Connect() override; 47 void Connect() override;
47 48
48 // NetworkEventObserver implementation. 49 // NetworkEventObserver implementation.
49 void OnConnected() override; 50 void OnConnected() override;
50 void OnDisconnected(int result) override; 51 void OnDisconnected(int result) override;
51 52
53 TabControlFeature* GetTabControlFeature() const;
54
52 protected: 55 protected:
53 // Returns the URL to use for connections to the assigner. Used to construct 56 // Returns the URL to use for connections to the assigner. Used to construct
54 // the AssignmentSource. 57 // the AssignmentSource.
55 virtual GURL GetAssignerURL(); 58 virtual GURL GetAssignerURL();
56 59
57 private: 60 private:
58 // Connect to assignment source with OAuth2 token to get an assignment. 61 // Connect to assignment source with OAuth2 token to get an assignment.
59 virtual void ConnectToAssignmentSource(const std::string& client_auth_token); 62 virtual void ConnectToAssignmentSource(const std::string& client_auth_token);
60 63
61 // The AssignmentCallback for when an assignment is ready. This will trigger 64 // The AssignmentCallback for when an assignment is ready. This will trigger
62 // a connection to the engine. 65 // a connection to the engine.
63 virtual void ConnectWithAssignment(AssignmentRequestResult result, 66 virtual void ConnectWithAssignment(AssignmentRequestResult result,
64 const Assignment& assignment); 67 const Assignment& assignment);
65 68
69 void RegisterFeatures();
70
66 // Provides functionality from the embedder. 71 // Provides functionality from the embedder.
67 BlimpClientContextDelegate* delegate_ = nullptr; 72 BlimpClientContextDelegate* delegate_ = nullptr;
68 73
69 // The task runner to use for IO operations. 74 // The task runner to use for IO operations.
70 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; 75 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
71 76
72 // The task runner to use for file operations. 77 // The task runner to use for file operations.
73 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; 78 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_;
74 79
75 // The AssignmentSource is used when the user of BlimpClientContextImpl calls 80 // The AssignmentSource is used when the user of BlimpClientContextImpl calls
76 // Connect() to get a valid assignment and later connect to the engine. 81 // Connect() to get a valid assignment and later connect to the engine.
77 std::unique_ptr<AssignmentSource> assignment_source_; 82 std::unique_ptr<AssignmentSource> assignment_source_;
78 83
84 std::unique_ptr<TabControlFeature> tab_control_feature_;
85
79 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_; 86 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_;
80 87
81 // Container struct for network components. 88 // Container struct for network components.
82 // Must be deleted on the IO thread. 89 // Must be deleted on the IO thread.
83 std::unique_ptr<ClientNetworkComponents> net_components_; 90 std::unique_ptr<ClientNetworkComponents> net_components_;
84 91
85 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; 92 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
86 93
87 // Provide OAuth2 token and propagate account sign in states change. 94 // Provide OAuth2 token and propagate account sign in states change.
88 std::unique_ptr<IdentitySource> identity_source_; 95 std::unique_ptr<IdentitySource> identity_source_;
89 96
90 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; 97 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_;
91 98
92 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); 99 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl);
93 }; 100 };
94 101
95 } // namespace client 102 } // namespace client
96 } // namespace blimp 103 } // namespace blimp
97 104
98 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ 105 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_
OLDNEW
« no previous file with comments | « blimp/client/core/BUILD.gn ('k') | blimp/client/core/blimp_client_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698