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

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

Issue 2747543002: ash: Start/stop observing KeyboardController via ShellObserver (Closed)
Patch Set: rebase 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..ec1451f39658f39578ccc2d7fcae3f422f40402f 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);
@@ -66,6 +67,18 @@ void WorkspaceLayoutManager::SetMaximizeBackdropDelegate(
backdrop_delegate_ = std::move(delegate);
}
+void WorkspaceLayoutManager::StartObservingKeyboard(
+ keyboard::KeyboardController* keyboard_controller) {
+ DCHECK(!keyboard_observer_.IsObservingSources());
+ keyboard_observer_.Add(keyboard_controller);
+}
+
+void WorkspaceLayoutManager::StopObservingKeyboard(
+ keyboard::KeyboardController* keyboard_controller) {
+ if (keyboard_observer_.IsObserving(keyboard_controller))
+ keyboard_observer_.Remove(keyboard_controller);
+}
+
//////////////////////////////////////////////////////////////////////////////
// WorkspaceLayoutManager, aura::LayoutManager implementation:
@@ -178,7 +191,9 @@ void WorkspaceLayoutManager::OnKeyboardBoundsChanging(
}
}
-void WorkspaceLayoutManager::OnKeyboardClosed() {}
+void WorkspaceLayoutManager::OnKeyboardClosed() {
+ keyboard_observer_.RemoveAll();
+}
//////////////////////////////////////////////////////////////////////////////
// WorkspaceLayoutManager, aura::WindowObserver implementation:

Powered by Google App Engine
This is Rietveld 408576698