| 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_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 error_ = kKeyEventUnprocessedError; | 130 error_ = kKeyEventUnprocessedError; |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 | 133 |
| 134 return true; | 134 return true; |
| 135 } | 135 } |
| 136 | 136 |
| 137 #if defined(TOUCH_UI) | 137 #if defined(TOUCH_UI) |
| 138 bool HideKeyboardFunction::RunImpl() { | 138 bool HideKeyboardFunction::RunImpl() { |
| 139 NotificationService::current()->Notify( | 139 NotificationService::current()->Notify( |
| 140 NotificationType::HIDE_KEYBOARD_INVOKED, | 140 chrome::HIDE_KEYBOARD_INVOKED, |
| 141 Source<HideKeyboardFunction>(this), | 141 Source<HideKeyboardFunction>(this), |
| 142 NotificationService::NoDetails()); | 142 NotificationService::NoDetails()); |
| 143 return true; | 143 return true; |
| 144 } | 144 } |
| 145 | 145 |
| 146 bool SetKeyboardHeightFunction::RunImpl() { | 146 bool SetKeyboardHeightFunction::RunImpl() { |
| 147 int height = 0; | 147 int height = 0; |
| 148 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &height)); | 148 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &height)); |
| 149 | 149 |
| 150 if (height < 0) { | 150 if (height < 0) { |
| 151 error_ = kInvalidHeight; | 151 error_ = kInvalidHeight; |
| 152 return false; | 152 return false; |
| 153 } | 153 } |
| 154 | 154 |
| 155 // TODO(penghuang) Check the height is not greater than height of browser view | 155 // TODO(penghuang) Check the height is not greater than height of browser view |
| 156 // and set the height of virtual keyboard directly instead of using | 156 // and set the height of virtual keyboard directly instead of using |
| 157 // notification. | 157 // notification. |
| 158 NotificationService::current()->Notify( | 158 NotificationService::current()->Notify( |
| 159 NotificationType::SET_KEYBOARD_HEIGHT_INVOKED, | 159 chrome::SET_KEYBOARD_HEIGHT_INVOKED, |
| 160 Source<SetKeyboardHeightFunction>(this), | 160 Source<SetKeyboardHeightFunction>(this), |
| 161 Details<int>(&height)); | 161 Details<int>(&height)); |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| 164 #endif | 164 #endif |
| 165 | 165 |
| 166 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) | 166 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
| 167 // TODO(yusukes): This part should be moved to extension_input_api_chromeos.cc. | 167 // TODO(yusukes): This part should be moved to extension_input_api_chromeos.cc. |
| 168 bool SendHandwritingStrokeFunction::RunImpl() { | 168 bool SendHandwritingStrokeFunction::RunImpl() { |
| 169 // TODO(yusukes): Add a parameter for an input context ID. | 169 // TODO(yusukes): Add a parameter for an input context ID. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 190 int stroke_count = 0; // zero means 'clear all strokes'. | 190 int stroke_count = 0; // zero means 'clear all strokes'. |
| 191 if (HasOptionalArgument(0)) { | 191 if (HasOptionalArgument(0)) { |
| 192 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &stroke_count)); | 192 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &stroke_count)); |
| 193 EXTENSION_FUNCTION_VALIDATE(stroke_count >= 0); | 193 EXTENSION_FUNCTION_VALIDATE(stroke_count >= 0); |
| 194 } | 194 } |
| 195 chromeos::input_method::InputMethodManager::GetInstance()-> | 195 chromeos::input_method::InputMethodManager::GetInstance()-> |
| 196 CancelHandwritingStrokes(stroke_count); | 196 CancelHandwritingStrokes(stroke_count); |
| 197 return true; | 197 return true; |
| 198 } | 198 } |
| 199 #endif | 199 #endif |
| OLD | NEW |