| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/ui/ash/chrome_keyboard_ui.h" | 5 #include "chrome/browser/ui/ash/chrome_keyboard_ui.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 event_args->Append(new_bounds.release()); | 98 event_args->Append(new_bounds.release()); |
| 99 | 99 |
| 100 std::unique_ptr<extensions::Event> event(new extensions::Event( | 100 std::unique_ptr<extensions::Event> event(new extensions::Event( |
| 101 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_BOUNDS_CHANGED, | 101 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_BOUNDS_CHANGED, |
| 102 virtual_keyboard_private::OnBoundsChanged::kEventName, | 102 virtual_keyboard_private::OnBoundsChanged::kEventName, |
| 103 std::move(event_args))); | 103 std::move(event_args))); |
| 104 event->restrict_to_browser_context = context_; | 104 event->restrict_to_browser_context = context_; |
| 105 router->BroadcastEvent(std::move(event)); | 105 router->BroadcastEvent(std::move(event)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void OnKeyboardDestroyed() override { |
| 109 extensions::EventRouter* router = extensions::EventRouter::Get(context_); |
| 110 |
| 111 if (!router->HasEventListener( |
| 112 virtual_keyboard_private::OnKeyboardDestroyed::kEventName)) { |
| 113 return; |
| 114 } |
| 115 |
| 116 std::unique_ptr<extensions::Event> event(new extensions::Event( |
| 117 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_KEYBOARD_DESTROYED, |
| 118 virtual_keyboard_private::OnKeyboardDestroyed::kEventName, |
| 119 base::WrapUnique(new base::ListValue()))); |
| 120 event->restrict_to_browser_context = context_; |
| 121 router->BroadcastEvent(std::move(event)); |
| 122 } |
| 123 |
| 108 private: | 124 private: |
| 109 content::BrowserContext* context_; | 125 content::BrowserContext* context_; |
| 110 | 126 |
| 111 DISALLOW_COPY_AND_ASSIGN(AshKeyboardControllerObserver); | 127 DISALLOW_COPY_AND_ASSIGN(AshKeyboardControllerObserver); |
| 112 }; | 128 }; |
| 113 | 129 |
| 114 } // namespace | 130 } // namespace |
| 115 | 131 |
| 116 ChromeKeyboardUI::ChromeKeyboardUI(content::BrowserContext* context) | 132 ChromeKeyboardUI::ChromeKeyboardUI(content::BrowserContext* context) |
| 117 : keyboard::KeyboardUIContent(context) {} | 133 : keyboard::KeyboardUIContent(context) {} |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 event_args->Append(input_context.release()); | 236 event_args->Append(input_context.release()); |
| 221 | 237 |
| 222 std::unique_ptr<extensions::Event> event(new extensions::Event( | 238 std::unique_ptr<extensions::Event> event(new extensions::Event( |
| 223 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_TEXT_INPUT_BOX_FOCUSED, | 239 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_TEXT_INPUT_BOX_FOCUSED, |
| 224 virtual_keyboard_private::OnTextInputBoxFocused::kEventName, | 240 virtual_keyboard_private::OnTextInputBoxFocused::kEventName, |
| 225 std::move(event_args))); | 241 std::move(event_args))); |
| 226 event->restrict_to_browser_context = browser_context(); | 242 event->restrict_to_browser_context = browser_context(); |
| 227 router->DispatchEventToExtension(kVirtualKeyboardExtensionID, | 243 router->DispatchEventToExtension(kVirtualKeyboardExtensionID, |
| 228 std::move(event)); | 244 std::move(event)); |
| 229 } | 245 } |
| OLD | NEW |