Chromium Code Reviews| 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_SERCICE_H_ |
|
joedow
2017/04/05 22:30:55
Can you fix this header guard (SERCICE is a typo):
nicholss
2017/04/07 18:16:15
Done.
| |
| 6 #define REMOTING_CLIENT_IOS_FACADE_REMOTING_SERCICE_H_ | 6 #define REMOTING_CLIENT_IOS_FACADE_REMOTING_SERCICE_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | |
| 9 #import "remoting/client/chromoting_client_runtime.h" | |
| 8 #import "remoting/client/ios/domain/host_info.h" | 10 #import "remoting/client/ios/domain/host_info.h" |
| 9 #import "remoting/client/ios/domain/user_info.h" | 11 #import "remoting/client/ios/domain/user_info.h" |
| 10 | 12 |
| 13 // |RemotingAuthenticationDelegate|'s are interesed in authentication related | |
|
joedow
2017/04/05 22:30:55
nit: remove apostrophe (non-possessive) and fix in
nicholss
2017/04/07 18:16:15
Done.
| |
| 14 // notifications. | |
| 15 @protocol RemotingAuthenticationDelegate<NSObject> | |
| 16 | |
| 17 // Notifies the delegate that the authentication status of the current user has | |
| 18 // changed to a new state. | |
| 19 - (void)nowAuthenticated:(BOOL)authenticated; | |
| 20 | |
| 21 @end | |
| 22 | |
| 23 // |RemotingHostListDelegate|'s are interested in notifications related to host | |
|
joedow
2017/04/05 22:30:55
remove apostrophe
nicholss
2017/04/07 18:16:15
Done.
| |
| 24 // list. | |
| 25 @protocol RemotingHostListDelegate<NSObject> | |
| 26 | |
| 27 - (void)hostListUpdated; | |
| 28 | |
| 29 @end | |
| 30 | |
| 31 // |RemotingService| is the centralized place to ask for information about | |
| 32 // authentication or query the remote services. It also helps deal with the | |
| 33 // runtime and threading used in the application. |RemotingService| is a | |
| 34 // singleton and should only be accessed via the |SharedInstance| method. | |
| 11 @interface RemotingService : NSObject | 35 @interface RemotingService : NSObject |
| 12 | 36 |
| 13 + (RemotingService*)sharedInstance; | 37 // Access to the singleton shared instance from this method. |
| 38 + (RemotingService*)SharedInstance; | |
| 14 | 39 |
| 40 // Access to the current |ChromotingClientRuntime| from this method. | |
| 41 - (remoting::ChromotingClientRuntime*)runtime; | |
| 42 | |
| 43 // Register to be a |RemotingAuthenticationDelegate|. | |
|
joedow
2017/04/05 22:30:55
Does the caller need to unregister at some point?
nicholss
2017/04/07 18:16:15
No need to unregister, it is a pretty common iOS p
| |
| 44 - (void)setAuthenticationDelegate:(id<RemotingAuthenticationDelegate>)delegate; | |
| 45 | |
| 46 // A cached answer if there is a currently authenticated user. | |
|
joedow
2017/04/05 22:30:55
Isn't this just the current authentication state (
nicholss
2017/04/07 18:16:15
I said cache because it is not validating that the
| |
| 15 - (BOOL)isAuthenticated; | 47 - (BOOL)isAuthenticated; |
| 48 | |
| 49 // Provide an |authorizationCode| to authenticate a user as the first time user | |
| 50 // of the applicaiton or OAuth Flow. | |
|
joedow
2017/04/05 22:30:55
typo: applicaiton -> application
nicholss
2017/04/07 18:16:15
Done.
| |
| 16 - (void)authenticateWithAuthorizationCode:(NSString*)authorizationCode; | 51 - (void)authenticateWithAuthorizationCode:(NSString*)authorizationCode; |
| 52 | |
| 53 // Provide the |refreshToken| and |email| to authenticate a user as a returning | |
| 54 // user of the application. | |
| 55 - (void)authenticateWithRefreshToken:(NSString*)refreshToken | |
| 56 emai:(NSString*)email; | |
|
joedow
2017/04/05 22:30:55
typo: emai -> rename to email
nicholss
2017/04/07 18:16:15
HA! I had not gotten to the point where I can use
| |
| 57 | |
| 58 // Returns the currently logged in user info from cache, or nil if no | |
| 59 // currently authenticated user. | |
| 17 - (UserInfo*)getUser; | 60 - (UserInfo*)getUser; |
| 61 | |
| 62 // Register to be a |RemotingHostListDelegate|. Side effect of setting this | |
| 63 // delegate is the application will attempt to fetch a fresh host list. | |
|
joedow
2017/04/05 22:30:55
Just curious, why is the host list fetched again?
nicholss
2017/04/07 18:16:15
In reality there is only one object that will ever
joedow
2017/04/10 16:09:59
SGTM
| |
| 64 - (void)setHostListDelegate:(id<RemotingHostListDelegate>)delegate; | |
| 65 | |
| 66 // Returns the currently cached host list or nil if none exist. | |
| 18 - (NSArray<HostInfo*>*)getHosts; | 67 - (NSArray<HostInfo*>*)getHosts; |
| 19 | 68 |
| 20 @end | 69 @end |
| 21 | 70 |
| 22 #endif // REMOTING_CLIENT_IOS_FACADE_REMOTING_SERCICE_H_ | 71 #endif // REMOTING_CLIENT_IOS_FACADE_REMOTING_SERCICE_H_ |
| OLD | NEW |