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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.cc

Issue 497733002: Declaring the weak_ptr_factory in proper order. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes are incorporated with the comments Created 6 years, 3 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 unified diff | Download patch
« ash/shell.h ('K') | « ash/wm/workspace/workspace_window_resizer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 return make_scoped_ptr<WindowResizer>(window_resizer); 104 return make_scoped_ptr<WindowResizer>(window_resizer);
105 } 105 }
106 106
107 namespace { 107 namespace {
108 108
109 // Snapping distance used instead of WorkspaceWindowResizer::kScreenEdgeInset 109 // Snapping distance used instead of WorkspaceWindowResizer::kScreenEdgeInset
110 // when resizing a window using touchscreen. 110 // when resizing a window using touchscreen.
111 const int kScreenEdgeInsetForTouchDrag = 32; 111 const int kScreenEdgeInsetForTouchDrag = 32;
112 112
113 // Current instance for use by the WorkspaceWindowResizerTest.
114 static WorkspaceWindowResizer* instance_ = NULL;
oshima 2014/08/28 06:33:17 nit: remove static.
Anand Ratn (left samsung) 2014/08/28 07:17:39 Done.
115
113 // Returns true if the window should stick to the edge. 116 // Returns true if the window should stick to the edge.
114 bool ShouldStickToEdge(int distance_from_edge, int sticky_size) { 117 bool ShouldStickToEdge(int distance_from_edge, int sticky_size) {
115 return distance_from_edge < sticky_size && 118 return distance_from_edge < sticky_size &&
116 distance_from_edge > -sticky_size * 2; 119 distance_from_edge > -sticky_size * 2;
117 } 120 }
118 121
119 // Returns the coordinate along the secondary axis to snap to. 122 // Returns the coordinate along the secondary axis to snap to.
120 int CoordinateAlongSecondaryAxis(SecondaryMagnetismEdge edge, 123 int CoordinateAlongSecondaryAxis(SecondaryMagnetismEdge edge,
121 int leading, 124 int leading,
122 int trailing, 125 int trailing,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 252
250 // static 253 // static
251 const int WorkspaceWindowResizer::kMinOnscreenSize = 20; 254 const int WorkspaceWindowResizer::kMinOnscreenSize = 20;
252 255
253 // static 256 // static
254 const int WorkspaceWindowResizer::kMinOnscreenHeight = 32; 257 const int WorkspaceWindowResizer::kMinOnscreenHeight = 32;
255 258
256 // static 259 // static
257 const int WorkspaceWindowResizer::kScreenEdgeInset = 8; 260 const int WorkspaceWindowResizer::kScreenEdgeInset = 8;
258 261
259 // static
260 WorkspaceWindowResizer* WorkspaceWindowResizer::instance_ = NULL;
261
262 // Represents the width or height of a window with constraints on its minimum 262 // Represents the width or height of a window with constraints on its minimum
263 // and maximum size. 0 represents a lack of a constraint. 263 // and maximum size. 0 represents a lack of a constraint.
264 class WindowSize { 264 class WindowSize {
265 public: 265 public:
266 WindowSize(int size, int min, int max) 266 WindowSize(int size, int min, int max)
267 : size_(size), 267 : size_(size),
268 min_(min), 268 min_(min),
269 max_(max) { 269 max_(max) {
270 // Grow the min/max bounds to include the starting size. 270 // Grow the min/max bounds to include the starting size.
271 if (is_underflowing()) 271 if (is_underflowing())
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); 1038 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED);
1039 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( 1039 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent(
1040 GetTarget()); 1040 GetTarget());
1041 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) 1041 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED)
1042 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); 1042 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width());
1043 snapped_bounds.set_width(bounds_in_parent.width()); 1043 snapped_bounds.set_width(bounds_in_parent.width());
1044 return bounds_in_parent == snapped_bounds; 1044 return bounds_in_parent == snapped_bounds;
1045 } 1045 }
1046 1046
1047 } // namespace ash 1047 } // namespace ash
OLDNEW
« ash/shell.h ('K') | « ash/wm/workspace/workspace_window_resizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698