| 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 package org.chromium.distiller; | 5 package org.chromium.distiller; |
| 6 | 6 |
| 7 import org.chromium.distiller.proto.DomDistillerProtos; | 7 import org.chromium.distiller.proto.DomDistillerProtos; |
| 8 import org.chromium.distiller.proto.DomDistillerProtos.DebugInfo; | 8 import org.chromium.distiller.proto.DomDistillerProtos.DebugInfo; |
| 9 import org.chromium.distiller.proto.DomDistillerProtos.TimingInfo; | 9 import org.chromium.distiller.proto.DomDistillerProtos.TimingInfo; |
| 10 import org.chromium.distiller.DomUtil; | 10 import org.chromium.distiller.DomUtil; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 DomDistillerProtos.DistilledContent content = DomDistillerProtos.Distill
edContent.create(); | 40 DomDistillerProtos.DistilledContent content = DomDistillerProtos.Distill
edContent.create(); |
| 41 boolean textOnly = options.hasExtractTextOnly() && options.getExtractTex
tOnly(); | 41 boolean textOnly = options.hasExtractTextOnly() && options.getExtractTex
tOnly(); |
| 42 content.setHtml(contentExtractor.extractContent(textOnly)); | 42 content.setHtml(contentExtractor.extractContent(textOnly)); |
| 43 result.setDistilledContent(content); | 43 result.setDistilledContent(content); |
| 44 result.setTextDirection(contentExtractor.getTextDirection()); | 44 result.setTextDirection(contentExtractor.getTextDirection()); |
| 45 | 45 |
| 46 for (String url : contentExtractor.getImageUrls()) { | 46 for (String url : contentExtractor.getImageUrls()) { |
| 47 result.addContentImages().setUrl(url); | 47 result.addContentImages().setUrl(url); |
| 48 } | 48 } |
| 49 | 49 |
| 50 String original_url = options.hasOriginalUrl() ? options.getOriginalUrl(
) : Window.Location.getHref(); | 50 // iOS doesn't support reading window.location.href, so we use document.
URL instead. |
| 51 String original_url = |
| 52 options.hasOriginalUrl() ? options.getOriginalUrl() : Document.g
et().getURL(); |
| 51 TimingInfo timingInfo = contentExtractor.getTimingInfo(); | 53 TimingInfo timingInfo = contentExtractor.getTimingInfo(); |
| 52 double stPaging = DomUtil.getTime(); | 54 double stPaging = DomUtil.getTime(); |
| 53 result.setPaginationInfo(PagingLinksFinder.getPaginationInfo(original_ur
l)); | 55 result.setPaginationInfo(PagingLinksFinder.getPaginationInfo(original_ur
l)); |
| 54 LogUtil.addTimingInfo(stPaging, timingInfo, "Pagination"); | 56 LogUtil.addTimingInfo(stPaging, timingInfo, "Pagination"); |
| 55 result.setMarkupInfo(contentExtractor.getMarkupParser().getMarkupInfo())
; | 57 result.setMarkupInfo(contentExtractor.getMarkupParser().getMarkupInfo())
; |
| 56 timingInfo.setTotalTime(DomUtil.getTime() - startTime); | 58 timingInfo.setTotalTime(DomUtil.getTime() - startTime); |
| 57 result.setTimingInfo(timingInfo); | 59 result.setTimingInfo(timingInfo); |
| 58 result.setStatisticsInfo(contentExtractor.getStatisticsInfo()); | 60 result.setStatisticsInfo(contentExtractor.getStatisticsInfo()); |
| 59 DebugInfo debugInfo = DebugInfo.create(); | 61 DebugInfo debugInfo = DebugInfo.create(); |
| 60 debugInfo.setLog(LogUtil.getAndClearLog()); | 62 debugInfo.setLog(LogUtil.getAndClearLog()); |
| 61 result.setDebugInfo(debugInfo); | 63 result.setDebugInfo(debugInfo); |
| 62 return result; | 64 return result; |
| 63 } | 65 } |
| 64 } | 66 } |
| OLD | NEW |