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

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

Issue 2675763002: [ios clean] Consumer interface for WebContents (Closed)
Patch Set: Feedback. Created 3 years, 10 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;
+ 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.
+ self.mediator.webState = nullptr;
}
@end
« no previous file with comments | « ios/clean/chrome/browser/ui/web_contents/web_contents_view_controller.mm ('k') | ios/clean/chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698