OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 6 #error "This file requires ARC support." |
| 7 #endif |
| 8 |
| 9 #import "remoting/ios/app/app_view_controller.h" |
| 10 |
| 11 #include "base/logging.h" |
| 12 |
| 13 #import "remoting/ios/app/remoting_menu_view_controller.h" |
| 14 |
| 15 // The Chromium implementation for the AppViewController. It simply shows the |
| 16 // menu modally. |
| 17 @interface AppViewController () { |
| 18 UIViewController* _mainViewController; |
| 19 |
| 20 RemotingMenuViewController* _menuController; // nullable |
| 21 } |
| 22 @end |
| 23 |
| 24 @implementation AppViewController |
| 25 |
| 26 - (instancetype)initWithMainViewController: |
| 27 (UIViewController*)mainViewController { |
| 28 if (self = [super init]) { |
| 29 _mainViewController = mainViewController; |
| 30 } |
| 31 return self; |
| 32 } |
| 33 |
| 34 - (void)viewDidLoad { |
| 35 [self addChildViewController:_mainViewController]; |
| 36 [self.view addSubview:_mainViewController.view]; |
| 37 [_mainViewController didMoveToParentViewController:self]; |
| 38 } |
| 39 |
| 40 #pragma mark - AppController |
| 41 - (void)showMenuAnimated:(BOOL)animated { |
| 42 if (_menuController != nil && [_menuController isBeingPresented]) { |
| 43 return; |
| 44 } |
| 45 _menuController = [[RemotingMenuViewController alloc] init]; |
| 46 [self presentViewController:_menuController animated:animated completion:nil]; |
| 47 } |
| 48 |
| 49 - (void)hideMenuAnimated:(BOOL)animated { |
| 50 if (_menuController == nil || ![_menuController isBeingPresented]) { |
| 51 return; |
| 52 } |
| 53 [_menuController dismissViewControllerAnimated:animated completion:nil]; |
| 54 _menuController = nil; |
| 55 } |
| 56 |
| 57 - (void)presentSignInFlow { |
| 58 [self showMenuAnimated:YES]; |
| 59 } |
| 60 |
| 61 - (UIViewController*)childViewControllerForStatusBarStyle { |
| 62 return _mainViewController; |
| 63 } |
| 64 |
| 65 - (UIViewController*)childViewControllerForStatusBarHidden { |
| 66 return _mainViewController; |
| 67 } |
| 68 |
| 69 @end |
OLD | NEW |