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

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

Issue 2322843002: Propagate connection info to Blimp android UI. (Closed)
Patch Set: Minor fix. 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 63
63 // NetworkEventObserver implementation.
64 void OnConnected() override;
65 void OnDisconnected(int result) override;
66
67 protected: 64 protected:
68 // 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
69 // the AssignmentSource. 66 // the AssignmentSource.
70 virtual GURL GetAssignerURL(); 67 virtual GURL GetAssignerURL();
71 68
72 IdentitySource* GetIdentitySource(); 69 // BlimpSettingsDelegate implementation.
70 IdentitySource* GetIdentitySource() override;
71 ConnectionStatus* GetConnectionStatus() override;
73 72
74 private: 73 private:
75 // Connect to assignment source with OAuth2 token to get an assignment. 74 // Connect to assignment source with OAuth2 token to get an assignment.
76 virtual void ConnectToAssignmentSource(const std::string& client_auth_token); 75 virtual void ConnectToAssignmentSource(const std::string& client_auth_token);
77 76
78 // The AssignmentCallback for when an assignment is ready. This will trigger 77 // The AssignmentCallback for when an assignment is ready. This will trigger
79 // a connection to the engine. 78 // a connection to the engine.
80 virtual void ConnectWithAssignment(AssignmentRequestResult result, 79 virtual void ConnectWithAssignment(AssignmentRequestResult result,
81 const Assignment& assignment); 80 const Assignment& assignment);
82 81
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 118
120 // Container struct for network components. 119 // Container struct for network components.
121 // Must be deleted on the IO thread. 120 // Must be deleted on the IO thread.
122 std::unique_ptr<ClientNetworkComponents> net_components_; 121 std::unique_ptr<ClientNetworkComponents> net_components_;
123 122
124 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; 123 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
125 124
126 // Provide OAuth2 token and propagate account sign in states change. 125 // Provide OAuth2 token and propagate account sign in states change.
127 std::unique_ptr<IdentitySource> identity_source_; 126 std::unique_ptr<IdentitySource> identity_source_;
128 127
128 // Connection status to the engine.
129 ConnectionStatus connection_status_;
130
129 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; 131 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_;
130 132
131 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); 133 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl);
132 }; 134 };
133 135
134 } // namespace client 136 } // namespace client
135 } // namespace blimp 137 } // namespace blimp
136 138
137 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ 139 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698