| 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); |
| 177 } | 178 } |
| 178 | 179 |
| 179 - (void)distillationFinished:(const std::string&)html forURL:(const GURL&)url { | 180 - (void)distillationFinished:(const std::string&)html forURL:(const GURL&)url { |
| 180 UIView* superview = [self.delegate superviewForReaderModePanel]; | 181 UIView* superview = [self.delegate superviewForReaderModePanel]; |
| 181 DCHECK(_viewer || [superview viewWithTag:kReaderModeViewTag]); | 182 DCHECK(_viewer || [superview viewWithTag:kReaderModeViewTag]); |
| 182 if ([superview viewWithTag:kReaderModeViewTag]) { | 183 if ([superview viewWithTag:kReaderModeViewTag]) { |
| 183 [self.delegate loadReaderModeHTML:base::SysUTF8ToNSString(html) forURL:url]; | 184 [self.delegate loadReaderModeHTML:base::SysUTF8ToNSString(html) forURL:url]; |
| 184 } else if (_viewer) { | 185 } else if (_viewer) { |
| 185 [self showInfoBar:html forURL:url]; | 186 [self showInfoBar:html forURL:url]; |
| 186 } | 187 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 #pragma mark - InfoBarManagerObserverBridgeProtocol. | 301 #pragma mark - InfoBarManagerObserverBridgeProtocol. |
| 301 | 302 |
| 302 - (void)infoBarRemoved:(infobars::InfoBar*)infobar { | 303 - (void)infoBarRemoved:(infobars::InfoBar*)infobar { |
| 303 if (infobar == infobar_) { | 304 if (infobar == infobar_) { |
| 304 _viewer.reset(); | 305 _viewer.reset(); |
| 305 infobar_ = nullptr; | 306 infobar_ = nullptr; |
| 306 } | 307 } |
| 307 } | 308 } |
| 308 | 309 |
| 309 @end | 310 @end |
| OLD | NEW |