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

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

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

Powered by Google App Engine
This is Rietveld 408576698