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

Side by Side Diff: remoting/client/ios/facade/remoting_service.h

Issue 2854273002: [CRD iOS] Implementing save to keychain and user defaults for login info. Refactor remoting service. (Closed)
Patch Set: Removing authenticate with refresh token from pub api. Created 3 years, 7 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 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_SERVICE_H_ 5 #ifndef REMOTING_CLIENT_IOS_FACADE_REMOTING_SERVICE_H_
6 #define REMOTING_CLIENT_IOS_FACADE_REMOTING_SERVICE_H_ 6 #define REMOTING_CLIENT_IOS_FACADE_REMOTING_SERVICE_H_
7 7
8 #import "remoting/client/chromoting_client_runtime.h" 8 #import "remoting/client/chromoting_client_runtime.h"
9 #import "remoting/client/ios/domain/host_info.h"
10 #import "remoting/client/ios/domain/user_info.h"
11 9
12 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
13 #include "remoting/base/oauth_token_getter.h" 11 #include "remoting/base/oauth_token_getter.h"
14 12
15 // |RemotingAuthenticationDelegate|s are interested in authentication related 13 @class HostInfo;
16 // notifications. 14 @class UserInfo;
17 @protocol RemotingAuthenticationDelegate<NSObject> 15 @class RemotingAuthentication;
18 16
19 // Notifies the delegate that the authentication status of the current user has 17 // Eventing related keys:
20 // changed to a new state.
21 - (void)nowAuthenticated:(BOOL)authenticated;
22 18
23 @end 19 // Hosts did update event.
24 20 extern NSString* const kHostsDidUpdate;
25 // |RemotingHostListDelegate|s are interested in notifications related to host 21 // User did update event name.
26 // list. 22 extern NSString* const kUserDidUpdate;
27 @protocol RemotingHostListDelegate<NSObject> 23 // Map key for UserInfo object.
28 24 extern NSString* const kUserInfo;
29 - (void)hostListUpdated;
30
31 @end
32 25
33 // |RemotingService| is the centralized place to ask for information about 26 // |RemotingService| is the centralized place to ask for information about
34 // authentication or query the remote services. It also helps deal with the 27 // authentication or query the remote services. It also helps deal with the
35 // runtime and threading used in the application. |RemotingService| is a 28 // runtime and threading used in the application. |RemotingService| is a
36 // singleton and should only be accessed via the |SharedInstance| method. 29 // singleton and should only be accessed via the |SharedInstance| method.
37 @interface RemotingService : NSObject 30 @interface RemotingService : NSObject
38 31
39 // Access to the singleton shared instance from this method. 32 // Access to the singleton shared instance from this method.
40 + (RemotingService*)SharedInstance; 33 + (RemotingService*)SharedInstance;
41 34
42 // Access to the current |ChromotingClientRuntime| from this method. 35 // Start a request to fetch the host list. This will produce an notification on
43 - (remoting::ChromotingClientRuntime*)runtime; 36 // |kHostsDidUpdate| when a new host is ready.
37 - (void)requestHostListFetch;
44 38
45 // Register to be a |RemotingAuthenticationDelegate|. 39 @property(nonatomic, readonly) RemotingAuthentication* authentication;
46 - (void)setAuthenticationDelegate:(id<RemotingAuthenticationDelegate>)delegate;
47 40
48 // A cached answer if there is a currently authenticated user. 41 // Returns the current host list.
49 - (BOOL)isAuthenticated; 42 @property(nonatomic, readonly) NSArray<HostInfo*>* hosts;
50 43
51 // Provide an |authorizationCode| to authenticate a user as the first time user 44 // The Chromoting Client Runtime, this holds the threads and other shared
52 // of the application or OAuth Flow. 45 // resources used by the Chromoting clients
53 - (void)authenticateWithAuthorizationCode:(NSString*)authorizationCode; 46 @property(nonatomic, readonly) remoting::ChromotingClientRuntime* runtime;
54
55 // Provide the |refreshToken| and |email| to authenticate a user as a returning
56 // user of the application.
57 - (void)authenticateWithRefreshToken:(NSString*)refreshToken
58 email:(NSString*)email;
59
60 // Returns the currently logged in user info from cache, or nil if no
61 // currently authenticated user.
62 - (UserInfo*)getUser;
63
64 // Register to be a |RemotingHostListDelegate|. Side effect of setting this
65 // delegate is the application will attempt to fetch a fresh host list.
66 - (void)setHostListDelegate:(id<RemotingHostListDelegate>)delegate;
67
68 // Returns the currently cached host list or nil if none exist.
69 - (NSArray<HostInfo*>*)getHosts;
70
71 // Fetches an OAuth Access Token and passes it back to the callback.
72 - (void)callbackWithAccessToken:
73 (const remoting::OAuthTokenGetter::TokenCallback&)onAccessToken;
74 47
75 @end 48 @end
76 49
77 #endif // REMOTING_CLIENT_IOS_FACADE_REMOTING_SERVICE_H_ 50 #endif // REMOTING_CLIENT_IOS_FACADE_REMOTING_SERVICE_H_
OLDNEW
« no previous file with comments | « remoting/client/ios/facade/remoting_authentication.mm ('k') | remoting/client/ios/facade/remoting_service.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698