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

Side by Side Diff: ios/clean/chrome/browser/ui/toolbar/toolbar_mediator.mm

Issue 2708013002: [ios clean] Creates ToolbarWebState Mediator (Closed)
Patch Set: Renaming 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 unified diff | Download patch
OLDNEW
(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_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_consumer.h"
10 #include "ios/web/public/web_state/web_state.h"
11 #import "ios/web/public/web_state/web_state_observer_bridge.h"
12
13 @interface ToolbarMediator ()<CRWWebStateObserver>
14 @end
15
16 @implementation ToolbarMediator {
17 std::unique_ptr<web::WebStateObserverBridge> _webStateObserver;
18 }
19
20 @synthesize consumer = _consumer;
21 @synthesize webState = _webState;
22
23 - (void)dealloc {
24 _webStateObserver.reset();
25 _webState = nullptr;
26 }
27
28 - (void)setWebState:(web::WebState*)webState {
29 _webState = webState;
30 _webStateObserver =
31 base::MakeUnique<web::WebStateObserverBridge>(self.webState, self);
32 }
33
34 #pragma mark - CRWWebStateObserver
35
36 - (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success {
37 const GURL& pageURL = webState->GetVisibleURL();
38 [self.consumer setCurrentPageText:base::SysUTF8ToNSString(pageURL.spec())];
39 }
40
41 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698