OLD | NEW |
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_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/extensions/key_identifier_conversion_views.h" | 12 #include "chrome/browser/extensions/key_identifier_conversion_views.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/views/frame/browser_view.h" | 15 #include "chrome/browser/ui/views/frame/browser_view.h" |
16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
17 #include "views/events/event.h" | 17 #include "views/events/event.h" |
18 #include "views/ime/input_method.h" | 18 #include "views/ime/input_method.h" |
19 #include "views/views_delegate.h" | 19 #include "views/views_delegate.h" |
20 #include "views/widget/widget.h" | 20 #include "views/widget/widget.h" |
21 | 21 |
22 #if defined(USE_VIRTUAL_KEYBOARD) | 22 #if defined(USE_VIRTUAL_KEYBOARD) |
23 #include "content/common/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
24 #endif | 24 #endif |
25 | 25 |
26 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) | 26 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
27 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 27 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
28 #include "chrome/browser/chromeos/input_method/ibus_controller.h" | 28 #include "chrome/browser/chromeos/input_method/ibus_controller.h" |
29 #include "chrome/browser/chromeos/login/webui_login_display.h" | 29 #include "chrome/browser/chromeos/login/webui_login_display.h" |
30 #endif | 30 #endif |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } else if (!widget->OnKeyEvent(event)) { | 159 } else if (!widget->OnKeyEvent(event)) { |
160 error_ = kKeyEventUnprocessedError; | 160 error_ = kKeyEventUnprocessedError; |
161 return false; | 161 return false; |
162 } | 162 } |
163 | 163 |
164 return true; | 164 return true; |
165 } | 165 } |
166 | 166 |
167 #if defined(USE_VIRTUAL_KEYBOARD) | 167 #if defined(USE_VIRTUAL_KEYBOARD) |
168 bool HideKeyboardFunction::RunImpl() { | 168 bool HideKeyboardFunction::RunImpl() { |
169 NotificationService::current()->Notify( | 169 content::NotificationService::current()->Notify( |
170 chrome::NOTIFICATION_HIDE_KEYBOARD_INVOKED, | 170 chrome::NOTIFICATION_HIDE_KEYBOARD_INVOKED, |
171 content::Source<HideKeyboardFunction>(this), | 171 content::Source<HideKeyboardFunction>(this), |
172 NotificationService::NoDetails()); | 172 content::NotificationService::NoDetails()); |
173 return true; | 173 return true; |
174 } | 174 } |
175 | 175 |
176 bool SetKeyboardHeightFunction::RunImpl() { | 176 bool SetKeyboardHeightFunction::RunImpl() { |
177 int height = 0; | 177 int height = 0; |
178 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &height)); | 178 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &height)); |
179 | 179 |
180 if (height < 0) { | 180 if (height < 0) { |
181 error_ = kInvalidHeight; | 181 error_ = kInvalidHeight; |
182 return false; | 182 return false; |
183 } | 183 } |
184 | 184 |
185 // TODO(penghuang) Check the height is not greater than height of browser view | 185 // TODO(penghuang) Check the height is not greater than height of browser view |
186 // and set the height of virtual keyboard directly instead of using | 186 // and set the height of virtual keyboard directly instead of using |
187 // notification. | 187 // notification. |
188 NotificationService::current()->Notify( | 188 content::NotificationService::current()->Notify( |
189 chrome::NOTIFICATION_SET_KEYBOARD_HEIGHT_INVOKED, | 189 chrome::NOTIFICATION_SET_KEYBOARD_HEIGHT_INVOKED, |
190 content::Source<SetKeyboardHeightFunction>(this), | 190 content::Source<SetKeyboardHeightFunction>(this), |
191 content::Details<int>(&height)); | 191 content::Details<int>(&height)); |
192 return true; | 192 return true; |
193 } | 193 } |
194 #endif | 194 #endif |
195 | 195 |
196 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) | 196 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
197 // TODO(yusukes): This part should be moved to extension_input_api_chromeos.cc. | 197 // TODO(yusukes): This part should be moved to extension_input_api_chromeos.cc. |
198 bool SendHandwritingStrokeFunction::RunImpl() { | 198 bool SendHandwritingStrokeFunction::RunImpl() { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 int stroke_count = 0; // zero means 'clear all strokes'. | 235 int stroke_count = 0; // zero means 'clear all strokes'. |
236 if (HasOptionalArgument(0)) { | 236 if (HasOptionalArgument(0)) { |
237 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &stroke_count)); | 237 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &stroke_count)); |
238 EXTENSION_FUNCTION_VALIDATE(stroke_count >= 0); | 238 EXTENSION_FUNCTION_VALIDATE(stroke_count >= 0); |
239 } | 239 } |
240 chromeos::input_method::InputMethodManager::GetInstance()-> | 240 chromeos::input_method::InputMethodManager::GetInstance()-> |
241 CancelHandwritingStrokes(stroke_count); | 241 CancelHandwritingStrokes(stroke_count); |
242 return true; | 242 return true; |
243 } | 243 } |
244 #endif | 244 #endif |
OLD | NEW |