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

Unified Diff: remoting/ios/app/host_view_controller.mm

Issue 2868383003: [CRD iOS] Send key events to the session. (Closed)
Patch Set: Update based on feedback. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/ios/app/client_connection_view_controller.mm ('k') | remoting/ios/client_gestures.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/ios/app/host_view_controller.mm
diff --git a/remoting/ios/app/host_view_controller.mm b/remoting/ios/app/host_view_controller.mm
index 155945d3421d0af8fb3ed3c46fafe5d9fb852d31..3f2a4136e0af4f50bacfcd7c4645afc2dde04999 100644
--- a/remoting/ios/app/host_view_controller.mm
+++ b/remoting/ios/app/host_view_controller.mm
@@ -17,12 +17,14 @@
#import "remoting/ios/client_keyboard.h"
#import "remoting/ios/session/remoting_client.h"
+#include "base/strings/sys_string_conversions.h"
+#include "remoting/client/input/keyboard_interpreter.h"
#include "remoting/client/ui/gesture_interpreter.h"
static const CGFloat kFabInset = 15.f;
static const CGFloat kKeyboardAnimationTime = 0.3;
-@interface HostViewController () {
+@interface HostViewController ()<ClientKeyboardDelegate> {
RemotingClient* _client;
MDCFloatingButton* _floatingButton;
ClientGestures* _clientGestures;
@@ -142,6 +144,7 @@ static const CGFloat kKeyboardAnimationTime = 0.3;
- (void)showKeyboard {
if (!_clientKeyboard) {
_clientKeyboard = [[ClientKeyboard alloc] init];
+ _clientKeyboard.delegate = self;
[self.view addSubview:_clientKeyboard];
// TODO(nicholss): need to pass some keyboard injection interface here.
}
@@ -156,15 +159,15 @@ static const CGFloat kKeyboardAnimationTime = 0.3;
- (void)keyboardWillShow:(NSNotification*)notification {
CGSize keyboardSize =
- [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey]
+ [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey]
CGRectValue]
.size;
if (_keyboardSize.height != keyboardSize.height) {
CGFloat deltaHeight = keyboardSize.height - _keyboardSize.height;
- [UIView animateWithDuration:0.3
+ [UIView animateWithDuration:kKeyboardAnimationTime
animations:^{
CGRect f = self.view.frame;
- f.size.height += deltaHeight;
+ f.size.height -= deltaHeight;
self.view.frame = f;
}];
_keyboardSize = keyboardSize;
@@ -181,6 +184,17 @@ static const CGFloat kKeyboardAnimationTime = 0.3;
_keyboardSize = CGSizeZero;
}
+#pragma mark - ClientKeyboardDelegate
+
+- (void)clientKeyboardShouldSend:(NSString*)text {
+ _client.keyboardInterpreter->HandleTextEvent(base::SysNSStringToUTF8(text),
+ 0);
+}
+
+- (void)clientKeyboardShouldDelete {
+ _client.keyboardInterpreter->HandleDeleteEvent(0);
+}
+
#pragma mark - Private
- (void)didTap:(id)sender {
« no previous file with comments | « remoting/ios/app/client_connection_view_controller.mm ('k') | remoting/ios/client_gestures.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698