Index: ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm |
diff --git a/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm b/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm |
index f333f4a561e58cc711830ca79c8d6da0cdcc80ca..728eac22e77b6a9be48100968e14e1d4e6a4e887 100644 |
--- a/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm |
+++ b/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm |
@@ -7,7 +7,8 @@ |
#import "ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.h" |
#import "ios/clean/chrome/browser/ui/web_contents/web_contents_view_controller.h" |
#import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" |
-#import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.h" |
+#import "ios/shared/chrome/browser/tabs/web_state_list.h" |
+#import "ios/shared/chrome/browser/ui/browser_list/browser.h" |
#include "ios/web/public/web_state/web_state.h" |
#if !defined(__has_feature) || !__has_feature(objc_arc) |
@@ -20,24 +21,13 @@ |
@end |
@implementation WebCoordinator |
-@synthesize webState = _webState; |
@synthesize viewController = _viewController; |
@synthesize mediator = _mediator; |
-- (instancetype)init { |
- if ((self = [super init])) { |
- _mediator = [[WebContentsMediator alloc] init]; |
- } |
- return self; |
-} |
- |
-- (void)setWebState:(web::WebState*)webState { |
- _webState = webState; |
- self.mediator.webState = self.webState; |
-} |
- |
- (void)start { |
self.viewController = [[WebContentsViewController alloc] init]; |
+ self.mediator = [[WebContentsMediator alloc] init]; |
+ self.mediator.webStateList = &self.browser->web_state_list(); |
self.mediator.consumer = self.viewController; |
// Reminder: this is a no-op if |baseViewController| is nil, for example |
@@ -51,9 +41,10 @@ |
- (void)stop { |
[super stop]; |
- // PLACEHOLDER: This is how the webUsageEnabled is set to false. Find a |
- // better way in the future. |
- self.mediator.webState = nullptr; |
+ web::WebState* webState = self.browser->web_state_list().GetActiveWebState(); |
lpromero
2017/04/03 09:48:36
I'd move this to the WebContentsMediator and here
edchin
2017/04/04 19:50:12
I added a -disconnect method. PTAL.
|
+ if (webState) { |
+ webState->SetWebUsageEnabled(false); |
+ } |
} |
@end |