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

Side by Side Diff: ash/wm/workspace/snap_sizer.h

Issue 23431009: Windows docking should get triggered by pressing against the screen edge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows docking by pressing against the screen edge (rebase) Created 7 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
« no previous file with comments | « ash/wm/window_util.cc ('k') | ash/wm/workspace/snap_sizer.cc » ('j') | 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 #ifndef ASH_WM_WORKSPACE_SNAP_SIZER_H_ 5 #ifndef ASH_WM_WORKSPACE_SNAP_SIZER_H_
6 #define ASH_WM_WORKSPACE_SNAP_SIZER_H_ 6 #define ASH_WM_WORKSPACE_SNAP_SIZER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // then it returns the next snap-bounds). 56 // then it returns the next snap-bounds).
57 gfx::Rect GetSnapBounds(const gfx::Rect& bounds); 57 gfx::Rect GetSnapBounds(const gfx::Rect& bounds);
58 58
59 // Set the snap sizer to the button press default size and prevent resizing. 59 // Set the snap sizer to the button press default size and prevent resizing.
60 void SelectDefaultSizeAndDisableResize(); 60 void SelectDefaultSizeAndDisableResize();
61 61
62 // Returns the target bounds based on the edge and the provided |size_index|. 62 // Returns the target bounds based on the edge and the provided |size_index|.
63 // For unit test purposes this function is not private. 63 // For unit test purposes this function is not private.
64 gfx::Rect GetTargetBoundsForSize(size_t size_index) const; 64 gfx::Rect GetTargetBoundsForSize(size_t size_index) const;
65 65
66 // Returns true when snapping sequence is at its last (docking) step.
67 bool end_of_sequence() const { return end_of_sequence_; }
68
66 private: 69 private:
67 // Calculates the amount to increment by. This returns one of -1, 0 or 1 and 70 // Calculates the amount to increment by. This returns one of -1, 0 or 1 and
68 // is intended to by applied to |size_index_|. |x| is the current 71 // is intended to by applied to |size_index_|. |x| is the current
69 // x-coordinate, and |reference_x| is used to determine whether to increase 72 // x-coordinate, and |reference_x| is used to determine whether to increase
70 // or decrease the position. It's one of |last_adjust_x_| or |last_update_x_|. 73 // or decrease the position. It's one of |last_adjust_x_| or |last_update_x_|.
71 int CalculateIncrement(int x, int reference_x) const; 74 int CalculateIncrement(int x, int reference_x) const;
72 75
73 // Changes the bounds. |x| is the current x-coordinate and |delta| the amount 76 // Changes the bounds. |x| is the current x-coordinate and |delta| the amount
74 // to increase by. |delta| comes from CalculateIncrement() and is applied 77 // to increase by. |delta| comes from CalculateIncrement() and is applied
75 // to |size_index_|. 78 // to |size_index_|.
(...skipping 13 matching lines...) Expand all
89 // Current target bounds for the snap. 92 // Current target bounds for the snap.
90 gfx::Rect target_bounds_; 93 gfx::Rect target_bounds_;
91 94
92 // Time Update() was last invoked. 95 // Time Update() was last invoked.
93 base::TimeTicks time_last_update_; 96 base::TimeTicks time_last_update_;
94 97
95 // Index into |kSizes| that dictates the width of the screen the target 98 // Index into |kSizes| that dictates the width of the screen the target
96 // bounds should get. 99 // bounds should get.
97 int size_index_; 100 int size_index_;
98 101
102 // Set to true when an attempt is made to increment |size_index_| past
103 // the size of |usable_width_|.
104 bool end_of_sequence_;
105
99 // If set, |size_index_| will get ignored and the single button default 106 // If set, |size_index_| will get ignored and the single button default
100 // setting will be used instead. 107 // setting will be used instead.
101 bool resize_disabled_; 108 bool resize_disabled_;
102 109
103 // Number of times Update() has been invoked since last ChangeBounds(). 110 // Number of times Update() has been invoked since last ChangeBounds().
104 int num_moves_since_adjust_; 111 int num_moves_since_adjust_;
105 112
106 // X-coordinate the last time ChangeBounds() was invoked. 113 // X-coordinate the last time ChangeBounds() was invoked.
107 int last_adjust_x_; 114 int last_adjust_x_;
108 115
(...skipping 12 matching lines...) Expand all
121 // sizer gets created. 128 // sizer gets created.
122 const std::vector<int> usable_width_; 129 const std::vector<int> usable_width_;
123 130
124 DISALLOW_COPY_AND_ASSIGN(SnapSizer); 131 DISALLOW_COPY_AND_ASSIGN(SnapSizer);
125 }; 132 };
126 133
127 } // namespace internal 134 } // namespace internal
128 } // namespace ash 135 } // namespace ash
129 136
130 #endif // ASH_WM_WORKSPACE_SNAP_SIZER_H_ 137 #endif // ASH_WM_WORKSPACE_SNAP_SIZER_H_
OLDNEW
« no previous file with comments | « ash/wm/window_util.cc ('k') | ash/wm/workspace/snap_sizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698