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

Side by Side Diff: remoting/client/ios/session/remoting_client_session_delegate.mm

Issue 2805963002: Adding session object for iOS to integerate client sessions. (Closed)
Patch Set: Updating display handler to use correct paths. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #if !defined(__has_feature) || !__has_feature(objc_arc)
6 #error "This file requires ARC support."
7 #endif
8
9 #import "remoting/client/ios/session/remoting_client_session_delegate.h"
10
11 #include "base/strings/sys_string_conversions.h"
12 #include "remoting/client/chromoting_client_runtime.h"
13
14 using base::SysUTF8ToNSString;
15
16 namespace remoting {
17
18 RemotingClientSessonDelegate::RemotingClientSessonDelegate(
19 RemotingClient* client)
20 : client_(client), weak_factory_(this) {
21 runtime_ = ChromotingClientRuntime::GetInstance();
22 }
23
24 RemotingClientSessonDelegate::~RemotingClientSessonDelegate() {
25 client_ = nil;
26 }
27
28 void RemotingClientSessonDelegate::OnConnectionState(
29 protocol::ConnectionToHost::State state,
30 protocol::ErrorCode error) {
31 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread());
32
33 [client_ onConnectionState:state error:error];
34 }
35
36 void RemotingClientSessonDelegate::CommitPairingCredentials(
37 const std::string& host,
38 const std::string& id,
39 const std::string& secret) {
40 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread());
41
42 [client_ commitPairingCredentialsForHost:SysUTF8ToNSString(host)
43 id:SysUTF8ToNSString(id)
44 secret:SysUTF8ToNSString(secret)];
45 }
46
47 void RemotingClientSessonDelegate::FetchThirdPartyToken(
48 const std::string& token_url,
49 const std::string& client_id,
50 const std::string& scope) {
51 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread());
52
53 [client_ fetchThirdPartyTokenForUrl:SysUTF8ToNSString(token_url)
54 clientId:SysUTF8ToNSString(client_id)
55 scope:SysUTF8ToNSString(scope)];
56 }
57
58 void RemotingClientSessonDelegate::SetCapabilities(
59 const std::string& capabilities) {
60 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread());
61
62 [client_ setCapabilities:SysUTF8ToNSString(capabilities)];
63 }
64
65 void RemotingClientSessonDelegate::HandleExtensionMessage(
66 const std::string& type,
67 const std::string& message) {
68 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread());
69
70 [client_ handleExtensionMessageOfType:SysUTF8ToNSString(type)
71 message:SysUTF8ToNSString(message)];
72 }
73
74 base::WeakPtr<RemotingClientSessonDelegate>
75 RemotingClientSessonDelegate::GetWeakPtr() {
76 return weak_factory_.GetWeakPtr();
77 }
78
79 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698