OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
nicholss
2017/06/19 16:32:10
2017
Yuwei
2017/06/19 19:17:27
Oops... Done.
| |
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 RemotingMenuViewController* _menuController; | |
19 } | |
20 @end | |
21 | |
22 @implementation AppViewController | |
23 | |
24 @synthesize mainViewController = _mainViewController; | |
25 | |
26 - (instancetype)init { | |
27 if (self = [super init]) { | |
28 _menuController = [[RemotingMenuViewController alloc] init]; | |
nicholss
2017/06/19 16:32:10
It would be better to lazy init the menu controlle
Yuwei
2017/06/19 19:17:27
Done.
| |
29 } | |
30 return self; | |
31 } | |
32 | |
33 - (void)setMenuVisible:(BOOL)visible animated:(BOOL)animated { | |
34 if (visible && ![_menuController isBeingPresented]) { | |
35 [self presentViewController:_menuController | |
36 animated:animated | |
37 completion:nil]; | |
38 } else if (!visible && [_menuController isBeingPresented]) { | |
39 [_menuController dismissViewControllerAnimated:animated completion:nil]; | |
40 } | |
41 } | |
42 | |
43 - (void)requestSignIn { | |
44 [self setMenuVisible:YES animated:YES]; | |
45 } | |
46 | |
47 - (void)setMainViewController:(UIViewController*)mainViewController { | |
48 DCHECK(_mainViewController == nil); | |
49 _mainViewController = mainViewController; | |
50 [self addChildViewController:_mainViewController]; | |
51 [self.view addSubview:_mainViewController.view]; | |
52 [_mainViewController didMoveToParentViewController:self]; | |
53 } | |
54 | |
55 - (UIViewController*)childViewControllerForStatusBarStyle { | |
56 return _mainViewController; | |
57 } | |
58 | |
59 - (UIViewController*)childViewControllerForStatusBarHidden { | |
60 return _mainViewController; | |
61 } | |
62 | |
63 @end | |
OLD | NEW |