abstract_result.js revision cedac228d2dd51db4b79ea1e72c7f249408ee061
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 3// found in the LICENSE file. 4 5 6/** 7 * @fileoverview Defines a result type interface. 8 */ 9 10goog.provide('cvox.AbstractResult'); 11 12goog.require('cvox.SearchUtil'); 13 14/** 15 * @constructor 16 */ 17cvox.AbstractResult = function() { }; 18 19/** 20 * Checks the result if it is an unknown result. 21 * @param {Element} result Result to be checked. 22 * @return {boolean} Whether or not the element is an unknown result. 23 */ 24cvox.AbstractResult.prototype.isType = function(result) { 25 return false; 26}; 27 28/** 29 * Speak a generic search result. 30 * @param {Element} result Generic result to be spoken. 31 * @return {boolean} Whether or not the result was spoken. 32 */ 33cvox.AbstractResult.prototype.speak = function(result) { 34 return false; 35}; 36 37/** 38 * Extracts the wikipedia URL from knowledge panel. 39 * @param {Element} result Result to extract from. 40 * @return {?string} URL. 41 */ 42cvox.AbstractResult.prototype.getURL = cvox.SearchUtil.extractURL; 43 44/** 45 * Returns the node to sync to. 46 * @param {Element} result Result. 47 * @return {?Node} Node to sync to. 48 */ 49cvox.AbstractResult.prototype.getSyncNode = function(result) { 50 return result; 51}; 52