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

Unified Diff: ash/common/wm/maximize_mode/maximize_mode_window_manager.cc

Issue 2250963006: Register the window in MaximizeModeWindowManager when the window is shown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/maximize_mode/maximize_mode_window_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/maximize_mode/maximize_mode_window_manager.cc
diff --git a/ash/common/wm/maximize_mode/maximize_mode_window_manager.cc b/ash/common/wm/maximize_mode/maximize_mode_window_manager.cc
index 3d0ea92f86cd16b0851dfe9ccc992063b9df4116..63c8715a6a52bfb25e4c19f79efc7e2b9ab2eacc 100644
--- a/ash/common/wm/maximize_mode/maximize_mode_window_manager.cc
+++ b/ash/common/wm/maximize_mode/maximize_mode_window_manager.cc
@@ -99,6 +99,10 @@ void MaximizeModeWindowManager::OnWindowDestroying(WmWindow* window) {
// container window can be removed on display destruction.
window->RemoveObserver(this);
observed_container_windows_.erase(window);
+ } else if (base::ContainsValue(added_windows_, window)) {
+ // Added window was destroyed before being shown.
+ added_windows_.erase(window);
+ window->RemoveObserver(this);
} else {
// If a known window gets destroyed we need to remove all knowledge about
// it.
@@ -112,6 +116,15 @@ void MaximizeModeWindowManager::OnWindowTreeChanged(
// A window can get removed and then re-added by a drag and drop operation.
if (params.new_parent && IsContainerWindow(params.new_parent) &&
!base::ContainsKey(window_state_map_, params.target)) {
+ // Wait until the window become visible because the client
+ // may update the flag to control if the window should be added.
+ if (!params.target->IsVisible()) {
Mr4D (OOO till 08-26) 2016/08/18 01:45:45 This is confusing. You mention "wait until the win
oshima 2016/08/18 04:26:09 Updated to: // Don't register the window if t
+ if (!base::ContainsValue(added_windows_, params.target)) {
+ added_windows_.insert(params.target);
+ params.target->AddObserver(this);
+ }
+ return;
+ }
MaximizeAndTrackWindow(params.target);
// When the state got added, the "WM_EVENT_ADDED_TO_WORKSPACE" event got
// already sent and we have to notify our state again.
@@ -141,6 +154,26 @@ void MaximizeModeWindowManager::OnWindowBoundsChanged(
pair.second->UpdateWindowPosition(pair.first->GetWindowState());
}
+void MaximizeModeWindowManager::OnWindowVisibilityChanged(WmWindow* window,
+ bool visible) {
+ // Skip if it's already managed.
+ if (base::ContainsKey(window_state_map_, window))
+ return;
+
+ if (IsContainerWindow(window->GetParent()) &&
+ base::ContainsValue(added_windows_, window) && visible) {
+ added_windows_.erase(window);
+ window->RemoveObserver(this);
+ MaximizeAndTrackWindow(window);
+ // When the state got added, the "WM_EVENT_ADDED_TO_WORKSPACE" event got
+ // already sent and we have to notify our state again.
+ if (base::ContainsKey(window_state_map_, window)) {
+ wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE);
+ window->GetWindowState()->OnWMEvent(&event);
+ }
Mr4D (OOO till 08-26) 2016/08/18 01:45:45 Could you put line 167-173 into a function and cal
oshima 2016/08/18 04:26:09 I believe we can move the added to workspace to Ma
+ }
+}
+
void MaximizeModeWindowManager::OnDisplayAdded(
const display::Display& display) {
DisplayConfigurationChanged();
« no previous file with comments | « ash/common/wm/maximize_mode/maximize_mode_window_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698