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_UTILITY_H_
6#define REMOTING_IOS_UTILITY_H_
7
8#import <Foundation/Foundation.h>
9
10#include "base/memory/scoped_ptr.h"
11#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
12#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
13
14#import "remoting/ios/bridge/host_proxy.h"
15
16typedef struct {
17  scoped_ptr<webrtc::BasicDesktopFrame> image;
18  scoped_ptr<webrtc::DesktopVector> offset;
19} GLRegion;
20
21@interface Utility : NSObject
22
23+ (BOOL)isPad;
24
25+ (BOOL)isInLandscapeMode;
26
27// Return the resolution in respect to orientation
28+ (CGSize)getOrientatedSize:(CGSize)size
29    shouldWidthBeLongestSide:(BOOL)shouldWidthBeLongestSide;
30
31+ (void)showAlert:(NSString*)title message:(NSString*)message;
32
33+ (NSString*)appVersionNumberDisplayString;
34
35// GL Binding Context requires some specific flags for the type of textures
36// being drawn
37+ (void)bindTextureForIOS:(GLuint)glName;
38
39// Sometimes its necessary to read gl errors.  This is called in various places
40// while working in the GL Context
41+ (void)logGLErrorCode:(NSString*)funcName;
42
43+ (void)drawSubRectToGLFromRectOfSize:(const webrtc::DesktopSize&)rectSize
44                              subRect:(const webrtc::DesktopRect&)subRect
45                                 data:(const uint8_t*)data;
46
47+ (void)moveMouse:(HostProxy*)controller at:(const webrtc::DesktopVector&)point;
48
49+ (void)leftClickOn:(HostProxy*)controller
50                 at:(const webrtc::DesktopVector&)point;
51
52+ (void)middleClickOn:(HostProxy*)controller
53                   at:(const webrtc::DesktopVector&)point;
54
55+ (void)rightClickOn:(HostProxy*)controller
56                  at:(const webrtc::DesktopVector&)point;
57
58+ (void)mouseScroll:(HostProxy*)controller
59                 at:(const webrtc::DesktopVector&)point
60              delta:(const webrtc::DesktopVector&)delta;
61
62@end
63
64#endif  // REMOTING_IOS_UTILITY_H_
65