Chromium Code Reviews| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/chromevox_state.js |
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/chromevox_state.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/chromevox_state.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4fa0afdb673cf956324c8fc4579d38fccc43b0da |
| --- /dev/null |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/chromevox_state.js |
| @@ -0,0 +1,73 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview An interface for querying and modifying the global |
| + * ChromeVox state, to avoid direct dependencies on the Background |
| + * object and to facilitate mocking for tests. |
| + */ |
| + |
| +goog.provide('ChromeVoxMode'); |
| +goog.provide('ChromeVoxState'); |
| + |
| +goog.require('cursors.Cursor'); |
| + |
| +/** |
| + * All possible modes ChromeVox can run. |
| + * @enum {string} |
| + */ |
| +ChromeVoxMode = { |
| + CLASSIC: 'classic', |
| + COMPAT: 'compat', |
| + NEXT: 'next', |
| + FORCE_NEXT: 'force_next' |
| +}; |
| + |
| +/** |
| + * ChromeVox2 state object. |
| + * @constructor |
| + */ |
| +ChromeVoxState = function() { |
| +}; |
| + |
| +ChromeVoxState.prototype = { |
| + /** @type {ChromeVoxMode} */ |
| + get mode() { |
| + return this.getMode(); |
| + }, |
| + |
| + /** |
| + * @return {ChromeVoxMode} The current mode. |
| + */ |
| + getMode: function() { |
| + return ChromeVoxMode.NEXT; |
| + }, |
| + |
| + /** |
| + * Sets the current ChromeVox mode. |
| + * @param {ChromeVoxMode} mode |
| + * @param {boolean=} opt_injectClassic Injects ChromeVox classic into tabs; |
| + * defaults to false. |
| + */ |
| + setMode: function(mode, opt_injectClassic) { |
| + }, |
| + |
| + /** @type {cursors.Range} */ |
| + get currentRange() { |
| + return this.getCurrentRange(); |
| + }, |
| + |
| + /** |
| + * @return {cursors.Range} The current range. |
| + */ |
| + getCurrentRange: function() { |
|
Peter Lundblad
2015/11/24 11:04:31
Perhaps make the get* methods private to enforce c
dmazzoni
2015/11/30 22:00:47
Done.
|
| + return null; |
| + }, |
| + |
| + /** |
| + * @param {cursors.Range} newRange The new range. |
| + */ |
| + setCurrentRange: function(newRange) { |
|
Peter Lundblad
2015/11/24 11:04:31
How about making all these 'stub' methods goog.abs
dmazzoni
2015/11/30 22:00:47
Done.
dmazzoni
2015/12/01 08:19:47
Hmmm, I tried this but got weird errors because th
|
| + }, |
| +}; |