1 // Copyright 2014 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 #ifndef REMOTING_IOS_UI_HOST_VIEW_CONTROLLER_H_ 6 #define REMOTING_IOS_UI_HOST_VIEW_CONTROLLER_H_ 7 8 #import <GLKit/GLKit.h> 9 10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_vector.h" 12 13 #import "remoting/ios/host.h" 14 #import "remoting/ios/key_input.h" 15 #import "remoting/ios/utility.h" 16 #import "remoting/ios/bridge/host_proxy.h" 17 #import "remoting/ios/ui/desktop_texture.h" 18 #import "remoting/ios/ui/cursor_texture.h" 19 #import "remoting/ios/ui/pin_entry_view_controller.h" 20 #import "remoting/ios/ui/scene_view.h" 21 22 @interface HostViewController 23 : GLKViewController<PinEntryViewControllerDelegate, 24 KeyInputDelegate, 25 // Communication channel from HOST to CLIENT 26 ClientProxyDelegate, 27 UIGestureRecognizerDelegate, 28 UIToolbarDelegate> { 29 @private 30 IBOutlet UIActivityIndicatorView* _busyIndicator; 31 IBOutlet UIButton* _barBtnDisconnect; 32 IBOutlet UIButton* _barBtnKeyboard; 33 IBOutlet UIButton* _barBtnNavigation; 34 IBOutlet UIButton* _barBtnCtrlAltDel; 35 IBOutlet UILongPressGestureRecognizer* _longPressRecognizer; 36 IBOutlet UIPanGestureRecognizer* _panRecognizer; 37 IBOutlet UIPanGestureRecognizer* _threeFingerPanRecognizer; 38 IBOutlet UIPinchGestureRecognizer* _pinchRecognizer; 39 IBOutlet UITapGestureRecognizer* _singleTapRecognizer; 40 IBOutlet UITapGestureRecognizer* _twoFingerTapRecognizer; 41 IBOutlet UITapGestureRecognizer* _threeFingerTapRecognizer; 42 IBOutlet UIToolbar* _toolbar; 43 IBOutlet UIToolbar* _hiddenToolbar; 44 IBOutlet NSLayoutConstraint* _toolBarYPosition; 45 IBOutlet NSLayoutConstraint* _hiddenToolbarYPosition; 46 47 KeyInput* _keyEntryView; 48 NSString* _statusMessage; 49 50 // The GLES2 context being drawn too. 51 EAGLContext* _context; 52 53 // GLKBaseEffect encapsulates the GL Shaders needed to draw at most two 54 // textures |_textureIds| given vertex information. The draw surface consists 55 // of two layers (GL Textures). The bottom layer is the desktop of the HOST. 56 // The top layer is mostly transparent and is used to overlay the current 57 // cursor. 58 GLKBaseEffect* _effect; 59 60 // All the details needed to draw our GL Scene, and our two textures. 61 SceneView* _scene; 62 DesktopTexture* _desktop; 63 CursorTexture* _mouse; 64 65 // List of regions and data that have pending draws to |_desktop| . 66 ScopedVector<GLRegion> _glRegions; 67 68 // Lock for |_glRegions|, regions are delivered from HOST on another thread, 69 // and drawn to |_desktop| from a GL Context thread 70 NSLock* _glBufferLock; 71 72 // Lock for |_mouse.cursor|, cursor updates are delivered from HOST on another 73 // thread, and drawn to |_mouse| from a GL Context thread 74 NSLock* _glCursorLock; 75 76 // Communication channel from CLIENT to HOST 77 HostProxy* _clientToHostProxy; 78 } 79 80 // Details for the host and user 81 @property(nonatomic, readonly) Host* host; 82 @property(nonatomic, readonly) NSString* userEmail; 83 @property(nonatomic, readonly) NSString* userAuthorizationToken; 84 85 - (void)setHostDetails:(Host*)host 86 userEmail:(NSString*)userEmail 87 authorizationToken:(NSString*)authorizationToken; 88 89 // Zoom in/out 90 - (IBAction)pinchGestureTriggered:(UIPinchGestureRecognizer*)sender; 91 // Left mouse click, moves cursor 92 - (IBAction)tapGestureTriggered:(UITapGestureRecognizer*)sender; 93 // Scroll the view in 2d 94 - (IBAction)panGestureTriggered:(UIPanGestureRecognizer*)sender; 95 // Right mouse click and drag, moves cursor 96 - (IBAction)longPressGestureTriggered:(UILongPressGestureRecognizer*)sender; 97 // Right mouse click 98 - (IBAction)twoFingerTapGestureTriggered:(UITapGestureRecognizer*)sender; 99 // Middle mouse click 100 - (IBAction)threeFingerTapGestureTriggered:(UITapGestureRecognizer*)sender; 101 // Show hidden menus. Swipe up for keyboard, swipe down for navigation menu 102 - (IBAction)threeFingerPanGestureTriggered:(UIPanGestureRecognizer*)sender; 103 104 // Do navigation 'back' 105 - (IBAction)barBtnNavigationBackPressed:(id)sender; 106 // Show keyboard 107 - (IBAction)barBtnKeyboardPressed:(id)sender; 108 // Trigger |_toolbar| animation 109 - (IBAction)barBtnToolBarHidePressed:(id)sender; 110 // Send Keys for ctrl, atl, delete 111 - (IBAction)barBtnCtrlAltDelPressed:(id)sender; 112 113 @end 114 115 #endif // REMOTING_IOS_UI_HOST_VIEW_CONTROLLER_H_ 116