Index: ios/chrome/browser/ui/web_contents/web_coordinator.mm |
diff --git a/ios/chrome/browser/ui/web_contents/web_coordinator.mm b/ios/chrome/browser/ui/web_contents/web_coordinator.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f0272612f1961657739da20e24faa84d1d911e51 |
--- /dev/null |
+++ b/ios/chrome/browser/ui/web_contents/web_coordinator.mm |
@@ -0,0 +1,45 @@ |
+// Copyright 2016 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. |
+ |
+// ====== New Architecture ===== |
+// = This code is only used in the new iOS Chrome architecture. = |
+// ============================================================================ |
+ |
+#import "ios/chrome/browser/ui/web_contents/web_coordinator.h" |
+ |
+#import "ios/chrome/browser/browser_coordinator+internal.h" |
+#import "ios/chrome/browser/ui/web_contents/web_contents_view_controller.h" |
+ |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
+@interface WebCoordinator () |
+ |
+@property(nonatomic, strong) WebContentsViewController* viewController; |
+@property(nonatomic, readwrite, strong) WebMediator* webMediator; |
+ |
+@end |
+ |
+@implementation WebCoordinator |
+@synthesize webMediator = _webMediator; |
+@synthesize viewController = _viewController; |
+ |
+- (void)start { |
+ self.viewController = [[WebContentsViewController alloc] |
+ initWithWebState:self.webMediator.webState]; |
+ |
+ // Reminder: this is a no-op if |rootViewController| is nil, for example |
+ // when this coordinator's view controller will be contained instead of |
+ // presented. |
+ [self.rootViewController presentViewController:self.viewController |
+ animated:YES |
+ completion:nil]; |
+} |
+ |
+- (void)setWebState:(web::WebState*)webState { |
+ self.webMediator = [[WebMediator alloc] initWithWebState:webState]; |
+} |
+ |
+@end |