| Index: remoting/ios/utility.mm
|
| diff --git a/remoting/ios/utility.mm b/remoting/ios/utility.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8d5f0da0057e8a05697b9901eded25c4df16f4a2
|
| --- /dev/null
|
| +++ b/remoting/ios/utility.mm
|
| @@ -0,0 +1,108 @@
|
| +// 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.
|
| +
|
| +#if !defined(__has_feature) || !__has_feature(objc_arc)
|
| +#error "This file requires ARC support."
|
| +#endif
|
| +
|
| +#import "Utility.h"
|
| +
|
| +@implementation Utility
|
| +
|
| ++ (void)showAlert:(NSString*)title message:(NSString*)message {
|
| + UIAlertView* alert;
|
| + alert = [[UIAlertView alloc] init];
|
| + alert.title = title;
|
| + alert.message = message;
|
| + alert.delegate = nil;
|
| + [alert addButtonWithTitle:@"OK"];
|
| + [alert show];
|
| +}
|
| +
|
| ++ (BOOL)isInLandscapeMode {
|
| + UIInterfaceOrientation orientation = [UIApplication sharedApplication]
|
| + .statusBarOrientation;
|
| +
|
| + if ((orientation == UIInterfaceOrientationLandscapeLeft) ||
|
| + (orientation == UIInterfaceOrientationLandscapeRight)) {
|
| + return YES;
|
| + }
|
| + return NO;
|
| +}
|
| +
|
| ++ (NSString*)appVersionNumberDisplayString {
|
| + NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary];
|
| +
|
| + NSString* majorVersion =
|
| + [infoDictionary objectForKey:@"CFBundleShortVersionString"];
|
| + NSString* minorVersion = [infoDictionary objectForKey:@"CFBundleVersion"];
|
| +
|
| + return [NSString
|
| + stringWithFormat:@"Version %@ (%@)", majorVersion, minorVersion];
|
| +}
|
| +
|
| +// Get the rect in CLIENT screen of the status bar
|
| ++ (CGRect)statusBarFrameViewRect:(UIView*)view {
|
| + CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
|
| +
|
| + CGRect statusBarWindowRect =
|
| + [view.window convertRect:statusBarFrame fromWindow:nil];
|
| +
|
| + CGRect statusBarViewRect =
|
| + [view convertRect:statusBarWindowRect fromView:nil];
|
| +
|
| + return statusBarViewRect;
|
| +}
|
| +
|
| ++ (void)moveMouse:(ClientController*)controller
|
| + at:(const webrtc::DesktopVector&)point {
|
| + [controller mouseAction:point
|
| + wheelDelta:webrtc::DesktopVector(0, 0)
|
| + whichButton:0
|
| + buttonDown:NO];
|
| +}
|
| +
|
| ++ (void)leftClickOn:(ClientController*)controller
|
| + at:(const webrtc::DesktopVector&)point {
|
| + [controller mouseAction:point
|
| + wheelDelta:webrtc::DesktopVector(0, 0)
|
| + whichButton:1
|
| + buttonDown:YES];
|
| + [controller mouseAction:point
|
| + wheelDelta:webrtc::DesktopVector(0, 0)
|
| + whichButton:1
|
| + buttonDown:NO];
|
| +}
|
| +
|
| ++ (void)middleClickOn:(ClientController*)controller
|
| + at:(const webrtc::DesktopVector&)point {
|
| + [controller mouseAction:point
|
| + wheelDelta:webrtc::DesktopVector(0, 0)
|
| + whichButton:2
|
| + buttonDown:YES];
|
| + [controller mouseAction:point
|
| + wheelDelta:webrtc::DesktopVector(0, 0)
|
| + whichButton:2
|
| + buttonDown:NO];
|
| +}
|
| +
|
| ++ (void)rightClickOn:(ClientController*)controller
|
| + at:(const webrtc::DesktopVector&)point {
|
| + [controller mouseAction:point
|
| + wheelDelta:webrtc::DesktopVector(0, 0)
|
| + whichButton:3
|
| + buttonDown:YES];
|
| + [controller mouseAction:point
|
| + wheelDelta:webrtc::DesktopVector(0, 0)
|
| + whichButton:3
|
| + buttonDown:NO];
|
| +}
|
| +
|
| ++ (void)mouseScroll:(ClientController*)controller
|
| + at:(const webrtc::DesktopVector&)point
|
| + delta:(const webrtc::DesktopVector&)delta {
|
| + [controller mouseAction:point wheelDelta:delta whichButton:0 buttonDown:NO];
|
| +}
|
| +
|
| +@end
|
|
|