| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 if (bounds_list->GetSize() <= 0) | 175 if (bounds_list->GetSize() <= 0) |
| 176 return; | 176 return; |
| 177 std::unique_ptr<base::ListValue> args(new base::ListValue()); | 177 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
| 178 | 178 |
| 179 // The old extension code uses the first parameter to get the bounds of the | 179 // The old extension code uses the first parameter to get the bounds of the |
| 180 // first composition character, so for backward compatibility, add it here. | 180 // first composition character, so for backward compatibility, add it here. |
| 181 base::Value* first_value = NULL; | 181 base::Value* first_value = NULL; |
| 182 if (bounds_list->Get(0, &first_value)) | 182 if (bounds_list->Get(0, &first_value)) |
| 183 args->Append(first_value->DeepCopy()); | 183 args->Append(first_value->CreateDeepCopy()); |
| 184 args->Append(std::move(bounds_list)); | 184 args->Append(std::move(bounds_list)); |
| 185 | 185 |
| 186 DispatchEventToExtension( | 186 DispatchEventToExtension( |
| 187 extensions::events::INPUT_METHOD_PRIVATE_ON_COMPOSITION_BOUNDS_CHANGED, | 187 extensions::events::INPUT_METHOD_PRIVATE_ON_COMPOSITION_BOUNDS_CHANGED, |
| 188 OnCompositionBoundsChanged::kEventName, std::move(args)); | 188 OnCompositionBoundsChanged::kEventName, std::move(args)); |
| 189 } | 189 } |
| 190 | 190 |
| 191 private: | 191 private: |
| 192 // ui::ImeObserver overrides. | 192 // ui::ImeObserver overrides. |
| 193 void DispatchEventToExtension( | 193 void DispatchEventToExtension( |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 return; | 649 return; |
| 650 InputMethodEngine* engine = | 650 InputMethodEngine* engine = |
| 651 GetActiveEngine(Profile::FromBrowserContext(details.browser_context), | 651 GetActiveEngine(Profile::FromBrowserContext(details.browser_context), |
| 652 details.extension_id); | 652 details.extension_id); |
| 653 // Notifies the IME extension for IME ready with onActivate/onFocus events. | 653 // Notifies the IME extension for IME ready with onActivate/onFocus events. |
| 654 if (engine) | 654 if (engine) |
| 655 engine->Enable(engine->GetActiveComponentId()); | 655 engine->Enable(engine->GetActiveComponentId()); |
| 656 } | 656 } |
| 657 | 657 |
| 658 } // namespace extensions | 658 } // namespace extensions |
| OLD | NEW |