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<base::ListValue> args(new base::ListValue()); | |
117 std::unique_ptr<extensions::Event> event(new extensions::Event( | |
118 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_KEYBOARD_DESTROYED, | |
119 virtual_keyboard_private::OnKeyboardDestroyed::kEventName, | |
120 std::move(args))); | |
sky
2016/07/06 16:03:00
nit: std::move(args)->base::WrapUnique(new base::L
Azure Wei
2016/07/08 06:35:24
Done.
| |
121 event->restrict_to_browser_context = context_; | |
122 router->BroadcastEvent(std::move(event)); | |
123 } | |
124 | |
108 private: | 125 private: |
109 content::BrowserContext* context_; | 126 content::BrowserContext* context_; |
110 | 127 |
111 DISALLOW_COPY_AND_ASSIGN(AshKeyboardControllerObserver); | 128 DISALLOW_COPY_AND_ASSIGN(AshKeyboardControllerObserver); |
112 }; | 129 }; |
113 | 130 |
114 } // namespace | 131 } // namespace |
115 | 132 |
116 ChromeKeyboardUI::ChromeKeyboardUI(content::BrowserContext* context) | 133 ChromeKeyboardUI::ChromeKeyboardUI(content::BrowserContext* context) |
117 : keyboard::KeyboardUIContent(context) {} | 134 : keyboard::KeyboardUIContent(context) {} |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 event_args->Append(input_context.release()); | 237 event_args->Append(input_context.release()); |
221 | 238 |
222 std::unique_ptr<extensions::Event> event(new extensions::Event( | 239 std::unique_ptr<extensions::Event> event(new extensions::Event( |
223 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_TEXT_INPUT_BOX_FOCUSED, | 240 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_TEXT_INPUT_BOX_FOCUSED, |
224 virtual_keyboard_private::OnTextInputBoxFocused::kEventName, | 241 virtual_keyboard_private::OnTextInputBoxFocused::kEventName, |
225 std::move(event_args))); | 242 std::move(event_args))); |
226 event->restrict_to_browser_context = browser_context(); | 243 event->restrict_to_browser_context = browser_context(); |
227 router->DispatchEventToExtension(kVirtualKeyboardExtensionID, | 244 router->DispatchEventToExtension(kVirtualKeyboardExtensionID, |
228 std::move(event)); | 245 std::move(event)); |
229 } | 246 } |
OLD | NEW |