Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4269)

Unified Diff: chrome/browser/resources/chromeos/chromevox/host/chrome/braille_background.js

Issue 1039703002: Make contracted braille input work in more contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@docs2
Patch Set: Rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/common/spannable.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/host/chrome/braille_background.js
diff --git a/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_background.js b/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_background.js
index 9183a7b12fa12e2a6c775d8e9c52e5eea1f6863e..bea96b5b0061563d188f33f75d08592a333b5994 100644
--- a/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_background.js
+++ b/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_background.js
@@ -64,11 +64,7 @@ goog.inherits(cvox.BrailleBackground, cvox.AbstractBraille);
/** @override */
cvox.BrailleBackground.prototype.write = function(params) {
- this.lastContentId_ = null;
- this.lastContent_ = null;
- this.inputHandler_.onDisplayContentChanged(params.text);
- this.displayManager_.setContent(
- params, this.inputHandler_.getExpansionType());
+ this.setContent_(params, null);
};
@@ -94,16 +90,31 @@ cvox.BrailleBackground.prototype.getTranslatorManager = function() {
*/
cvox.BrailleBackground.prototype.onBrailleMessage = function(msg) {
if (msg['action'] == 'write') {
- this.lastContentId_ = msg['contentId'];
- this.lastContent_ = cvox.NavBraille.fromJson(msg['params']);
- this.inputHandler_.onDisplayContentChanged(this.lastContent_.text);
- this.displayManager_.setContent(
- this.lastContent_, this.inputHandler_.getExpansionType());
+ this.setContent_(cvox.NavBraille.fromJson(msg['params']),
+ msg['contentId']);
}
};
/**
+ * @param {!cvox.NavBraille} newContent
+ * @param {?string} newContentId
+ * @private
+ */
+cvox.BrailleBackground.prototype.setContent_ = function(
+ newContent, newContentId) {
+ var updateContent = function() {
+ this.lastContent_ = newContentId ? newContent : null;
+ this.lastContentId_ = newContentId;
+ this.displayManager_.setContent(
+ newContent, this.inputHandler_.getExpansionType());
+ }.bind(this);
+ this.inputHandler_.onDisplayContentChanged(newContent.text, updateContent);
+ updateContent();
+};
+
+
+/**
* Handles braille key events by dispatching either to the input handler or
* a content script.
* @param {!cvox.BrailleKeyEvent} brailleEvt The event.
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/common/spannable.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698