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

Unified Diff: ash/wm/dock/docked_window_resizer.cc

Issue 597683003: Add window states docked; and docked minimized. Add wm window event to set docked and undocked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dock
Patch Set: Pull forward a change from the dependant CL to this Created 6 years, 2 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/wm/dock/docked_window_layout_manager_unittest.cc ('k') | ash/wm/dock/docked_window_resizer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/dock/docked_window_resizer.cc
diff --git a/ash/wm/dock/docked_window_resizer.cc b/ash/wm/dock/docked_window_resizer.cc
index 14b58d408fe53eb12eca8c96538a33b537877fe6..d0b86f9aed60fe4e2442806684c3b805e8e761b5 100644
--- a/ash/wm/dock/docked_window_resizer.cc
+++ b/ash/wm/dock/docked_window_resizer.cc
@@ -15,6 +15,7 @@
#include "ash/wm/dock/docked_window_layout_manager.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
+#include "ash/wm/wm_event.h"
#include "ash/wm/workspace/magnetism_matcher.h"
#include "ash/wm/workspace/workspace_window_resizer.h"
#include "base/command_line.h"
@@ -219,10 +220,11 @@ void DockedWindowResizer::FinishedDragging(
const bool is_resized =
(details().bounds_change & WindowResizer::kBoundsChange_Resizes) != 0;
- // Undock the window if it is not in the normal or minimized state type. This
- // happens if a user snaps or maximizes a window using a keyboard shortcut
- // while it is being dragged.
- if (!window_state_->IsMinimized() && !window_state_->IsNormalStateType())
+ // Undock the window if it is not in the normal, docked or minimized state
+ // type. This happens if a user snaps or maximizes a window using a
+ // keyboard shortcut while it is being dragged.
+ if (!window_state_->IsMinimized() && !window_state_->IsDocked() &&
+ !window_state_->IsNormalStateType())
is_docked_ = false;
// When drag is completed the dragged docked window is resized to the bounds
@@ -315,6 +317,16 @@ DockedAction DockedWindowResizer::MaybeReparentWindowOnDragCompletion(
wm::GetWindowState(window)->set_bounds_changed_by_user(
was_docked_ && (is_resized || was_bounds_changed_by_user_));
}
+
+ if (action == DOCKED_ACTION_DOCK) {
+ const wm::WMEvent event(wm::WM_EVENT_DOCK);
+ window_state_->OnWMEvent(&event);
+ } else if (wm::GetWindowState(window)->IsDocked() &&
+ action == DOCKED_ACTION_UNDOCK) {
+ const wm::WMEvent event(wm::WM_EVENT_NORMAL);
+ window_state_->OnWMEvent(&event);
+ }
+
return action;
}
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager_unittest.cc ('k') | ash/wm/dock/docked_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698