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

Side by Side Diff: chrome/browser/extensions/api/input_ime/input_ime_api.cc

Issue 162973002: [IME] Releases key events to default handler if no handler in the active IME extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 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 | « no previous file | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/api/input_ime/input_ime_api.h" 5 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/chromeos/input_method/input_method_engine.h" 10 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 args.Pass()); 157 args.Pass());
158 } 158 }
159 159
160 virtual void OnKeyEvent( 160 virtual void OnKeyEvent(
161 const std::string& engine_id, 161 const std::string& engine_id,
162 const InputMethodEngineInterface::KeyboardEvent& event, 162 const InputMethodEngineInterface::KeyboardEvent& event,
163 chromeos::input_method::KeyEventHandle* key_data) OVERRIDE { 163 chromeos::input_method::KeyEventHandle* key_data) OVERRIDE {
164 if (profile_ == NULL || extension_id_.empty()) 164 if (profile_ == NULL || extension_id_.empty())
165 return; 165 return;
166 166
167 if (!extensions::ExtensionSystem::Get(profile_)
Hiro Komatsu 2014/02/13 09:39:50 Please add a comment above this block.
Shu Chen 2014/02/13 13:13:41 Done.
168 ->event_router()
169 ->ExtensionHasEventListener(extension_id_,
170 input_ime::OnKeyEvent::kEventName)) {
171 InputMethodEngineInterface* engine =
Hiro Komatsu 2014/02/13 09:39:50 How about calling InputImeEventRouter::OnKeyEventH
Shu Chen 2014/02/13 13:13:41 I had thought about it. To use InputImeEventRouter
Hiro Komatsu 2014/02/14 05:04:06 I see the point. Since AddRequest is not so expen
172 extensions::InputImeEventRouter::GetInstance()->GetActiveEngine(
173 extension_id_);
174 if (engine)
175 engine->KeyEventDone(key_data, false);
176 return;
177 }
178
167 std::string request_id = 179 std::string request_id =
168 extensions::InputImeEventRouter::GetInstance()->AddRequest(engine_id, 180 extensions::InputImeEventRouter::GetInstance()->AddRequest(engine_id,
169 key_data); 181 key_data);
170 182
171 input_ime::KeyboardEvent key_data_value; 183 input_ime::KeyboardEvent key_data_value;
172 key_data_value.type = input_ime::KeyboardEvent::ParseType(event.type); 184 key_data_value.type = input_ime::KeyboardEvent::ParseType(event.type);
173 key_data_value.request_id = request_id; 185 key_data_value.request_id = request_id;
174 key_data_value.key = event.key; 186 key_data_value.key = event.key;
175 key_data_value.code = event.code; 187 key_data_value.code = event.code;
176 key_data_value.alt_key.reset(new bool(event.alt_key)); 188 key_data_value.alt_key.reset(new bool(event.alt_key));
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 if (input_components->size() > 0) 819 if (input_components->size() > 0)
808 input_ime_event_router()->UnregisterAllImes(profile_, extension->id()); 820 input_ime_event_router()->UnregisterAllImes(profile_, extension->id());
809 } 821 }
810 } 822 }
811 823
812 InputImeEventRouter* InputImeAPI::input_ime_event_router() { 824 InputImeEventRouter* InputImeAPI::input_ime_event_router() {
813 return InputImeEventRouter::GetInstance(); 825 return InputImeEventRouter::GetInstance();
814 } 826 }
815 827
816 } // namespace extensions 828 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698