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

Unified Diff: ash/system/virtual_keyboard/virtual_keyboard_tray.cc

Issue 2916653002: Updated the VK Tray button to properly remove visual activated state. (Closed)
Patch Set: Removed the VirtualKeyboardTray as a ShellObserver during destruction. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/virtual_keyboard/virtual_keyboard_tray.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/virtual_keyboard/virtual_keyboard_tray.cc
diff --git a/ash/system/virtual_keyboard/virtual_keyboard_tray.cc b/ash/system/virtual_keyboard/virtual_keyboard_tray.cc
index 89d55053934c2c56e9805db47b363072815c7f62..4c7b2dc49c1a0228bb170ac339f4e8afa6fd9a51 100644
--- a/ash/system/virtual_keyboard/virtual_keyboard_tray.cc
+++ b/ash/system/virtual_keyboard/virtual_keyboard_tray.cc
@@ -39,8 +39,10 @@ VirtualKeyboardTray::VirtualKeyboardTray(Shelf* shelf)
tray_container()->AddChildView(icon_);
// The Shell may not exist in some unit tests.
- if (Shell::HasInstance())
+ if (Shell::HasInstance()) {
Shell::Get()->keyboard_ui()->AddObserver(this);
+ Shell::Get()->AddShellObserver(this);
+ }
// Try observing keyboard controller, in case it is already constructed.
ObserveKeyboardController();
}
@@ -49,8 +51,10 @@ VirtualKeyboardTray::~VirtualKeyboardTray() {
// Try unobserving keyboard controller, in case it still exists.
UnobserveKeyboardController();
// The Shell may not exist in some unit tests.
- if (Shell::HasInstance())
+ if (Shell::HasInstance()) {
Shell::Get()->keyboard_ui()->RemoveObserver(this);
+ Shell::Get()->RemoveShellObserver(this);
James Cook 2017/05/31 23:44:25 super-nit: do this one line above so things are re
bruthig 2017/06/01 14:05:15 Done.
+ }
}
base::string16 VirtualKeyboardTray::GetAccessibleNameForTray() {
@@ -96,10 +100,14 @@ void VirtualKeyboardTray::OnKeyboardBoundsChanging(
void VirtualKeyboardTray::OnKeyboardClosed() {}
+void VirtualKeyboardTray::OnKeyboardControllerCreated() {
+ ObserveKeyboardController();
+}
+
void VirtualKeyboardTray::ObserveKeyboardController() {
keyboard::KeyboardController* keyboard_controller =
keyboard::KeyboardController::GetInstance();
- if (keyboard_controller)
+ if (keyboard_controller && !keyboard_controller->HasObserver(this))
keyboard_controller->AddObserver(this);
}
« no previous file with comments | « ash/system/virtual_keyboard/virtual_keyboard_tray.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698