| OLD | NEW |
| 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/chromeos/input_method/input_method_engine.h" | 9 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
| 10 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 10 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 input_ime::OnMenuItemActivated::Create(component_id, menu_id)); | 258 input_ime::OnMenuItemActivated::Create(component_id, menu_id)); |
| 259 | 259 |
| 260 DispatchEventToExtension( | 260 DispatchEventToExtension( |
| 261 extensions::events::INPUT_IME_ON_MENU_ITEM_ACTIVATED, | 261 extensions::events::INPUT_IME_ON_MENU_ITEM_ACTIVATED, |
| 262 input_ime::OnMenuItemActivated::kEventName, args.Pass()); | 262 input_ime::OnMenuItemActivated::kEventName, args.Pass()); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void OnSurroundingTextChanged(const std::string& component_id, | 265 void OnSurroundingTextChanged(const std::string& component_id, |
| 266 const std::string& text, | 266 const std::string& text, |
| 267 int cursor_pos, | 267 int cursor_pos, |
| 268 int anchor_pos) override { | 268 int anchor_pos, |
| 269 int offset_pos) override { |
| 269 if (extension_id_.empty() || | 270 if (extension_id_.empty() || |
| 270 !HasListener(input_ime::OnSurroundingTextChanged::kEventName)) | 271 !HasListener(input_ime::OnSurroundingTextChanged::kEventName)) |
| 271 return; | 272 return; |
| 272 | 273 |
| 273 input_ime::OnSurroundingTextChanged::SurroundingInfo info; | 274 input_ime::OnSurroundingTextChanged::SurroundingInfo info; |
| 274 info.text = text; | 275 info.text = text; |
| 275 info.focus = cursor_pos; | 276 info.focus = cursor_pos; |
| 276 info.anchor = anchor_pos; | 277 info.anchor = anchor_pos; |
| 278 info.offset = offset_pos; |
| 277 scoped_ptr<base::ListValue> args( | 279 scoped_ptr<base::ListValue> args( |
| 278 input_ime::OnSurroundingTextChanged::Create(component_id, info)); | 280 input_ime::OnSurroundingTextChanged::Create(component_id, info)); |
| 279 | 281 |
| 280 DispatchEventToExtension( | 282 DispatchEventToExtension( |
| 281 extensions::events::INPUT_IME_ON_SURROUNDING_TEXT_CHANGED, | 283 extensions::events::INPUT_IME_ON_SURROUNDING_TEXT_CHANGED, |
| 282 input_ime::OnSurroundingTextChanged::kEventName, args.Pass()); | 284 input_ime::OnSurroundingTextChanged::kEventName, args.Pass()); |
| 283 } | 285 } |
| 284 | 286 |
| 285 void OnCompositionBoundsChanged( | 287 void OnCompositionBoundsChanged( |
| 286 const std::vector<gfx::Rect>& bounds) override { | 288 const std::vector<gfx::Rect>& bounds) override { |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 InputMethodEngineInterface* engine = | 953 InputMethodEngineInterface* engine = |
| 952 GetInputImeEventRouter( | 954 GetInputImeEventRouter( |
| 953 Profile::FromBrowserContext(details.browser_context)) | 955 Profile::FromBrowserContext(details.browser_context)) |
| 954 ->GetActiveEngine(details.extension_id); | 956 ->GetActiveEngine(details.extension_id); |
| 955 // Notifies the IME extension for IME ready with onActivate/onFocus events. | 957 // Notifies the IME extension for IME ready with onActivate/onFocus events. |
| 956 if (engine) | 958 if (engine) |
| 957 engine->Enable(engine->GetActiveComponentId()); | 959 engine->Enable(engine->GetActiveComponentId()); |
| 958 } | 960 } |
| 959 | 961 |
| 960 } // namespace extensions | 962 } // namespace extensions |
| OLD | NEW |