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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 | 163 |
164 if (distiller_result->has_pagination_info()) { | 164 if (distiller_result->has_pagination_info()) { |
165 proto::PaginationInfo pagination_info = | 165 proto::PaginationInfo pagination_info = |
166 distiller_result->pagination_info(); | 166 distiller_result->pagination_info(); |
167 if (pagination_info.has_next_page()) { | 167 if (pagination_info.has_next_page()) { |
168 GURL next_page_url(pagination_info.next_page()); | 168 GURL next_page_url(pagination_info.next_page()); |
169 if (next_page_url.is_valid()) { | 169 if (next_page_url.is_valid()) { |
170 // The pages should be in same origin. | 170 // The pages should be in same origin. |
171 DCHECK_EQ(next_page_url.GetOrigin(), page_url.GetOrigin()); | 171 DCHECK_EQ(next_page_url.GetOrigin(), page_url.GetOrigin()); |
172 AddToDistillationQueue(page_num + 1, next_page_url); | 172 AddToDistillationQueue(page_num + 1, next_page_url); |
173 page_data->distilled_page_proto->data.mutable_pagination_info()-> | |
174 set_next_page(next_page_url.spec()); | |
173 } | 175 } |
174 } | 176 } |
175 | 177 |
176 if (pagination_info.has_prev_page()) { | 178 if (pagination_info.has_prev_page()) { |
177 GURL prev_page_url(pagination_info.prev_page()); | 179 GURL prev_page_url(pagination_info.prev_page()); |
178 if (prev_page_url.is_valid()) { | 180 if (prev_page_url.is_valid()) { |
179 DCHECK_EQ(prev_page_url.GetOrigin(), page_url.GetOrigin()); | 181 DCHECK_EQ(prev_page_url.GetOrigin(), page_url.GetOrigin()); |
180 AddToDistillationQueue(page_num - 1, prev_page_url); | 182 AddToDistillationQueue(page_num - 1, prev_page_url); |
183 page_data->distilled_page_proto->data.mutable_pagination_info()-> | |
nyquist
2014/10/24 20:04:02
Since you added canonical_page to the DistilledPag
kuan
2014/10/24 20:57:32
Done. no reason, except that it's not used, but i
| |
184 set_prev_page(prev_page_url.spec()); | |
181 } | 185 } |
182 } | 186 } |
183 } | 187 } |
184 | 188 |
185 for (int img_num = 0; img_num < distiller_result->image_urls_size(); | 189 for (int img_num = 0; img_num < distiller_result->image_urls_size(); |
186 ++img_num) { | 190 ++img_num) { |
187 std::string image_id = | 191 std::string image_id = |
188 base::IntToString(page_num + 1) + "_" + base::IntToString(img_num); | 192 base::IntToString(page_num + 1) + "_" + base::IntToString(img_num); |
189 FetchImage(page_num, image_id, distiller_result->image_urls(img_num)); | 193 FetchImage(page_num, image_id, distiller_result->image_urls(img_num)); |
190 } | 194 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 DCHECK(finished_pages_index_.empty()); | 309 DCHECK(finished_pages_index_.empty()); |
306 | 310 |
307 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, | 311 base::AutoReset<bool> dont_delete_this_in_callback(&destruction_allowed_, |
308 false); | 312 false); |
309 finished_cb_.Run(article_proto.Pass()); | 313 finished_cb_.Run(article_proto.Pass()); |
310 finished_cb_.Reset(); | 314 finished_cb_.Reset(); |
311 } | 315 } |
312 } | 316 } |
313 | 317 |
314 } // namespace dom_distiller | 318 } // namespace dom_distiller |
OLD | NEW |