Chromium Code Reviews| 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 |