[Extensions] Make extension message bubble factory platform-abstract
[chromium-blink-merge.git] / chrome / browser / resources / chromeos / chromevox / braille / spans.js
blob560fa0fca67901cde043daf056cd42a409477015
1 // Copyright 2015 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.
5 /**
6 * @fileoverview Objects used in spannables as annotations for ARIA values
7 * and selections.
8 */
10 goog.provide('cvox.ValueSelectionSpan');
11 goog.provide('cvox.ValueSpan');
13 goog.require('cvox.Spannable');
15 /**
16 * Attached to the value region of a braille spannable.
17 * @param {number} offset The offset of the span into the value.
18 * @constructor
20 cvox.ValueSpan = function(offset) {
21 /**
22 * The offset of the span into the value.
23 * @type {number}
25 this.offset = offset;
29 /**
30 * Creates a value span from a json serializable object.
31 * @param {!Object} obj The json serializable object to convert.
32 * @return {!cvox.ValueSpan} The value span.
34 cvox.ValueSpan.fromJson = function(obj) {
35 return new cvox.ValueSpan(obj.offset);
39 /**
40 * Converts this object to a json serializable object.
41 * @return {!Object} The JSON representation.
43 cvox.ValueSpan.prototype.toJson = function() {
44 return this;
48 cvox.Spannable.registerSerializableSpan(
49 cvox.ValueSpan,
50 'cvox.ValueSpan',
51 cvox.ValueSpan.fromJson,
52 cvox.ValueSpan.prototype.toJson);
55 /**
56 * Attached to the selected text within a value.
57 * @constructor
59 cvox.ValueSelectionSpan = function() {
63 cvox.Spannable.registerStatelessSerializableSpan(
64 cvox.ValueSelectionSpan,
65 'cvox.ValueSelectionSpan');