Index: remoting/ios/app/app_view_controller_chromium.mm |
diff --git a/remoting/ios/app/app_view_controller_chromium.mm b/remoting/ios/app/app_view_controller_chromium.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c2ba717d04e4fb5477b7d109e7c3408b4d2d84f0 |
--- /dev/null |
+++ b/remoting/ios/app/app_view_controller_chromium.mm |
@@ -0,0 +1,63 @@ |
+// 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.
|
+// 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 "remoting/ios/app/app_view_controller.h" |
+ |
+#include "base/logging.h" |
+ |
+#import "remoting/ios/app/remoting_menu_view_controller.h" |
+ |
+// The Chromium implementation for the AppViewController. It simply shows the |
+// menu modally. |
+@interface AppViewController () { |
+ RemotingMenuViewController* _menuController; |
+} |
+@end |
+ |
+@implementation AppViewController |
+ |
+@synthesize mainViewController = _mainViewController; |
+ |
+- (instancetype)init { |
+ if (self = [super init]) { |
+ _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.
|
+ } |
+ return self; |
+} |
+ |
+- (void)setMenuVisible:(BOOL)visible animated:(BOOL)animated { |
+ if (visible && ![_menuController isBeingPresented]) { |
+ [self presentViewController:_menuController |
+ animated:animated |
+ completion:nil]; |
+ } else if (!visible && [_menuController isBeingPresented]) { |
+ [_menuController dismissViewControllerAnimated:animated completion:nil]; |
+ } |
+} |
+ |
+- (void)requestSignIn { |
+ [self setMenuVisible:YES animated:YES]; |
+} |
+ |
+- (void)setMainViewController:(UIViewController*)mainViewController { |
+ DCHECK(_mainViewController == nil); |
+ _mainViewController = mainViewController; |
+ [self addChildViewController:_mainViewController]; |
+ [self.view addSubview:_mainViewController.view]; |
+ [_mainViewController didMoveToParentViewController:self]; |
+} |
+ |
+- (UIViewController*)childViewControllerForStatusBarStyle { |
+ return _mainViewController; |
+} |
+ |
+- (UIViewController*)childViewControllerForStatusBarHidden { |
+ return _mainViewController; |
+} |
+ |
+@end |