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

Unified Diff: remoting/ios/utility.mm

Issue 186733007: iOS Chromoting Client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
« remoting/ios/key_map_us.h ('K') | « remoting/ios/utility.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« remoting/ios/key_map_us.h ('K') | « remoting/ios/utility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698