| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() && | 158 if (distiller_result->has_debug_info() && |
| 159 distiller_result->debug_info().has_log()) { | 159 distiller_result->debug_info().has_log()) { |
| 160 page_data->distilled_page_proto->data.mutable_debug_info()->set_log( | 160 page_data->distilled_page_proto->data.mutable_debug_info()->set_log( |
| 161 distiller_result->debug_info().log()); | 161 distiller_result->debug_info().log()); |
| 162 } | 162 } |
| 163 | 163 |
| 164 if (distiller_result->has_text_direction()) { |
| 165 page_data->distilled_page_proto->data.set_text_direction( |
| 166 distiller_result->text_direction()); |
| 167 } else { |
| 168 page_data->distilled_page_proto->data.set_text_direction("auto"); |
| 169 } |
| 170 |
| 164 if (distiller_result->has_pagination_info()) { | 171 if (distiller_result->has_pagination_info()) { |
| 165 proto::PaginationInfo pagination_info = | 172 proto::PaginationInfo pagination_info = |
| 166 distiller_result->pagination_info(); | 173 distiller_result->pagination_info(); |
| 167 if (pagination_info.has_next_page()) { | 174 if (pagination_info.has_next_page()) { |
| 168 GURL next_page_url(pagination_info.next_page()); | 175 GURL next_page_url(pagination_info.next_page()); |
| 169 if (next_page_url.is_valid()) { | 176 if (next_page_url.is_valid()) { |
| 170 // The pages should be in same origin. | 177 // The pages should be in same origin. |
| 171 DCHECK_EQ(next_page_url.GetOrigin(), page_url.GetOrigin()); | 178 DCHECK_EQ(next_page_url.GetOrigin(), page_url.GetOrigin()); |
| 172 AddToDistillationQueue(page_num + 1, next_page_url); | 179 AddToDistillationQueue(page_num + 1, next_page_url); |
| 173 } | 180 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 DCHECK(finished_pages_index_.empty()); | 312 DCHECK(finished_pages_index_.empty()); |
| 306 | 313 |
| 307 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, | 314 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, |
| 308 false); | 315 false); |
| 309 finished_cb_.Run(article_proto.Pass()); | 316 finished_cb_.Run(article_proto.Pass()); |
| 310 finished_cb_.Reset(); | 317 finished_cb_.Reset(); |
| 311 } | 318 } |
| 312 } | 319 } |
| 313 | 320 |
| 314 } // namespace dom_distiller | 321 } // namespace dom_distiller |
| OLD | NEW |