OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 REMOTING_IOS_FACADE_REMOTING_SERVICE_H_ | 5 #ifndef REMOTING_IOS_FACADE_REMOTING_SERVICE_H_ |
6 #define REMOTING_IOS_FACADE_REMOTING_SERVICE_H_ | 6 #define REMOTING_IOS_FACADE_REMOTING_SERVICE_H_ |
7 | 7 |
8 #import "remoting/client/chromoting_client_runtime.h" | 8 #import "remoting/client/chromoting_client_runtime.h" |
9 | 9 |
10 @class HostInfo; | 10 @class HostInfo; |
11 @class UserInfo; | 11 @class UserInfo; |
12 | 12 |
13 @protocol RemotingAuthentication; | 13 @protocol RemotingAuthentication; |
14 | 14 |
| 15 typedef NS_ENUM(NSInteger, HostListState) { |
| 16 // Nobody has requested a host list fetch. |
| 17 HostListStateNotFetched, |
| 18 |
| 19 // The host list is currently being fetched. |
| 20 HostListStateFetching, |
| 21 |
| 22 // The host list has been fetched. |
| 23 HostListStateFetched, |
| 24 }; |
| 25 |
15 // Eventing related keys: | 26 // Eventing related keys: |
16 | 27 |
17 // Hosts did update event. | 28 // Hosts did update event. |
18 extern NSString* const kHostsDidUpdate; | 29 extern NSString* const kHostListStateDidChange; |
19 // User did update event name. | 30 // User did update event name. |
20 extern NSString* const kUserDidUpdate; | 31 extern NSString* const kUserDidUpdate; |
21 // Map key for UserInfo object. | 32 // Map key for UserInfo object. |
22 extern NSString* const kUserInfo; | 33 extern NSString* const kUserInfo; |
23 | 34 |
24 // |RemotingService| is the centralized place to ask for information about | 35 // |RemotingService| is the centralized place to ask for information about |
25 // authentication or query the remote services. It also helps deal with the | 36 // authentication or query the remote services. It also helps deal with the |
26 // runtime and threading used in the application. |RemotingService| is a | 37 // runtime and threading used in the application. |RemotingService| is a |
27 // singleton and should only be accessed via the |SharedInstance| method. | 38 // singleton and should only be accessed via the |SharedInstance| method. |
28 @interface RemotingService : NSObject | 39 @interface RemotingService : NSObject |
29 | 40 |
30 // Access to the singleton shared instance from this method. | 41 // Access to the singleton shared instance from this method. |
31 + (RemotingService*)instance; | 42 + (RemotingService*)instance; |
32 | 43 |
33 // Start a request to fetch the host list. This will produce an notification on | 44 // Start a request to fetch the host list. This will produce an notification on |
34 // |kHostsDidUpdate| when a new host is ready. | 45 // |kHostsDidUpdate| when a new host is ready. |
35 - (void)requestHostListFetch; | 46 - (void)requestHostListFetch; |
36 | 47 |
37 // Returns the current host list. | 48 // Returns the current host list. |
38 @property(nonatomic, readonly) NSArray<HostInfo*>* hosts; | 49 @property(nonatomic, readonly) NSArray<HostInfo*>* hosts; |
39 | 50 |
| 51 @property(nonatomic, readonly) HostListState hostListState; |
| 52 |
40 // The Chromoting Client Runtime, this holds the threads and other shared | 53 // The Chromoting Client Runtime, this holds the threads and other shared |
41 // resources used by the Chromoting clients | 54 // resources used by the Chromoting clients |
42 @property(nonatomic, readonly) remoting::ChromotingClientRuntime* runtime; | 55 @property(nonatomic, readonly) remoting::ChromotingClientRuntime* runtime; |
43 | 56 |
44 // This must be set immediately after the authentication object is created. It | 57 // This must be set immediately after the authentication object is created. It |
45 // can only be set once. | 58 // can only be set once. |
46 @property(nonatomic) id<RemotingAuthentication> authentication; | 59 @property(nonatomic) id<RemotingAuthentication> authentication; |
47 | 60 |
48 @end | 61 @end |
49 | 62 |
50 #endif // REMOTING_IOS_FACADE_REMOTING_SERVICE_H_ | 63 #endif // REMOTING_IOS_FACADE_REMOTING_SERVICE_H_ |
OLD | NEW |