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.TimingInfo; | 8 import org.chromium.distiller.proto.DomDistillerProtos.TimingInfo; |
9 | 9 |
10 import com.google.gwt.dom.client.Element; | 10 import com.google.gwt.dom.client.Element; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 /** | 83 /** |
84 * Returns the properties of the markup "article" object, null if none. | 84 * Returns the properties of the markup "article" object, null if none. |
85 */ | 85 */ |
86 public Article getArticle(); | 86 public Article getArticle(); |
87 | 87 |
88 /** | 88 /** |
89 * Returns true if page owner has opted out of distillation. | 89 * Returns true if page owner has opted out of distillation. |
90 */ | 90 */ |
91 public boolean optOut(); | 91 public boolean optOut(); |
| 92 |
| 93 /** |
| 94 * Returns the markup body of the document, empty string if none. |
| 95 */ |
| 96 public String getStructuredData(); |
92 } | 97 } |
93 | 98 |
94 /** | 99 /** |
95 * The object that contains the properties of an image in the document. | 100 * The object that contains the properties of an image in the document. |
96 */ | 101 */ |
97 public static class Image { | 102 public static class Image { |
98 public String url = ""; | 103 public String url = ""; |
99 public String secureUrl = ""; | 104 public String secureUrl = ""; |
100 public String type = ""; | 105 public String type = ""; |
101 public String caption = ""; | 106 public String caption = ""; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 215 } |
211 | 216 |
212 public Article getArticle() { | 217 public Article getArticle() { |
213 Article article = null; | 218 Article article = null; |
214 for (int i = 0; i < mAccessors.size() && article == null; i++) { | 219 for (int i = 0; i < mAccessors.size() && article == null; i++) { |
215 article = mAccessors.get(i).getArticle(); | 220 article = mAccessors.get(i).getArticle(); |
216 } | 221 } |
217 return article; | 222 return article; |
218 } | 223 } |
219 | 224 |
| 225 public String getStructuredData() { |
| 226 String content = ""; |
| 227 for (int i = 0; i < mAccessors.size() && content.isEmpty(); i++) { |
| 228 content = mAccessors.get(i).getStructuredData(); |
| 229 } |
| 230 return content; |
| 231 } |
| 232 |
220 public boolean optOut() { | 233 public boolean optOut() { |
221 boolean optOut = false; | 234 boolean optOut = false; |
222 for (int i = 0; i < mAccessors.size() && !optOut; i++) { | 235 for (int i = 0; i < mAccessors.size() && !optOut; i++) { |
223 optOut = mAccessors.get(i).optOut(); | 236 optOut = mAccessors.get(i).optOut(); |
224 } | 237 } |
225 return optOut; | 238 return optOut; |
226 } | 239 } |
227 | 240 |
228 public DomDistillerProtos.MarkupInfo getMarkupInfo() { | 241 public DomDistillerProtos.MarkupInfo getMarkupInfo() { |
229 DomDistillerProtos.MarkupInfo info = DomDistillerProtos.MarkupInfo.creat
e(); | 242 DomDistillerProtos.MarkupInfo info = DomDistillerProtos.MarkupInfo.creat
e(); |
(...skipping 29 matching lines...) Expand all Loading... |
259 imageInfo.setSecureUrl(image.secureUrl); | 272 imageInfo.setSecureUrl(image.secureUrl); |
260 imageInfo.setType(image.type); | 273 imageInfo.setType(image.type); |
261 imageInfo.setCaption(image.caption); | 274 imageInfo.setCaption(image.caption); |
262 imageInfo.setWidth(image.width); | 275 imageInfo.setWidth(image.width); |
263 imageInfo.setHeight(image.height); | 276 imageInfo.setHeight(image.height); |
264 } | 277 } |
265 | 278 |
266 return info; | 279 return info; |
267 } | 280 } |
268 } | 281 } |
OLD | NEW |