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 com.dom_distiller.client; | 5 package com.dom_distiller.client; |
6 | 6 |
7 import java.util.ArrayList; | 7 import java.util.ArrayList; |
8 import java.util.List; | 8 import java.util.List; |
9 | 9 |
10 import com.google.gwt.dom.client.Element; | 10 import com.google.gwt.dom.client.Element; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 /** | 136 /** |
137 * The object that loads the different parsers, and retrieves requested info
rmation from one or | 137 * The object that loads the different parsers, and retrieves requested info
rmation from one or |
138 * more of the parsers. | 138 * more of the parsers. |
139 */ | 139 */ |
140 public MarkupParser(Element root) { | 140 public MarkupParser(Element root) { |
141 mParsers = new ArrayList<Parser>(); | 141 mParsers = new ArrayList<Parser>(); |
142 | 142 |
143 Parser ogp = OpenGraphProtocolParser.parse(root); | 143 Parser ogp = OpenGraphProtocolParser.parse(root); |
144 if (ogp != null) mParsers.add(ogp); | 144 if (ogp != null) mParsers.add(ogp); |
145 Parser ie = new IEReadingViewParser(root); | 145 mParsers.add(new SchemaOrgParserAccessor(root)); |
146 if (ie != null) mParsers.add(ie); | 146 mParsers.add(new IEReadingViewParser(root)); |
147 } | 147 } |
148 | 148 |
149 public String getTitle() { | 149 public String getTitle() { |
150 String title = null; | 150 String title = null; |
151 for (int i = 0; i < mParsers.size(); i++) { | 151 for (int i = 0; i < mParsers.size(); i++) { |
152 title = mParsers.get(i).getTitle(); | 152 title = mParsers.get(i).getTitle(); |
153 if (title != null && !title.isEmpty()) break; | 153 if (title != null && !title.isEmpty()) break; |
154 } | 154 } |
155 return title; | 155 return title; |
156 } | 156 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 220 |
221 public Article getArticle() { | 221 public Article getArticle() { |
222 Article article = null; | 222 Article article = null; |
223 for (int i = 0; i < mParsers.size(); i++) { | 223 for (int i = 0; i < mParsers.size(); i++) { |
224 article = mParsers.get(i).getArticle(); | 224 article = mParsers.get(i).getArticle(); |
225 if (article != null) break; | 225 if (article != null) break; |
226 } | 226 } |
227 return article; | 227 return article; |
228 } | 228 } |
229 } | 229 } |
OLD | NEW |