| 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_CLIENT_IOS_FACADE_REMOTING_SERCICE_H_ | 5 #ifndef REMOTING_CLIENT_IOS_FACADE_REMOTING_SERVICE_H_ |
| 6 #define REMOTING_CLIENT_IOS_FACADE_REMOTING_SERCICE_H_ | 6 #define REMOTING_CLIENT_IOS_FACADE_REMOTING_SERVICE_H_ |
| 7 | 7 |
| 8 #import "remoting/client/chromoting_client_runtime.h" |
| 8 #import "remoting/client/ios/domain/host_info.h" | 9 #import "remoting/client/ios/domain/host_info.h" |
| 9 #import "remoting/client/ios/domain/user_info.h" | 10 #import "remoting/client/ios/domain/user_info.h" |
| 10 | 11 |
| 12 #include "base/memory/weak_ptr.h" |
| 13 |
| 14 // |RemotingAuthenticationDelegate|s are interested in authentication related |
| 15 // notifications. |
| 16 @protocol RemotingAuthenticationDelegate<NSObject> |
| 17 |
| 18 // Notifies the delegate that the authentication status of the current user has |
| 19 // changed to a new state. |
| 20 - (void)nowAuthenticated:(BOOL)authenticated; |
| 21 |
| 22 @end |
| 23 |
| 24 // |RemotingHostListDelegate|s are interested in notifications related to host |
| 25 // list. |
| 26 @protocol RemotingHostListDelegate<NSObject> |
| 27 |
| 28 - (void)hostListUpdated; |
| 29 |
| 30 @end |
| 31 |
| 32 // |RemotingService| is the centralized place to ask for information about |
| 33 // authentication or query the remote services. It also helps deal with the |
| 34 // runtime and threading used in the application. |RemotingService| is a |
| 35 // singleton and should only be accessed via the |SharedInstance| method. |
| 11 @interface RemotingService : NSObject | 36 @interface RemotingService : NSObject |
| 12 | 37 |
| 13 + (RemotingService*)sharedInstance; | 38 // Access to the singleton shared instance from this method. |
| 39 + (RemotingService*)SharedInstance; |
| 14 | 40 |
| 41 // Access to the current |ChromotingClientRuntime| from this method. |
| 42 - (remoting::ChromotingClientRuntime*)runtime; |
| 43 |
| 44 // Register to be a |RemotingAuthenticationDelegate|. |
| 45 - (void)setAuthenticationDelegate:(id<RemotingAuthenticationDelegate>)delegate; |
| 46 |
| 47 // A cached answer if there is a currently authenticated user. |
| 15 - (BOOL)isAuthenticated; | 48 - (BOOL)isAuthenticated; |
| 49 |
| 50 // Provide an |authorizationCode| to authenticate a user as the first time user |
| 51 // of the application or OAuth Flow. |
| 16 - (void)authenticateWithAuthorizationCode:(NSString*)authorizationCode; | 52 - (void)authenticateWithAuthorizationCode:(NSString*)authorizationCode; |
| 53 |
| 54 // Provide the |refreshToken| and |email| to authenticate a user as a returning |
| 55 // user of the application. |
| 56 - (void)authenticateWithRefreshToken:(NSString*)refreshToken |
| 57 email:(NSString*)email; |
| 58 |
| 59 // Returns the currently logged in user info from cache, or nil if no |
| 60 // currently authenticated user. |
| 17 - (UserInfo*)getUser; | 61 - (UserInfo*)getUser; |
| 62 |
| 63 // Register to be a |RemotingHostListDelegate|. Side effect of setting this |
| 64 // delegate is the application will attempt to fetch a fresh host list. |
| 65 - (void)setHostListDelegate:(id<RemotingHostListDelegate>)delegate; |
| 66 |
| 67 // Returns the currently cached host list or nil if none exist. |
| 18 - (NSArray<HostInfo*>*)getHosts; | 68 - (NSArray<HostInfo*>*)getHosts; |
| 19 | 69 |
| 20 @end | 70 @end |
| 21 | 71 |
| 22 #endif // REMOTING_CLIENT_IOS_FACADE_REMOTING_SERCICE_H_ | 72 #endif // REMOTING_CLIENT_IOS_FACADE_REMOTING_SERVICE_H_ |
| OLD | NEW |