Chromium Code Reviews| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_web_state_mediator.h" | |
| 6 | |
| 7 #include "base/memory/ptr_util.h" | |
| 8 #include "base/strings/sys_string_conversions.h" | |
| 9 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_web_state_consumer.h" | |
| 10 #include "ios/web/public/web_state/web_state.h" | |
| 11 | |
| 12 @implementation ToolbarWebStateMediator { | |
| 13 std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; | |
| 14 } | |
| 15 | |
| 16 @synthesize consumer = _consumer; | |
| 17 @synthesize webState = _webState; | |
| 18 | |
| 19 - (void)dealloc { | |
| 20 _webStateObserver.reset(); | |
| 21 _webState = nullptr; | |
| 22 } | |
| 23 | |
| 24 - (void)setWebState:(web::WebState*)webState { | |
| 25 _webState = webState; | |
| 26 _webStateObserver = | |
| 27 base::MakeUnique<web::WebStateObserverBridge>(self.webState, self); | |
| 28 } | |
| 29 | |
| 30 #pragma mark - CRWWebStateObserver | |
| 31 | |
| 32 - (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success { | |
| 33 const GURL& pageURL = webState->GetVisibleURL(); | |
| 34 [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
 
 | |
| 35 } | |
| 36 | |
| 37 @end | |
| OLD | NEW |