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

Unified Diff: ash/common/wm/workspace/workspace_layout_manager.cc

Issue 2747543002: ash: Start/stop observing KeyboardController via ShellObserver (Closed)
Patch Set: update keyboard container before notifying keyboard state observers Created 3 years, 9 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
Index: ash/common/wm/workspace/workspace_layout_manager.cc
diff --git a/ash/common/wm/workspace/workspace_layout_manager.cc b/ash/common/wm/workspace/workspace_layout_manager.cc
index f33abb0f1ca76828028cc2da1ba117d79d7d0189..e1ba4a2243b92ac43b1afc794a37b71986c8e704 100644
--- a/ash/common/wm/workspace/workspace_layout_manager.cc
+++ b/ash/common/wm/workspace/workspace_layout_manager.cc
@@ -40,7 +40,8 @@ WorkspaceLayoutManager::WorkspaceLayoutManager(WmWindow* window)
root_window_controller_(root_window_->GetRootWindowController()),
shell_(window_->GetShell()),
work_area_in_parent_(wm::GetDisplayWorkAreaBoundsInParent(window_)),
- is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr) {
+ is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr),
+ keyboard_observer_(this) {
Shell::GetInstance()->AddShellObserver(this);
Shell::GetInstance()->activation_client()->AddObserver(this);
root_window_->aura_window()->AddObserver(this);
@@ -178,7 +179,9 @@ void WorkspaceLayoutManager::OnKeyboardBoundsChanging(
}
}
-void WorkspaceLayoutManager::OnKeyboardClosed() {}
+void WorkspaceLayoutManager::OnKeyboardClosed() {
+ keyboard_observer_.RemoveAll();
+}
//////////////////////////////////////////////////////////////////////////////
// WorkspaceLayoutManager, aura::WindowObserver implementation:
@@ -327,6 +330,23 @@ void WorkspaceLayoutManager::OnPinnedStateChanged(WmWindow* pinned_window) {
UpdateAlwaysOnTop(WmShell::Get()->IsPinned() ? pinned_window : nullptr);
}
+void WorkspaceLayoutManager::OnVirtualKeyboardStateChanged(bool activated) {
+ keyboard::KeyboardController* const keyboard_controller =
+ keyboard::KeyboardController::GetInstance();
+ if (!keyboard_controller ||
+ keyboard_controller->GetContainerWindow()->GetRootWindow() !=
+ root_window_->aura_window()) {
+ return;
+ }
+
+ if (activated && !keyboard_observer_.IsObserving(keyboard_controller)) {
+ keyboard_observer_.Add(keyboard_controller);
+ } else if (!activated &&
+ keyboard_observer_.IsObserving(keyboard_controller)) {
+ keyboard_observer_.Remove(keyboard_controller);
+ }
+}
+
//////////////////////////////////////////////////////////////////////////////
// WorkspaceLayoutManager, private:

Powered by Google App Engine
This is Rietveld 408576698