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

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

Issue 2825403004: Integrating with new rendering for CRD iOS. (Closed)
Patch Set: Adding remoting service changes to this CL, they are dependent. Created 3 years, 8 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 #if !defined(__has_feature) || !__has_feature(objc_arc) 5 #if !defined(__has_feature) || !__has_feature(objc_arc)
6 #error "This file requires ARC support." 6 #error "This file requires ARC support."
7 #endif 7 #endif
8 8
9 #import "remoting/client/ios/facade/remoting_service.h" 9 #import "remoting/client/ios/facade/remoting_service.h"
10 10
11 #import <Foundation/Foundation.h> 11 #import <Foundation/Foundation.h>
12 12
13 #import "base/mac/bind_objc_block.h" 13 #import "base/mac/bind_objc_block.h"
14 14
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/strings/sys_string_conversions.h" 16 #include "base/strings/sys_string_conversions.h"
17 #include "net/url_request/url_request_context_getter.h" 17 #include "net/url_request/url_request_context_getter.h"
18 #include "remoting/base/oauth_token_getter.h" 18 #include "remoting/base/oauth_token_getter.h"
19 #include "remoting/base/oauth_token_getter_impl.h" 19 #include "remoting/base/oauth_token_getter_impl.h"
20 #include "remoting/client/ios/facade/host_info.h" 20 #include "remoting/client/ios/facade/host_info.h"
21 #include "remoting/client/ios/facade/host_list_fetcher.h" 21 #include "remoting/client/ios/facade/host_list_fetcher.h"
22 #include "remoting/client/ios/facade/ios_client_runtime_delegate.h"
22 23
23 const char kOauthRedirectUrl[] = 24 const char kOauthRedirectUrl[] =
24 "https://chromoting-oauth.talkgadget." 25 "https://chromoting-oauth.talkgadget."
25 "google.com/talkgadget/oauth/chrome-remote-desktop/dev"; 26 "google.com/talkgadget/oauth/chrome-remote-desktop/dev";
26 27
27 std::unique_ptr<remoting::OAuthTokenGetter> 28 std::unique_ptr<remoting::OAuthTokenGetter>
28 CreateOAuthTokenGetterWithAuthorizationCode( 29 CreateOAuthTokenGetterWithAuthorizationCode(
29 const std::string& auth_code, 30 const std::string& auth_code,
30 const remoting::OAuthTokenGetter::CredentialsUpdatedCallback& 31 const remoting::OAuthTokenGetter::CredentialsUpdatedCallback&
31 on_credentials_update) { 32 on_credentials_update) {
(...skipping 27 matching lines...) Expand all
59 return oauth_tokenGetter; 60 return oauth_tokenGetter;
60 } 61 }
61 62
62 @interface RemotingService () { 63 @interface RemotingService () {
63 std::unique_ptr<remoting::OAuthTokenGetter> _tokenGetter; 64 std::unique_ptr<remoting::OAuthTokenGetter> _tokenGetter;
64 UserInfo* _user; 65 UserInfo* _user;
65 NSArray<HostInfo*>* _hosts; 66 NSArray<HostInfo*>* _hosts;
66 id<RemotingAuthenticationDelegate> _authDelegate; 67 id<RemotingAuthenticationDelegate> _authDelegate;
67 id<RemotingHostListDelegate> _hostListDelegate; 68 id<RemotingHostListDelegate> _hostListDelegate;
68 remoting::HostListFetcher* _hostListFetcher; 69 remoting::HostListFetcher* _hostListFetcher;
70 remoting::IosClientRuntimeDelegate* _clientRuntimeDelegate;
69 } 71 }
70 72
71 @end 73 @end
72 74
73 // 75 //
74 // RemodingService will act as the facade to the C++ layer that has not been 76 // RemodingService will act as the facade to the C++ layer that has not been
75 // implemented/integrated yet. 77 // implemented/integrated yet.
76 // TODO(nicholss): Implement/Integrate this class. At the moment it is being 78 // TODO(nicholss): Implement/Integrate this class. At the moment it is being
77 // used to generate fake data to implement the UI of the app. 79 // used to generate fake data to implement the UI of the app.
78 // Update: Half implemented now. User is still fake, but now real hosts lists. 80 // Update: Half implemented now. User is still fake, but now real hosts lists.
(...skipping 10 matching lines...) Expand all
89 return sharedInstance; 91 return sharedInstance;
90 } 92 }
91 93
92 - (instancetype)init { 94 - (instancetype)init {
93 self = [super init]; 95 self = [super init];
94 if (self) { 96 if (self) {
95 _user = nil; 97 _user = nil;
96 _hosts = nil; 98 _hosts = nil;
97 _hostListFetcher = new remoting::HostListFetcher( 99 _hostListFetcher = new remoting::HostListFetcher(
98 remoting::ChromotingClientRuntime::GetInstance()->url_requester()); 100 remoting::ChromotingClientRuntime::GetInstance()->url_requester());
101 _clientRuntimeDelegate =
102 new remoting::IosClientRuntimeDelegate(); // TODO(nicholss): This might
103 // need a pointer back to the
104 // service.
Jamie 2017/04/21 17:43:01 Put this on the line before so it only takes up on
nicholss 2017/04/21 21:00:06 Done.
105 [self runtime]->SetDelegate(_clientRuntimeDelegate);
99 } 106 }
100 return self; 107 return self;
101 } 108 }
102 109
103 #pragma mark - RemotingService Implementation 110 #pragma mark - RemotingService Implementation
104 111
105 // TODO(nicholss): isAuthenticated needs to just kick off a request to 112 // TODO(nicholss): isAuthenticated needs to just kick off a request to
106 // authenticate a user. and more than one controller might want to be a delegate 113 // authenticate a user. and more than one controller might want to be a delegate
107 // for this info so need to change this to be more of the registration types. 114 // for this info so need to change this to be more of the registration types.
108 // The remoting_service might also want to be registered for authentication 115 // The remoting_service might also want to be registered for authentication
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (![self isAuthenticated]) { 252 if (![self isAuthenticated]) {
246 return nil; 253 return nil;
247 } 254 }
248 return _hosts; 255 return _hosts;
249 } 256 }
250 257
251 - (remoting::ChromotingClientRuntime*)runtime { 258 - (remoting::ChromotingClientRuntime*)runtime {
252 return remoting::ChromotingClientRuntime::GetInstance(); 259 return remoting::ChromotingClientRuntime::GetInstance();
253 } 260 }
254 261
262 - (void)callbackWithAccessToken:
263 (const remoting::OAuthTokenGetter::TokenCallback&)onAccessToken {
264 if (_tokenGetter) {
265 _tokenGetter->CallWithToken(onAccessToken);
266 }
267 }
268
255 @end 269 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698