| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if !defined(__has_feature) || !__has_feature(objc_arc) | 5 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 6 #error "This file requires ARC support." | 6 #error "This file requires ARC support." |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #import "remoting/ios/app/host_view_controller.h" | 9 #import "remoting/ios/app/host_view_controller.h" |
| 10 | 10 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 currentInputMode == remoting::GestureInterpreter::DIRECT_INPUT_MODE | 251 currentInputMode == remoting::GestureInterpreter::DIRECT_INPUT_MODE |
| 252 ? remoting::GestureInterpreter::TRACKPAD_INPUT_MODE | 252 ? remoting::GestureInterpreter::TRACKPAD_INPUT_MODE |
| 253 : remoting::GestureInterpreter::DIRECT_INPUT_MODE); | 253 : remoting::GestureInterpreter::DIRECT_INPUT_MODE); |
| 254 }; | 254 }; |
| 255 [alert addAction:[UIAlertAction actionWithTitle:switchInputModeTitle | 255 [alert addAction:[UIAlertAction actionWithTitle:switchInputModeTitle |
| 256 style:UIAlertActionStyleDefault | 256 style:UIAlertActionStyleDefault |
| 257 handler:switchInputModeHandler]]; | 257 handler:switchInputModeHandler]]; |
| 258 | 258 |
| 259 void (^disconnectHandler)(UIAlertAction*) = ^(UIAlertAction*) { | 259 void (^disconnectHandler)(UIAlertAction*) = ^(UIAlertAction*) { |
| 260 [_client disconnectFromHost]; | 260 [_client disconnectFromHost]; |
| 261 [self dismissViewControllerAnimated:YES completion:nil]; | 261 [self.navigationController popViewControllerAnimated:YES]; |
| 262 }; | 262 }; |
| 263 [alert addAction:[UIAlertAction actionWithTitle:@"Disconnect" | 263 [alert addAction:[UIAlertAction actionWithTitle:@"Disconnect" |
| 264 style:UIAlertActionStyleDefault | 264 style:UIAlertActionStyleDefault |
| 265 handler:disconnectHandler]]; | 265 handler:disconnectHandler]]; |
| 266 | 266 |
| 267 void (^cancelHandler)(UIAlertAction*) = ^(UIAlertAction*) { | 267 void (^cancelHandler)(UIAlertAction*) = ^(UIAlertAction*) { |
| 268 [alert dismissViewControllerAnimated:YES completion:nil]; | 268 [alert dismissViewControllerAnimated:YES completion:nil]; |
| 269 }; | 269 }; |
| 270 [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" | 270 [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" |
| 271 style:UIAlertActionStyleCancel | 271 style:UIAlertActionStyleCancel |
| 272 handler:cancelHandler]]; | 272 handler:cancelHandler]]; |
| 273 | 273 |
| 274 alert.popoverPresentationController.sourceView = self.view; | 274 alert.popoverPresentationController.sourceView = self.view; |
| 275 // Target the alert menu at the top middle of the FAB. | 275 // Target the alert menu at the top middle of the FAB. |
| 276 alert.popoverPresentationController.sourceRect = CGRectMake( | 276 alert.popoverPresentationController.sourceRect = CGRectMake( |
| 277 _floatingButton.center.x, _floatingButton.frame.origin.y, 1.0, 1.0); | 277 _floatingButton.center.x, _floatingButton.frame.origin.y, 1.0, 1.0); |
| 278 | 278 |
| 279 alert.popoverPresentationController.permittedArrowDirections = | 279 alert.popoverPresentationController.permittedArrowDirections = |
| 280 UIPopoverArrowDirectionDown; | 280 UIPopoverArrowDirectionDown; |
| 281 [self presentViewController:alert animated:YES completion:nil]; | 281 [self presentViewController:alert animated:YES completion:nil]; |
| 282 } | 282 } |
| 283 | 283 |
| 284 @end | 284 @end |
| OLD | NEW |