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

Side by Side Diff: ui/keyboard/keyboard_ui_handler.cc

Issue 20526005: Implement virtual keyboard hiding. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Init Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "ui/keyboard/keyboard_ui_handler.h" 5 #include "ui/keyboard/keyboard_ui_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "content/public/browser/web_contents_view.h" 13 #include "content/public/browser/web_contents_view.h"
14 #include "content/public/browser/web_ui.h" 14 #include "content/public/browser/web_ui.h"
15 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
16 #include "ui/keyboard/keyboard_controller.h"
16 #include "ui/keyboard/keyboard_util.h" 17 #include "ui/keyboard/keyboard_util.h"
17 18
18 namespace keyboard { 19 namespace keyboard {
19 20
20 KeyboardUIHandler::KeyboardUIHandler() { 21 KeyboardUIHandler::KeyboardUIHandler() {
21 } 22 }
22 23
23 KeyboardUIHandler::~KeyboardUIHandler() { 24 KeyboardUIHandler::~KeyboardUIHandler() {
24 } 25 }
25 26
26 void KeyboardUIHandler::RegisterMessages() { 27 void KeyboardUIHandler::RegisterMessages() {
27 web_ui()->RegisterMessageCallback( 28 web_ui()->RegisterMessageCallback(
28 "insertText", 29 "insertText",
29 base::Bind(&KeyboardUIHandler::HandleInsertTextMessage, 30 base::Bind(&KeyboardUIHandler::HandleInsertTextMessage,
30 base::Unretained(this))); 31 base::Unretained(this)));
32 web_ui()->RegisterMessageCallback(
33 "hideKeyboard",
34 base::Bind(&KeyboardUIHandler::HandleHideKeyboard,
35 base::Unretained(this)));
31 } 36 }
32 37
33 void KeyboardUIHandler::HandleInsertTextMessage(const base::ListValue* args) { 38 void KeyboardUIHandler::HandleInsertTextMessage(const base::ListValue* args) {
34 string16 text; 39 string16 text;
35 if (!args->GetString(0, &text)) { 40 if (!args->GetString(0, &text)) {
36 LOG(ERROR) << "insertText failed: bad argument"; 41 LOG(ERROR) << "insertText failed: bad argument";
37 return; 42 return;
38 } 43 }
39 44
40 aura::RootWindow* root_window = 45 aura::RootWindow* root_window =
41 web_ui()->GetWebContents()->GetView()->GetNativeView()->GetRootWindow(); 46 web_ui()->GetWebContents()->GetView()->GetNativeView()->GetRootWindow();
42 if (!root_window) { 47 if (!root_window) {
43 LOG(ERROR) << "insertText failed: no root window"; 48 LOG(ERROR) << "insertText failed: no root window";
44 return; 49 return;
45 } 50 }
46 51
47 if (!keyboard::InsertText(text, root_window)) 52 if (!keyboard::InsertText(text, root_window))
48 LOG(ERROR) << "insertText failed"; 53 LOG(ERROR) << "insertText failed";
49 } 54 }
50 55
56 void KeyboardUIHandler::HandleHideKeyboard(const base::ListValue* args) {
57 // TODO(stevet): Call into the keyboard controller to hide the keyboard
58 // directly.
SteveT 2013/07/31 03:19:18 Looks like I encountered the same problem as you,
59 return;
60 }
61
51 } // namespace keyboard 62 } // namespace keyboard
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698