| 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.h" | 5 #include "components/dom_distiller/core/distiller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 if (distiller_result->has_title()) { | 148 if (distiller_result->has_title()) { |
| 149 page_data->distilled_page_proto->data.set_title( | 149 page_data->distilled_page_proto->data.set_title( |
| 150 distiller_result->title()); | 150 distiller_result->title()); |
| 151 } | 151 } |
| 152 page_data->distilled_page_proto->data.set_url(page_url.spec()); | 152 page_data->distilled_page_proto->data.set_url(page_url.spec()); |
| 153 if (distiller_result->has_distilled_content() && | 153 if (distiller_result->has_distilled_content() && |
| 154 distiller_result->distilled_content().has_html()) { | 154 distiller_result->distilled_content().has_html()) { |
| 155 page_data->distilled_page_proto->data.set_html( | 155 page_data->distilled_page_proto->data.set_html( |
| 156 distiller_result->distilled_content().html()); | 156 distiller_result->distilled_content().html()); |
| 157 } | 157 } |
| 158 if (distiller_result->has_debug_info() && |
| 159 distiller_result->debug_info().has_log()) { |
| 160 page_data->distilled_page_proto->data.mutable_debug_info()->set_log( |
| 161 distiller_result->debug_info().log()); |
| 162 } |
| 158 | 163 |
| 159 if (distiller_result->has_pagination_info()) { | 164 if (distiller_result->has_pagination_info()) { |
| 160 proto::PaginationInfo pagination_info = | 165 proto::PaginationInfo pagination_info = |
| 161 distiller_result->pagination_info(); | 166 distiller_result->pagination_info(); |
| 162 if (pagination_info.has_next_page()) { | 167 if (pagination_info.has_next_page()) { |
| 163 GURL next_page_url(pagination_info.next_page()); | 168 GURL next_page_url(pagination_info.next_page()); |
| 164 if (next_page_url.is_valid()) { | 169 if (next_page_url.is_valid()) { |
| 165 // The pages should be in same origin. | 170 // The pages should be in same origin. |
| 166 DCHECK_EQ(next_page_url.GetOrigin(), page_url.GetOrigin()); | 171 DCHECK_EQ(next_page_url.GetOrigin(), page_url.GetOrigin()); |
| 167 AddToDistillationQueue(page_num + 1, next_page_url); | 172 AddToDistillationQueue(page_num + 1, next_page_url); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 DCHECK(finished_pages_index_.empty()); | 305 DCHECK(finished_pages_index_.empty()); |
| 301 | 306 |
| 302 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, | 307 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, |
| 303 false); | 308 false); |
| 304 finished_cb_.Run(article_proto.Pass()); | 309 finished_cb_.Run(article_proto.Pass()); |
| 305 finished_cb_.Reset(); | 310 finished_cb_.Reset(); |
| 306 } | 311 } |
| 307 } | 312 } |
| 308 | 313 |
| 309 } // namespace dom_distiller | 314 } // namespace dom_distiller |
| OLD | NEW |