Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Unified Diff: ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm

Issue 2675763002: [ios clean] Consumer interface for WebContents (Closed)
Patch Set: Separate files. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 09d356f68e2efbcae4b7529d09ad8d981eb5c2f1..f736febf936796e11525de871a2b6194f8631782 100644
--- a/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm
+++ b/ios/clean/chrome/browser/ui/web_contents/web_coordinator.mm
@@ -9,6 +9,7 @@
#import "ios/clean/chrome/browser/ui/web_contents/web_coordinator.h"
#import "ios/clean/chrome/browser/browser_coordinator+internal.h"
+#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"
#include "ios/web/public/web_state/web_state.h"
@@ -18,19 +19,30 @@
#endif
@interface WebCoordinator ()
-
@property(nonatomic, strong) WebContentsViewController* viewController;
-
+@property(nonatomic, strong) WebContentsMediator* mediator;
@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;
edchin 2017/02/02 22:17:53 Consistent use of property accessor.
marq (ping after 24h) 2017/02/03 09:48:10 Again, this is the setter method; I have to use th
edchin 2017/02/03 15:33:38 You're right. I should have seen that this is the
+ self.mediator.webState = self.webState;
+}
- (void)start {
- self.webState->SetWebUsageEnabled(true);
- self.viewController =
- [[WebContentsViewController alloc] initWithWebState:self.webState];
+ self.viewController = [[WebContentsViewController alloc] init];
+ self.mediator.consumer = self.viewController;
// Reminder: this is a no-op if |baseViewController| is nil, for example
// when this coordinator's view controller will be contained instead of
@@ -41,7 +53,9 @@
}
- (void)stop {
- self.webState->SetWebUsageEnabled(false);
+ // PLACEHOLDER: This is how the webUsageEnabled is set to false. Find a
+ // better way in the future.
edchin 2017/02/02 22:17:53 It is not clear to me why we should set webUsageEn
marq (ping after 24h) 2017/02/03 09:48:10 webUsageEnabled means that the WebState is attache
edchin 2017/02/03 15:33:38 Acknowledged.
+ self.mediator.webState = nullptr;
}
@end

Powered by Google App Engine
This is Rietveld 408576698