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

Unified Diff: ash/wm/workspace/workspace_window_resizer.cc

Issue 55363004: Enables docked windows by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enables docked window flag by default (nit) Created 7 years, 1 month 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/workspace/workspace_window_resizer.h ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_window_resizer.cc
diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc
index 731fcb37a92ac3e24bc558ee1c89428d34e25b00..e788b6301b9b0fdffc85af96ac8937b656ef8b7a 100644
--- a/ash/wm/workspace/workspace_window_resizer.cc
+++ b/ash/wm/workspace/workspace_window_resizer.cc
@@ -95,8 +95,7 @@ scoped_ptr<WindowResizer> CreateWindowResizer(
window_resizer = PanelWindowResizer::Create(
window_resizer, window, point_in_parent, window_component, source);
}
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshEnableDockedWindows) &&
+ if (switches::UseDockedWindows() &&
window_resizer && window->parent() &&
!window->transient_parent() &&
(window->parent()->id() == internal::kShellWindowId_DefaultContainer ||
@@ -120,9 +119,8 @@ const int kScreenEdgeInsetForTouchResize = 32;
// Returns true if the window should stick to the edge.
bool ShouldStickToEdge(int distance_from_edge, int sticky_size) {
if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshEnableStickyEdges) ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshEnableDockedWindows)) {
+ switches::kAshEnableStickyEdges)) {
+ // TODO(varkha): Consider keeping snapping behavior for touch drag.
return distance_from_edge < 0 &&
distance_from_edge > -sticky_size;
}
@@ -273,6 +271,9 @@ const int WorkspaceWindowResizer::kScreenEdgeInset = 8;
// static
const int WorkspaceWindowResizer::kStickyDistancePixels = 64;
+// static
+WorkspaceWindowResizer* WorkspaceWindowResizer::instance_ = NULL;
+
// Represents the width or height of a window with constraints on its minimum
// and maximum size. 0 represents a lack of a constraint.
class WindowSize {
@@ -345,6 +346,8 @@ class WindowSize {
WorkspaceWindowResizer::~WorkspaceWindowResizer() {
Shell* shell = Shell::GetInstance();
shell->cursor_manager()->UnlockCursor();
+ if (instance_ == this)
+ instance_ = NULL;
}
// static
@@ -367,9 +370,7 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent,
if (event_flags & ui::EF_CONTROL_DOWN) {
sticky_size = 0;
} else if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshEnableStickyEdges) ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshEnableDockedWindows)) {
+ switches::kAshEnableStickyEdges)) {
sticky_size = kStickyDistancePixels;
} else if ((details_.bounds_change & kBoundsChange_Resizes) &&
details_.source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
@@ -542,6 +543,7 @@ WorkspaceWindowResizer::WorkspaceWindowResizer(
total_initial_size_ += initial_size;
total_available += std::max(min_size, initial_size) - min_size;
}
+ instance_ = this;
}
gfx::Rect WorkspaceWindowResizer::GetFinalBounds(
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.h ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698