Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: chrome/browser/ui/ash/chrome_keyboard_ui.cc

Issue 2122873002: Add virtualKeyboardPrivate.onKeyboardClosed API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 OnKeyboardClosed() override {
109 extensions::EventRouter* router = extensions::EventRouter::Get(context_);
110
111 if (!router->HasEventListener(
112 virtual_keyboard_private::OnKeyboardClosed::kEventName)) {
113 return;
114 }
115
116 std::unique_ptr<extensions::Event> event(new extensions::Event(
117 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_KEYBOARD_CLOSED,
118 virtual_keyboard_private::OnKeyboardClosed::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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698