summaryrefslogtreecommitdiffstats
path: root/remoting/ios/ui/host_view_controller.h
blob: 6e0f2879488061126ba81c1eb91044e853bf8cb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef REMOTING_IOS_UI_HOST_VIEW_CONTROLLER_H_
#define REMOTING_IOS_UI_HOST_VIEW_CONTROLLER_H_

#import <GLKit/GLKit.h>

#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"

#import "remoting/ios/host.h"
#import "remoting/ios/key_input.h"
#import "remoting/ios/utility.h"
#import "remoting/ios/bridge/host_proxy.h"
#import "remoting/ios/ui/desktop_texture.h"
#import "remoting/ios/ui/cursor_texture.h"
#import "remoting/ios/ui/pin_entry_view_controller.h"
#import "remoting/ios/ui/scene_view.h"

@interface HostViewController
    : GLKViewController<PinEntryViewControllerDelegate,
                        KeyInputDelegate,
                        // Communication channel from HOST to CLIENT
                        ClientProxyDelegate,
                        UIGestureRecognizerDelegate,
                        UIToolbarDelegate> {
 @private
  IBOutlet UIActivityIndicatorView* _busyIndicator;
  IBOutlet UIButton* _barBtnDisconnect;
  IBOutlet UIButton* _barBtnKeyboard;
  IBOutlet UIButton* _barBtnNavigation;
  IBOutlet UIButton* _barBtnCtrlAltDel;
  IBOutlet UILongPressGestureRecognizer* _longPressRecognizer;
  IBOutlet UIPanGestureRecognizer* _panRecognizer;
  IBOutlet UIPanGestureRecognizer* _threeFingerPanRecognizer;
  IBOutlet UIPinchGestureRecognizer* _pinchRecognizer;
  IBOutlet UITapGestureRecognizer* _singleTapRecognizer;
  IBOutlet UITapGestureRecognizer* _twoFingerTapRecognizer;
  IBOutlet UITapGestureRecognizer* _threeFingerTapRecognizer;
  IBOutlet UIToolbar* _toolbar;
  IBOutlet UIToolbar* _hiddenToolbar;
  IBOutlet NSLayoutConstraint* _toolBarYPosition;
  IBOutlet NSLayoutConstraint* _hiddenToolbarYPosition;

  KeyInput* _keyEntryView;
  NSString* _statusMessage;

  // The GLES2 context being drawn too.
  EAGLContext* _context;

  // GLKBaseEffect encapsulates the GL Shaders needed to draw at most two
  // textures |_textureIds| given vertex information.  The draw surface consists
  // of two layers (GL Textures). The bottom layer is the desktop of the HOST.
  // The top layer is mostly transparent and is used to overlay the current
  // cursor.
  GLKBaseEffect* _effect;

  // All the details needed to draw our GL Scene, and our two textures.
  SceneView* _scene;
  DesktopTexture* _desktop;
  CursorTexture* _mouse;

  // List of regions and data that have pending draws to |_desktop| .
  ScopedVector<GLRegion> _glRegions;

  // Lock for |_glRegions|, regions are delivered from HOST on another thread,
  // and drawn to |_desktop| from a GL Context thread
  NSLock* _glBufferLock;

  // Lock for |_mouse.cursor|, cursor updates are delivered from HOST on another
  // thread, and drawn to |_mouse| from a GL Context thread
  NSLock* _glCursorLock;

  // Communication channel from CLIENT to HOST
  HostProxy* _clientToHostProxy;
}

// Details for the host and user
@property(nonatomic, readonly) Host* host;
@property(nonatomic, readonly) NSString* userEmail;
@property(nonatomic, readonly) NSString* userAuthorizationToken;

- (void)setHostDetails:(Host*)host
             userEmail:(NSString*)userEmail
    authorizationToken:(NSString*)authorizationToken;

// Zoom in/out
- (IBAction)pinchGestureTriggered:(UIPinchGestureRecognizer*)sender;
// Left mouse click, moves cursor
- (IBAction)tapGestureTriggered:(UITapGestureRecognizer*)sender;
// Scroll the view in 2d
- (IBAction)panGestureTriggered:(UIPanGestureRecognizer*)sender;
// Right mouse click and drag, moves cursor
- (IBAction)longPressGestureTriggered:(UILongPressGestureRecognizer*)sender;
// Right mouse click
- (IBAction)twoFingerTapGestureTriggered:(UITapGestureRecognizer*)sender;
// Middle mouse click
- (IBAction)threeFingerTapGestureTriggered:(UITapGestureRecognizer*)sender;
// Show hidden menus.  Swipe up for keyboard, swipe down for navigation menu
- (IBAction)threeFingerPanGestureTriggered:(UIPanGestureRecognizer*)sender;

// Do navigation 'back'
- (IBAction)barBtnNavigationBackPressed:(id)sender;
// Show keyboard
- (IBAction)barBtnKeyboardPressed:(id)sender;
// Trigger |_toolbar| animation
- (IBAction)barBtnToolBarHidePressed:(id)sender;
// Send Keys for ctrl, atl, delete
- (IBAction)barBtnCtrlAltDelPressed:(id)sender;

@end

#endif  // REMOTING_IOS_UI_HOST_VIEW_CONTROLLER_H_