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/web_contents/web_contents_mediator.h" | |
| 6 | |
| 7 #import "ios/clean/chrome/browser/ui/web_contents/web_contents_consumer.h" | |
| 8 #import "ios/web/public/navigation_manager.h" | |
| 9 #include "ios/web/public/web_state/web_state.h" | |
| 10 #include "ui/base/page_transition_types.h" | |
| 11 #include "url/gurl.h" | |
| 12 | |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 14 #error "This file requires ARC support." | |
| 15 #endif | |
| 16 | |
| 17 @implementation WebContentsMediator | |
| 18 @synthesize webState = _webState; | |
| 19 @synthesize consumer = _consumer; | |
| 20 | |
| 21 - (void)setWebState:(web::WebState*)webState { | |
| 22 if (_webState) { | |
| 23 _webState->SetWebUsageEnabled(false); | |
| 24 } | |
| 25 _webState = webState; | |
| 26 if (!self.webState) | |
|
edchin
2017/02/02 22:17:52
Can we be consistent in the use of property vs. in
marq (ping after 24h)
2017/02/03 09:48:10
I think I have been. Note that this is the setter
edchin
2017/02/03 15:33:38
You're right. I should have seen that this is a pr
| |
| 27 return; | |
| 28 | |
| 29 self.webState->SetWebUsageEnabled(true); | |
| 30 if (!self.webState->GetNavigationManager()->GetItemCount()) { | |
| 31 web::NavigationManager::WebLoadParams params( | |
| 32 GURL("https://dev.chromium.org/")); | |
| 33 params.transition_type = ui::PAGE_TRANSITION_TYPED; | |
| 34 _webState->GetNavigationManager()->LoadURLWithParams(params); | |
|
edchin
2017/02/03 15:33:38
Perhaps this one should actually be a property acc
marq (ping after 24h)
2017/02/07 14:33:10
Yes! Bad copy/paste from me.
| |
| 35 } | |
| 36 [self.consumer contentViewDidChange:self.webState->GetView()]; | |
| 37 } | |
| 38 | |
| 39 - (void)setConsumer:(id<WebContentsConsumer>)consumer { | |
| 40 _consumer = consumer; | |
| 41 if (self.webState) { | |
| 42 [self.consumer contentViewDidChange:self.webState->GetView()]; | |
| 43 } | |
| 44 } | |
| 45 | |
| 46 @end | |
| OLD | NEW |