OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/core/distiller_page.h" | 5 #include "components/dom_distiller/core/distiller_page.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 | 88 |
89 void DistillerPage::OnDistillationDone(const GURL& page_url, | 89 void DistillerPage::OnDistillationDone(const GURL& page_url, |
90 const base::Value* value) { | 90 const base::Value* value) { |
91 DCHECK(!ready_); | 91 DCHECK(!ready_); |
92 ready_ = true; | 92 ready_ = true; |
93 | 93 |
94 std::unique_ptr<dom_distiller::proto::DomDistillerResult> distiller_result( | 94 std::unique_ptr<dom_distiller::proto::DomDistillerResult> distiller_result( |
95 new dom_distiller::proto::DomDistillerResult()); | 95 new dom_distiller::proto::DomDistillerResult()); |
96 bool found_content; | 96 bool found_content; |
97 if (value->IsType(base::Value::TYPE_NULL)) { | 97 if (value->IsType(base::Value::Type::NONE)) { |
98 found_content = false; | 98 found_content = false; |
99 } else { | 99 } else { |
100 found_content = | 100 found_content = |
101 dom_distiller::proto::json::DomDistillerResult::ReadFromValue( | 101 dom_distiller::proto::json::DomDistillerResult::ReadFromValue( |
102 value, distiller_result.get()); | 102 value, distiller_result.get()); |
103 if (!found_content) { | 103 if (!found_content) { |
104 DVLOG(1) << "Unable to parse DomDistillerResult."; | 104 DVLOG(1) << "Unable to parse DomDistillerResult."; |
105 } else { | 105 } else { |
106 base::TimeDelta distillation_time = | 106 base::TimeDelta distillation_time = |
107 base::TimeTicks::Now() - distillation_start_; | 107 base::TimeTicks::Now() - distillation_start_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 153 } |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 base::ThreadTaskRunnerHandle::Get()->PostTask( | 157 base::ThreadTaskRunnerHandle::Get()->PostTask( |
158 FROM_HERE, base::Bind(distiller_page_callback_, | 158 FROM_HERE, base::Bind(distiller_page_callback_, |
159 base::Passed(&distiller_result), found_content)); | 159 base::Passed(&distiller_result), found_content)); |
160 } | 160 } |
161 | 161 |
162 } // namespace dom_distiller | 162 } // namespace dom_distiller |
OLD | NEW |