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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/braille/liblouis.js

Issue 917793003: Actual fix for braille translation initialization race. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/braille/braille_translator_manager.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * @fileoverview JavaScript shim for the liblouis Native Client wrapper. 6 * @fileoverview JavaScript shim for the liblouis Native Client wrapper.
7 */ 7 */
8 8
9 goog.provide('cvox.LibLouis'); 9 goog.provide('cvox.LibLouis');
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 if (!goog.isNull(this.tablesDir_)) { 93 if (!goog.isNull(this.tablesDir_)) {
94 embed.setAttribute('tablesdir', this.tablesDir_); 94 embed.setAttribute('tablesdir', this.tablesDir_);
95 } 95 }
96 embed.addEventListener('load', goog.bind(this.onInstanceLoad_, this), 96 embed.addEventListener('load', goog.bind(this.onInstanceLoad_, this),
97 false /* useCapture */); 97 false /* useCapture */);
98 embed.addEventListener('error', goog.bind(this.onInstanceError_, this), 98 embed.addEventListener('error', goog.bind(this.onInstanceError_, this),
99 false /* useCapture */); 99 false /* useCapture */);
100 embed.addEventListener('message', goog.bind(this.onInstanceMessage_, this), 100 embed.addEventListener('message', goog.bind(this.onInstanceMessage_, this),
101 false /* useCapture */); 101 false /* useCapture */);
102 elem.appendChild(embed); 102 elem.appendChild(embed);
103 // TODO(plundblad): Remove when the real cause of crbug.com/455889
104 // is fixed. Sending this empty message will cause the nacl component
105 // to load and fire the load event properly.
106 embed.postMessage('{}');
107
108 this.embedElement_ = /** @type {!HTMLEmbedElement} */ (embed); 103 this.embedElement_ = /** @type {!HTMLEmbedElement} */ (embed);
109 this.instanceState_ = cvox.LibLouis.InstanceState.LOADING; 104 this.instanceState_ = cvox.LibLouis.InstanceState.LOADING;
110 }; 105 };
111 106
112 107
113 /** 108 /**
114 * Detaches the Native Client instance from the DOM. 109 * Detaches the Native Client instance from the DOM.
115 */ 110 */
116 cvox.LibLouis.prototype.detach = function() { 111 cvox.LibLouis.prototype.detach = function() {
117 if (!this.isAttached()) { 112 if (!this.isAttached()) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 */ 355 */
361 cvox.LibLouis.Translator.encodeHexString_ = function(arrayBuffer) { 356 cvox.LibLouis.Translator.encodeHexString_ = function(arrayBuffer) {
362 var array = new Uint8Array(arrayBuffer); 357 var array = new Uint8Array(arrayBuffer);
363 var hex = ''; 358 var hex = '';
364 for (var i = 0; i < array.length; i++) { 359 for (var i = 0; i < array.length; i++) {
365 var b = array[i]; 360 var b = array[i];
366 hex += (b < 0x10 ? '0' : '') + b.toString(16); 361 hex += (b < 0x10 ? '0' : '') + b.toString(16);
367 } 362 }
368 return hex; 363 return hex;
369 }; 364 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/braille/braille_translator_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698