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

Side by Side Diff: chrome/browser/extensions/extension_input_api.cc

Issue 6675005: Integrate the new input method API for Views into Chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows build. Created 9 years, 8 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_input_api.h" 5 #include "chrome/browser/extensions/extension_input_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/browser_window.h" 11 #include "chrome/browser/browser_window.h"
12 #include "chrome/browser/extensions/extension_tabs_module.h" 12 #include "chrome/browser/extensions/extension_tabs_module.h"
13 #include "chrome/browser/extensions/key_identifier_conversion_views.h" 13 #include "chrome/browser/extensions/key_identifier_conversion_views.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/views/frame/browser_view.h" 15 #include "chrome/browser/ui/views/frame/browser_view.h"
16 #include "content/browser/renderer_host/render_view_host.h" 16 #include "content/browser/renderer_host/render_view_host.h"
17 #include "content/common/native_web_keyboard_event.h" 17 #include "content/common/native_web_keyboard_event.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
19 #include "views/events/event.h" 19 #include "views/events/event.h"
20 #include "views/ime/input_method.h"
21 #include "views/widget/widget.h"
20 #include "views/widget/root_view.h" 22 #include "views/widget/root_view.h"
21 23
22 namespace { 24 namespace {
23 25
24 // Keys. 26 // Keys.
25 const char kType[] = "type"; 27 const char kType[] = "type";
26 const char kKeyIdentifier[] = "keyIdentifier"; 28 const char kKeyIdentifier[] = "keyIdentifier";
27 const char kAlt[] = "altKey"; 29 const char kAlt[] = "altKey";
28 const char kCtrl[] = "ctrlKey"; 30 const char kCtrl[] = "ctrlKey";
29 const char kMeta[] = "metaKey"; 31 const char kMeta[] = "metaKey";
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 115 }
114 } 116 }
115 117
116 views::RootView* root_view = GetRootView(); 118 views::RootView* root_view = GetRootView();
117 if (!root_view) { 119 if (!root_view) {
118 error_ = kNoValidRecipientError; 120 error_ = kNoValidRecipientError;
119 return false; 121 return false;
120 } 122 }
121 123
122 views::KeyEvent event(type, prototype_event.key_code(), flags); 124 views::KeyEvent event(type, prototype_event.key_code(), flags);
123 if (!root_view->ProcessKeyEvent(event)) { 125 views::InputMethod* ime = root_view->GetWidget()->GetInputMethod();
126 if (ime) {
127 ime->DispatchKeyEvent(event);
128 } else if (!root_view->ProcessKeyEvent(event)) {
124 error_ = kKeyEventUnprocessedError; 129 error_ = kKeyEventUnprocessedError;
125 return false; 130 return false;
126 } 131 }
127 132
128 return true; 133 return true;
129 } 134 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/registration_screen.cc ('k') | chrome/browser/ui/views/find_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698