| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 217 } |
| 213 | 218 |
| 214 public Article getArticle() { | 219 public Article getArticle() { |
| 215 Article article = null; | 220 Article article = null; |
| 216 for (int i = 0; i < mAccessors.size() && article == null; i++) { | 221 for (int i = 0; i < mAccessors.size() && article == null; i++) { |
| 217 article = mAccessors.get(i).getArticle(); | 222 article = mAccessors.get(i).getArticle(); |
| 218 } | 223 } |
| 219 return article; | 224 return article; |
| 220 } | 225 } |
| 221 | 226 |
| 227 public String getStructuredData() { |
| 228 String content = ""; |
| 229 for (int i = 0; i < mAccessors.size() && content.isEmpty(); i++) { |
| 230 content = mAccessors.get(i).getStructuredData(); |
| 231 } |
| 232 return content; |
| 233 } |
| 234 |
| 222 public boolean optOut() { | 235 public boolean optOut() { |
| 223 boolean optOut = false; | 236 boolean optOut = false; |
| 224 for (int i = 0; i < mAccessors.size() && !optOut; i++) { | 237 for (int i = 0; i < mAccessors.size() && !optOut; i++) { |
| 225 optOut = mAccessors.get(i).optOut(); | 238 optOut = mAccessors.get(i).optOut(); |
| 226 } | 239 } |
| 227 return optOut; | 240 return optOut; |
| 228 } | 241 } |
| 229 | 242 |
| 230 public DomDistillerProtos.MarkupInfo getMarkupInfo() { | 243 public DomDistillerProtos.MarkupInfo getMarkupInfo() { |
| 231 DomDistillerProtos.MarkupInfo info = DomDistillerProtos.MarkupInfo.creat
e(); | 244 DomDistillerProtos.MarkupInfo info = DomDistillerProtos.MarkupInfo.creat
e(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 261 imageInfo.setSecureUrl(image.secureUrl); | 274 imageInfo.setSecureUrl(image.secureUrl); |
| 262 imageInfo.setType(image.type); | 275 imageInfo.setType(image.type); |
| 263 imageInfo.setCaption(image.caption); | 276 imageInfo.setCaption(image.caption); |
| 264 imageInfo.setWidth(image.width); | 277 imageInfo.setWidth(image.width); |
| 265 imageInfo.setHeight(image.height); | 278 imageInfo.setHeight(image.height); |
| 266 } | 279 } |
| 267 | 280 |
| 268 return info; | 281 return info; |
| 269 } | 282 } |
| 270 } | 283 } |
| OLD | NEW |