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

Side by Side Diff: ui/keyboard/resources/keyboard_mojo.js

Issue 328303008: athena: Use mojo to provide the bindings for the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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 var connection;
5 var mojo_api;
6 var input_focused_event;
7
8 if (!chrome.virtualKeyboardPrivate) {
9 define('main', [
10 'mojo/public/js/bindings/connection',
11 'ui/keyboard/webui/keyboard.mojom',
Sam McNally 2014/06/26 11:04:40 You'll need to depend on 'content/public/renderer/
sadrul 2014/08/01 22:41:47 Done.
12 ], function(connector, keyboard) {
13 'use strict';
14 function KeyboardImpl(kbd) {
15 console.log('Creating KeyboardImpl');
16 this.keyboard_ = kbd;
17 mojo_api = this;
18 }
19
20 KeyboardImpl.prototype = Object.create(keyboard.KeyboardAPIStub.prototype);
21
22 KeyboardImpl.prototype.onTextInputTypeChanged = function(input_type) {
23 console.log('Text input changed: ' + input_type);
24 input_focused_event.forEach(function(listener) {
25 listener({type: input_type});
26 });
27 };
28
29 return function(handle) {
Sam McNally 2014/06/26 11:04:40 The caller will no longer pass in the handle. You'
sadrul 2014/08/01 22:41:47 Done.
30 connection = connector.Connection(handle, KeyboardImpl,
31 keyboard.KeyboardUIHandlerMojoProxy);
32 };
33 });
34
35 chrome.virtualKeyboardPrivate = {};
36 chrome.virtualKeyboardPrivate.sendKeyEvent = function(event) {
37 if (!mojo_api)
38 return;
39 console.log('sending key event: ' + event.type);
40 mojo_api.keyboard_.sendKeyEvent(event.type,
41 event.charValue,
42 event.keyCode,
43 event.keyName,
44 event.modifiers);
45 };
46 chrome.virtualKeyboardPrivate.hideKeyboard = function() {
47 if (!mojo_api)
48 return;
49 mojo_api.keyboard_.hideKeyboard();
50 };
51 chrome.virtualKeyboardPrivate.moveCursor = function() {};
52 chrome.virtualKeyboardPrivate.lockKeyboard = function() {};
53 chrome.virtualKeyboardPrivate.keyboardLoaded = function() {};
54 chrome.virtualKeyboardPrivate.getKeyboardConfig = function() {};
55
56 function BrowserEvent() {
57 this.listeners_ = [];
58 };
59
60 BrowserEvent.prototype.addListener = function(callback) {
61 this.listeners_.push(callback);
62 };
63
64 BrowserEvent.prototype.forEach = function(callback) {
65 for (var i = 0; i < this.listeners_.length; ++i)
66 callback(this.listeners_[i]);
67 };
68
69 input_focused_event = new BrowserEvent;
70 chrome.virtualKeyboardPrivate.onTextInputBoxFocused = input_focused_event;
71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698