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

Unified Diff: ios/clean/chrome/browser/ui/toolbar/toolbar_web_state_mediator.mm

Issue 2708013002: [ios clean] Creates ToolbarWebState Mediator (Closed)
Patch Set: 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/toolbar/toolbar_web_state_mediator.mm
diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_web_state_mediator.mm b/ios/clean/chrome/browser/ui/toolbar/toolbar_web_state_mediator.mm
new file mode 100644
index 0000000000000000000000000000000000000000..2f6a9a98279d54e468ad7c97e97214bca319bf09
--- /dev/null
+++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_web_state_mediator.mm
@@ -0,0 +1,37 @@
+// Copyright 2017 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.
+
+#import "ios/clean/chrome/browser/ui/toolbar/toolbar_web_state_mediator.h"
+
+#include "base/memory/ptr_util.h"
+#include "base/strings/sys_string_conversions.h"
+#import "ios/clean/chrome/browser/ui/toolbar/toolbar_web_state_consumer.h"
+#include "ios/web/public/web_state/web_state.h"
+
+@implementation ToolbarWebStateMediator {
+ std::unique_ptr<web::WebStateObserverBridge> _webStateObserver;
+}
+
+@synthesize consumer = _consumer;
+@synthesize webState = _webState;
+
+- (void)dealloc {
+ _webStateObserver.reset();
+ _webState = nullptr;
+}
+
+- (void)setWebState:(web::WebState*)webState {
+ _webState = webState;
+ _webStateObserver =
+ base::MakeUnique<web::WebStateObserverBridge>(self.webState, self);
+}
+
+#pragma mark - CRWWebStateObserver
+
+- (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success {
+ const GURL& pageURL = webState->GetVisibleURL();
+ [self.consumer setCurrentPageText:base::SysUTF8ToNSString(pageURL.spec())];
edchin 2017/02/21 07:56:12 The consumer is a UI object therefore this call ne
marq (ping after 24h) 2017/02/21 12:04:25 The CRWWebStateObserver and web::WebStateObserver
sczs 2017/02/21 17:28:28 Asked Eugene and he told me that they all should b
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698