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

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

Issue 2747543002: ash: Start/stop observing KeyboardController via ShellObserver (Closed)
Patch Set: pass root_window to OnVirtualKeyboardStateChanged() 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
« no previous file with comments | « ash/common/wm/workspace/workspace_layout_manager.h ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c79beb4fecd71922dc350bca2e0c79a9b2d40bef 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,22 @@ void WorkspaceLayoutManager::OnPinnedStateChanged(WmWindow* pinned_window) {
UpdateAlwaysOnTop(WmShell::Get()->IsPinned() ? pinned_window : nullptr);
}
+void WorkspaceLayoutManager::OnVirtualKeyboardStateChanged(
+ bool activated,
+ WmWindow* root_window) {
+ if (root_window != root_window_)
sky 2017/03/14 03:23:50 As this code exists in a handful of places, WDYT o
xiyuan 2017/03/14 21:25:55 Good idea. Done.
+ return;
+
+ keyboard::KeyboardController* const keyboard_controller =
+ keyboard::KeyboardController::GetInstance();
+ 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:
« no previous file with comments | « ash/common/wm/workspace/workspace_layout_manager.h ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698