| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/dom_distiller/ios/distiller_page_ios.h" | 5 #include "components/dom_distiller/ios/distiller_page_ios.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 DCHECK(distiller_page_); | 37 DCHECK(distiller_page_); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void DistillerWebStateObserver::PageLoaded( | 40 void DistillerWebStateObserver::PageLoaded( |
| 41 web::PageLoadCompletionStatus load_completion_status) { | 41 web::PageLoadCompletionStatus load_completion_status) { |
| 42 distiller_page_->OnLoadURLDone(load_completion_status); | 42 distiller_page_->OnLoadURLDone(load_completion_status); |
| 43 } | 43 } |
| 44 | 44 |
| 45 #pragma mark - | 45 #pragma mark - |
| 46 | 46 |
| 47 DistillerPageIOS::DistillerPageIOS(web::BrowserState* browser_state) | 47 DistillerPageIOS::DistillerPageIOS(web::BrowserState* browser_state, |
| 48 : browser_state_(browser_state), weak_ptr_factory_(this) { | 48 const std::string& distiller_js_script) |
| 49 : DistillerPage(distiller_js_script), |
| 50 browser_state_(browser_state), |
| 51 weak_ptr_factory_(this) { |
| 49 } | 52 } |
| 50 | 53 |
| 51 DistillerPageIOS::~DistillerPageIOS() { | 54 DistillerPageIOS::~DistillerPageIOS() { |
| 52 } | 55 } |
| 53 | 56 |
| 54 void DistillerPageIOS::DistillPageImpl(const GURL& url, | 57 void DistillerPageIOS::DistillPageImpl(const GURL& url, |
| 55 const std::string& script) { | 58 const std::string& script) { |
| 56 if (!url.is_valid() || !script.length()) | 59 if (!url.is_valid() || !script.length()) |
| 57 return; | 60 return; |
| 58 url_ = url; | 61 url_ = url; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 base::JSONReader::Read(base::SysNSStringToUTF8(result))); | 105 base::JSONReader::Read(base::SysNSStringToUTF8(result))); |
| 103 if (dictionaryValue && | 106 if (dictionaryValue && |
| 104 dictionaryValue->IsType(base::Value::TYPE_DICTIONARY)) { | 107 dictionaryValue->IsType(base::Value::TYPE_DICTIONARY)) { |
| 105 resultValue = dictionaryValue.Pass(); | 108 resultValue = dictionaryValue.Pass(); |
| 106 } | 109 } |
| 107 } | 110 } |
| 108 OnDistillationDone(url_, resultValue.get()); | 111 OnDistillationDone(url_, resultValue.get()); |
| 109 } | 112 } |
| 110 | 113 |
| 111 } // namespace dom_distiller | 114 } // namespace dom_distiller |
| OLD | NEW |