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

Side by Side Diff: components/arc/arc_bridge_service.h

Issue 1572483002: Implement OnGetNetworks for net.mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 virtual void OnClipboardInstanceClosed() {} 86 virtual void OnClipboardInstanceClosed() {}
87 87
88 // Called whenever the ARC input interface state changes. 88 // Called whenever the ARC input interface state changes.
89 virtual void OnInputInstanceReady() {} 89 virtual void OnInputInstanceReady() {}
90 virtual void OnInputInstanceClosed() {} 90 virtual void OnInputInstanceClosed() {}
91 91
92 // Called whenever the ARC notification interface state changes. 92 // Called whenever the ARC notification interface state changes.
93 virtual void OnNotificationsInstanceReady() {} 93 virtual void OnNotificationsInstanceReady() {}
94 virtual void OnNotificationsInstanceClosed() {} 94 virtual void OnNotificationsInstanceClosed() {}
95 95
96 // Called whenever the ARC net interface state changes.
97 virtual void OnNetInstanceReady() {}
98 virtual void OnNetInstanceClosed() {}
99
96 // Called whenever the ARC power interface state changes. 100 // Called whenever the ARC power interface state changes.
97 virtual void OnPowerInstanceReady() {} 101 virtual void OnPowerInstanceReady() {}
98 virtual void OnPowerInstanceClosed() {} 102 virtual void OnPowerInstanceClosed() {}
99 103
100 // Called whenever the ARC process interface state changes. 104 // Called whenever the ARC process interface state changes.
101 virtual void OnProcessInstanceReady() {} 105 virtual void OnProcessInstanceReady() {}
102 virtual void OnProcessInstanceClosed() {} 106 virtual void OnProcessInstanceClosed() {}
103 107
104 // Called whenever the ARC settings interface state changes. 108 // Called whenever the ARC settings interface state changes.
105 virtual void OnSettingsInstanceReady() {} 109 virtual void OnSettingsInstanceReady() {}
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 void RemoveObserver(Observer* observer); 143 void RemoveObserver(Observer* observer);
140 144
141 // Gets the Mojo interface for all the instance services. This will return 145 // Gets the Mojo interface for all the instance services. This will return
142 // nullptr if that particular service is not ready yet. Use an Observer if 146 // nullptr if that particular service is not ready yet. Use an Observer if
143 // you want to be notified when this is ready. This can only be called on the 147 // you want to be notified when this is ready. This can only be called on the
144 // thread that this class was created on. 148 // thread that this class was created on.
145 AppInstance* app_instance() { return app_ptr_.get(); } 149 AppInstance* app_instance() { return app_ptr_.get(); }
146 AuthInstance* auth_instance() { return auth_ptr_.get(); } 150 AuthInstance* auth_instance() { return auth_ptr_.get(); }
147 ClipboardInstance* clipboard_instance() { return clipboard_ptr_.get(); } 151 ClipboardInstance* clipboard_instance() { return clipboard_ptr_.get(); }
148 InputInstance* input_instance() { return input_ptr_.get(); } 152 InputInstance* input_instance() { return input_ptr_.get(); }
153 NetInstance* net_instance() { return net_ptr_.get(); }
149 NotificationsInstance* notifications_instance() { 154 NotificationsInstance* notifications_instance() {
150 return notifications_ptr_.get(); 155 return notifications_ptr_.get();
151 } 156 }
152 PowerInstance* power_instance() { return power_ptr_.get(); } 157 PowerInstance* power_instance() { return power_ptr_.get(); }
153 ProcessInstance* process_instance() { return process_ptr_.get(); } 158 ProcessInstance* process_instance() { return process_ptr_.get(); }
154 SettingsInstance* settings_instance() { return settings_ptr_.get(); } 159 SettingsInstance* settings_instance() { return settings_ptr_.get(); }
155 160
156 int32_t app_version() const { return app_ptr_.version(); } 161 int32_t app_version() const { return app_ptr_.version(); }
157 int32_t auth_version() const { return auth_ptr_.version(); } 162 int32_t auth_version() const { return auth_ptr_.version(); }
158 int32_t clipboard_version() const { return clipboard_ptr_.version(); } 163 int32_t clipboard_version() const { return clipboard_ptr_.version(); }
159 int32_t input_version() const { return input_ptr_.version(); } 164 int32_t input_version() const { return input_ptr_.version(); }
160 int32_t notifications_version() const { return notifications_ptr_.version(); } 165 int32_t notifications_version() const { return notifications_ptr_.version(); }
161 int32_t power_version() const { return power_ptr_.version(); } 166 int32_t power_version() const { return power_ptr_.version(); }
162 int32_t process_version() const { return process_ptr_.version(); } 167 int32_t process_version() const { return process_ptr_.version(); }
163 int32_t settings_version() const { return settings_ptr_.version(); } 168 int32_t settings_version() const { return settings_ptr_.version(); }
164 169
165 // ArcHost: 170 // ArcHost:
166 void OnAppInstanceReady(AppInstancePtr app_ptr) override; 171 void OnAppInstanceReady(AppInstancePtr app_ptr) override;
167 void OnAuthInstanceReady(AuthInstancePtr auth_ptr) override; 172 void OnAuthInstanceReady(AuthInstancePtr auth_ptr) override;
168 void OnClipboardInstanceReady(ClipboardInstancePtr clipboard_ptr) override; 173 void OnClipboardInstanceReady(ClipboardInstancePtr clipboard_ptr) override;
169 void OnInputInstanceReady(InputInstancePtr input_ptr) override; 174 void OnInputInstanceReady(InputInstancePtr input_ptr) override;
175 void OnNetInstanceReady(NetInstancePtr net_ptr) override;
170 void OnNotificationsInstanceReady( 176 void OnNotificationsInstanceReady(
171 NotificationsInstancePtr notifications_ptr) override; 177 NotificationsInstancePtr notifications_ptr) override;
172 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override; 178 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override;
173 void OnProcessInstanceReady(ProcessInstancePtr process_ptr) override; 179 void OnProcessInstanceReady(ProcessInstancePtr process_ptr) override;
174 void OnSettingsInstanceReady(SettingsInstancePtr process_ptr) override; 180 void OnSettingsInstanceReady(SettingsInstancePtr process_ptr) override;
175 181
176 // Gets the current state of the bridge service. 182 // Gets the current state of the bridge service.
177 State state() const { return state_; } 183 State state() const { return state_; }
178 184
179 // Gets if ARC is available in this system. 185 // Gets if ARC is available in this system.
(...skipping 20 matching lines...) Expand all
200 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); 206 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic);
201 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); 207 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites);
202 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); 208 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup);
203 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); 209 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart);
204 210
205 // Called when one of the individual channels is closed. 211 // Called when one of the individual channels is closed.
206 void CloseAppChannel(); 212 void CloseAppChannel();
207 void CloseAuthChannel(); 213 void CloseAuthChannel();
208 void CloseClipboardChannel(); 214 void CloseClipboardChannel();
209 void CloseInputChannel(); 215 void CloseInputChannel();
216 void CloseNetChannel();
210 void CloseNotificationsChannel(); 217 void CloseNotificationsChannel();
211 void ClosePowerChannel(); 218 void ClosePowerChannel();
212 void CloseProcessChannel(); 219 void CloseProcessChannel();
213 void CloseSettingsChannel(); 220 void CloseSettingsChannel();
214 221
215 // Callbacks for QueryVersion. 222 // Callbacks for QueryVersion.
216 void OnAppVersionReady(int32_t version); 223 void OnAppVersionReady(int32_t version);
217 void OnAuthVersionReady(int32_t version); 224 void OnAuthVersionReady(int32_t version);
218 void OnClipboardVersionReady(int32_t version); 225 void OnClipboardVersionReady(int32_t version);
219 void OnInputVersionReady(int32_t version); 226 void OnInputVersionReady(int32_t version);
227 void OnNetVersionReady(int32_t version);
220 void OnNotificationsVersionReady(int32_t version); 228 void OnNotificationsVersionReady(int32_t version);
221 void OnPowerVersionReady(int32_t version); 229 void OnPowerVersionReady(int32_t version);
222 void OnProcessVersionReady(int32_t version); 230 void OnProcessVersionReady(int32_t version);
223 void OnSettingsVersionReady(int32_t version); 231 void OnSettingsVersionReady(int32_t version);
224 232
225 // Mojo interfaces. 233 // Mojo interfaces.
226 AppInstancePtr app_ptr_; 234 AppInstancePtr app_ptr_;
227 AuthInstancePtr auth_ptr_; 235 AuthInstancePtr auth_ptr_;
228 ClipboardInstancePtr clipboard_ptr_; 236 ClipboardInstancePtr clipboard_ptr_;
229 InputInstancePtr input_ptr_; 237 InputInstancePtr input_ptr_;
238 NetInstancePtr net_ptr_;
230 NotificationsInstancePtr notifications_ptr_; 239 NotificationsInstancePtr notifications_ptr_;
231 PowerInstancePtr power_ptr_; 240 PowerInstancePtr power_ptr_;
232 ProcessInstancePtr process_ptr_; 241 ProcessInstancePtr process_ptr_;
233 SettingsInstancePtr settings_ptr_; 242 SettingsInstancePtr settings_ptr_;
234 243
235 // Temporary Mojo interfaces. After a Mojo interface pointer has been 244 // Temporary Mojo interfaces. After a Mojo interface pointer has been
236 // received from the other endpoint, we still need to asynchronously query 245 // received from the other endpoint, we still need to asynchronously query
237 // its version. While that is going on, we should still return nullptr on 246 // its version. While that is going on, we should still return nullptr on
238 // the xxx_instance() functions. 247 // the xxx_instance() functions.
239 // To keep the xxx_instance() functions being trivial, store the instance 248 // To keep the xxx_instance() functions being trivial, store the instance
240 // pointer in a temporary variable to avoid losing its reference. 249 // pointer in a temporary variable to avoid losing its reference.
241 AppInstancePtr temporary_app_ptr_; 250 AppInstancePtr temporary_app_ptr_;
242 AuthInstancePtr temporary_auth_ptr_; 251 AuthInstancePtr temporary_auth_ptr_;
243 ClipboardInstancePtr temporary_clipboard_ptr_; 252 ClipboardInstancePtr temporary_clipboard_ptr_;
244 InputInstancePtr temporary_input_ptr_; 253 InputInstancePtr temporary_input_ptr_;
254 NetInstancePtr temporary_net_ptr_;
245 NotificationsInstancePtr temporary_notifications_ptr_; 255 NotificationsInstancePtr temporary_notifications_ptr_;
246 PowerInstancePtr temporary_power_ptr_; 256 PowerInstancePtr temporary_power_ptr_;
247 ProcessInstancePtr temporary_process_ptr_; 257 ProcessInstancePtr temporary_process_ptr_;
248 SettingsInstancePtr temporary_settings_ptr_; 258 SettingsInstancePtr temporary_settings_ptr_;
249 259
250 base::ObserverList<Observer> observer_list_; 260 base::ObserverList<Observer> observer_list_;
251 261
252 base::ThreadChecker thread_checker_; 262 base::ThreadChecker thread_checker_;
253 263
254 // If the ARC instance service is available. 264 // If the ARC instance service is available.
255 bool available_; 265 bool available_;
256 266
257 // The current state of the bridge. 267 // The current state of the bridge.
258 ArcBridgeService::State state_; 268 ArcBridgeService::State state_;
259 269
260 // WeakPtrFactory to use callbacks. 270 // WeakPtrFactory to use callbacks.
261 base::WeakPtrFactory<ArcBridgeService> weak_factory_; 271 base::WeakPtrFactory<ArcBridgeService> weak_factory_;
262 272
263 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); 273 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService);
264 }; 274 };
265 275
266 } // namespace arc 276 } // namespace arc
267 277
268 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 278 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698