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

Unified Diff: ash/common/wm/panels/panel_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
Index: ash/common/wm/panels/panel_layout_manager.cc
diff --git a/ash/common/wm/panels/panel_layout_manager.cc b/ash/common/wm/panels/panel_layout_manager.cc
index ba2b0f8ce5e4defea4963e4c99cc0d428a82bb25..930ba6877401656447af5735f7d6da36b557bff2 100644
--- a/ash/common/wm/panels/panel_layout_manager.cc
+++ b/ash/common/wm/panels/panel_layout_manager.cc
@@ -101,7 +101,7 @@ struct VisiblePanelPositionInfo {
max_major(0),
major_pos(0),
major_length(0),
- window(NULL),
+ window(nullptr),
slide_in(false) {}
int min_major;
@@ -245,9 +245,10 @@ PanelLayoutManager::PanelLayoutManager(WmWindow* panel_container)
in_add_window_(false),
in_layout_(false),
show_callout_widgets_(true),
- dragged_panel_(NULL),
+ dragged_panel_(nullptr),
shelf_(nullptr),
- last_active_panel_(NULL),
+ last_active_panel_(nullptr),
+ keyboard_observer_(this),
weak_factory_(this) {
DCHECK(panel_container);
WmShell* shell = panel_container->GetShell();
@@ -294,7 +295,7 @@ void PanelLayoutManager::StartDragging(WmWindow* panel) {
}
void PanelLayoutManager::FinishDragging() {
- dragged_panel_ = NULL;
+ dragged_panel_ = nullptr;
Relayout();
}
@@ -385,10 +386,10 @@ void PanelLayoutManager::OnWindowRemovedFromLayout(WmWindow* child) {
child->GetWindowState()->RemoveObserver(this);
if (dragged_panel_ == child)
- dragged_panel_ = NULL;
+ dragged_panel_ = nullptr;
if (last_active_panel_ == child)
- last_active_panel_ = NULL;
+ last_active_panel_ = nullptr;
Relayout();
}
@@ -452,6 +453,21 @@ void PanelLayoutManager::OnShelfAlignmentChanged(WmWindow* root_window) {
Relayout();
}
+void PanelLayoutManager::OnVirtualKeyboardStateChanged(bool activated,
+ WmWindow* root_window) {
+ if (root_window != panel_container_->GetRootWindow())
+ 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);
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, WindowObserver implementation:
@@ -792,7 +808,7 @@ void PanelLayoutManager::UpdateStacking(WmWindow* active_panel) {
previous_panel = it->second;
}
- previous_panel = NULL;
+ previous_panel = nullptr;
for (std::map<int, WmWindow*>::const_reverse_iterator it =
window_ordering.rbegin();
it != window_ordering.rend() && it->second != active_panel; ++it) {
@@ -930,6 +946,8 @@ void PanelLayoutManager::OnKeyboardBoundsChanging(
OnWindowResized();
}
-void PanelLayoutManager::OnKeyboardClosed() {}
+void PanelLayoutManager::OnKeyboardClosed() {
+ keyboard_observer_.RemoveAll();
+}
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698