| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/browser/ui/reader_mode/reader_mode_controller.h" | 5 #import "ios/chrome/browser/ui/reader_mode/reader_mode_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/ios/weak_nsobject.h" | 10 #include "base/ios/weak_nsobject.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 ios::ChromeBrowserState::FromBrowserState(_webState->GetBrowserState()); | 166 ios::ChromeBrowserState::FromBrowserState(_webState->GetBrowserState()); |
| 167 return base::MakeUnique<dom_distiller::DistillerViewer>( | 167 return base::MakeUnique<dom_distiller::DistillerViewer>( |
| 168 dom_distiller::DomDistillerServiceFactory::GetForBrowserState( | 168 dom_distiller::DomDistillerServiceFactory::GetForBrowserState( |
| 169 browserState), | 169 browserState), |
| 170 browserState->GetPrefs(), pageURL, | 170 browserState->GetPrefs(), pageURL, |
| 171 base::BindBlock(^( | 171 base::BindBlock(^( |
| 172 const GURL& pageURL, const std::string& html, | 172 const GURL& pageURL, const std::string& html, |
| 173 const std::vector<dom_distiller::DistillerViewer::ImageInfo>& images, | 173 const std::vector<dom_distiller::DistillerViewer::ImageInfo>& images, |
| 174 const std::string& title) { | 174 const std::string& title) { |
| 175 [weakSelf distillationFinished:html forURL:pageURL]; | 175 [weakSelf distillationFinished:html forURL:pageURL]; |
| 176 }), | 176 })); |
| 177 nullptr); | |
| 178 } | 177 } |
| 179 | 178 |
| 180 - (void)distillationFinished:(const std::string&)html forURL:(const GURL&)url { | 179 - (void)distillationFinished:(const std::string&)html forURL:(const GURL&)url { |
| 181 UIView* superview = [self.delegate superviewForReaderModePanel]; | 180 UIView* superview = [self.delegate superviewForReaderModePanel]; |
| 182 DCHECK(_viewer || [superview viewWithTag:kReaderModeViewTag]); | 181 DCHECK(_viewer || [superview viewWithTag:kReaderModeViewTag]); |
| 183 if ([superview viewWithTag:kReaderModeViewTag]) { | 182 if ([superview viewWithTag:kReaderModeViewTag]) { |
| 184 [self.delegate loadReaderModeHTML:base::SysUTF8ToNSString(html) forURL:url]; | 183 [self.delegate loadReaderModeHTML:base::SysUTF8ToNSString(html) forURL:url]; |
| 185 } else if (_viewer) { | 184 } else if (_viewer) { |
| 186 [self showInfoBar:html forURL:url]; | 185 [self showInfoBar:html forURL:url]; |
| 187 } | 186 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 #pragma mark - InfoBarManagerObserverBridgeProtocol. | 300 #pragma mark - InfoBarManagerObserverBridgeProtocol. |
| 302 | 301 |
| 303 - (void)infoBarRemoved:(infobars::InfoBar*)infobar { | 302 - (void)infoBarRemoved:(infobars::InfoBar*)infobar { |
| 304 if (infobar == infobar_) { | 303 if (infobar == infobar_) { |
| 305 _viewer.reset(); | 304 _viewer.reset(); |
| 306 infobar_ = nullptr; | 305 infobar_ = nullptr; |
| 307 } | 306 } |
| 308 } | 307 } |
| 309 | 308 |
| 310 @end | 309 @end |
| OLD | NEW |