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

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

Issue 2322843002: Propagate connection info to Blimp android UI. (Closed)
Patch Set: Merge conflicts. 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 #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/compositor/blob_image_serialization_processor.h"
17 #include "blimp/client/core/session/client_network_components.h" 17 #include "blimp/client/core/session/client_network_components.h"
18 #include "blimp/client/core/session/connection_status.h"
18 #include "blimp/client/core/session/identity_source.h" 19 #include "blimp/client/core/session/identity_source.h"
19 #include "blimp/client/core/session/network_event_observer.h" 20 #include "blimp/client/core/settings/blimp_settings_delegate.h"
20 #include "blimp/client/public/blimp_client_context.h" 21 #include "blimp/client/public/blimp_client_context.h"
21 #include "blimp/client/public/contents/blimp_contents.h" 22 #include "blimp/client/public/contents/blimp_contents.h"
22 #include "blimp/client/public/session/assignment.h" 23 #include "blimp/client/public/session/assignment.h"
23 #include "blimp/net/thread_pipe_manager.h" 24 #include "blimp/net/thread_pipe_manager.h"
24 #include "url/gurl.h" 25 #include "url/gurl.h"
25 26
26 namespace blimp { 27 namespace blimp {
27 namespace client { 28 namespace client {
28 29
29 class BlimpCompositorDependencies; 30 class BlimpCompositorDependencies;
30 class BlimpContentsManager; 31 class BlimpContentsManager;
31 class BlobChannelFeature; 32 class BlobChannelFeature;
32 class CompositorDependencies; 33 class CompositorDependencies;
33 class GeolocationFeature; 34 class GeolocationFeature;
34 class ImeFeature; 35 class ImeFeature;
35 class NavigationFeature; 36 class NavigationFeature;
36 class RenderWidgetFeature; 37 class RenderWidgetFeature;
37 class SettingsFeature; 38 class SettingsFeature;
38 class TabControlFeature; 39 class TabControlFeature;
39 40
40 // BlimpClientContextImpl is the implementation of the main context-class for 41 // BlimpClientContextImpl is the implementation of the main context-class for
41 // the blimp client. 42 // the blimp client.
42 class BlimpClientContextImpl 43 class BlimpClientContextImpl
43 : public BlimpClientContext, 44 : public BlimpClientContext,
44 public BlobImageSerializationProcessor::ErrorDelegate, 45 public BlimpSettingsDelegate,
45 public NetworkEventObserver { 46 public BlobImageSerializationProcessor::ErrorDelegate {
46 public: 47 public:
47 // The |io_thread_task_runner| must be the task runner to use for IO 48 // The |io_thread_task_runner| must be the task runner to use for IO
48 // operations. 49 // operations.
49 // The |file_thread_task_runner| must be the task runner to use for file 50 // The |file_thread_task_runner| must be the task runner to use for file
50 // operations. 51 // operations.
51 BlimpClientContextImpl( 52 BlimpClientContextImpl(
52 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, 53 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner,
53 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, 54 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
54 std::unique_ptr<CompositorDependencies> compositor_dependencies); 55 std::unique_ptr<CompositorDependencies> compositor_dependencies);
55 ~BlimpClientContextImpl() override; 56 ~BlimpClientContextImpl() override;
56 57
57 // BlimpClientContext implementation. 58 // BlimpClientContext implementation.
58 void SetDelegate(BlimpClientContextDelegate* delegate) override; 59 void SetDelegate(BlimpClientContextDelegate* delegate) override;
59 std::unique_ptr<BlimpContents> CreateBlimpContents( 60 std::unique_ptr<BlimpContents> CreateBlimpContents(
60 gfx::NativeWindow window) override; 61 gfx::NativeWindow window) override;
61 void Connect() override; 62 void Connect() override;
62 void ConnectWithAssignment(const Assignment& assignment) override; 63 void ConnectWithAssignment(const Assignment& assignment) override;
63 64
64 // NetworkEventObserver implementation.
65 void OnConnected() override;
66 void OnDisconnected(int result) override;
67
68 protected: 65 protected:
69 // Returns the URL to use for connections to the assigner. Used to construct 66 // Returns the URL to use for connections to the assigner. Used to construct
70 // the AssignmentSource. 67 // the AssignmentSource.
71 virtual GURL GetAssignerURL(); 68 virtual GURL GetAssignerURL();
72 69
73 IdentitySource* GetIdentitySource(); 70 // BlimpSettingsDelegate implementation.
71 IdentitySource* GetIdentitySource() override;
72 ConnectionStatus* GetConnectionStatus() override;
74 73
75 private: 74 private:
76 // Called when an OAuth2 token is received. Will then ask the 75 // Called when an OAuth2 token is received. Will then ask the
77 // AssignmentSource for an Assignment with this token. 76 // AssignmentSource for an Assignment with this token.
78 virtual void OnAuthTokenReceived(const std::string& client_auth_token); 77 virtual void OnAuthTokenReceived(const std::string& client_auth_token);
79 78
80 // Called when the AssignmentSource is finished getting an Assignment. Will 79 // Called when the AssignmentSource is finished getting an Assignment. Will
81 // then call |ConnectWithAssignment| to initiate the actual connection. 80 // then call |ConnectWithAssignment| to initiate the actual connection.
82 virtual void OnAssignmentReceived(AssignmentRequestResult result, 81 virtual void OnAssignmentReceived(AssignmentRequestResult result,
83 const Assignment& assignment); 82 const Assignment& assignment);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 120
122 // Container struct for network components. 121 // Container struct for network components.
123 // Must be deleted on the IO thread. 122 // Must be deleted on the IO thread.
124 std::unique_ptr<ClientNetworkComponents> net_components_; 123 std::unique_ptr<ClientNetworkComponents> net_components_;
125 124
126 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; 125 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
127 126
128 // Provide OAuth2 token and propagate account sign in states change. 127 // Provide OAuth2 token and propagate account sign in states change.
129 std::unique_ptr<IdentitySource> identity_source_; 128 std::unique_ptr<IdentitySource> identity_source_;
130 129
130 // Connection status to the engine.
131 ConnectionStatus connection_status_;
132
131 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; 133 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_;
132 134
133 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); 135 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl);
134 }; 136 };
135 137
136 } // namespace client 138 } // namespace client
137 } // namespace blimp 139 } // namespace blimp
138 140
139 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ 141 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698