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

Side by Side Diff: ash/wm/common/workspace/magnetism_matcher.h

Issue 2018753003: Moves ash/wm/common back into ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove BUILD.gn again Created 4 years, 6 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
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_COMMON_WORKSPACE_MAGNETISM_MATCHER_H_ 5 #ifndef ASH_WM_COMMON_WORKSPACE_MAGNETISM_MATCHER_H_
6 #define ASH_WM_COMMON_WORKSPACE_MAGNETISM_MATCHER_H_ 6 #define ASH_WM_COMMON_WORKSPACE_MAGNETISM_MATCHER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/wm/common/ash_wm_common_export.h" 13 #include "ash/ash_export.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
18 #include "ui/gfx/geometry/rect.h" 18 #include "ui/gfx/geometry/rect.h"
19 19
20 namespace ash { 20 namespace ash {
21 21
22 enum MagnetismEdge { 22 enum MagnetismEdge {
23 MAGNETISM_EDGE_TOP = 1 << 0, 23 MAGNETISM_EDGE_TOP = 1 << 0,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 SecondaryMagnetismEdge secondary_edge; 150 SecondaryMagnetismEdge secondary_edge;
151 }; 151 };
152 152
153 // MagnetismMatcher is used to test if a window should snap to another window. 153 // MagnetismMatcher is used to test if a window should snap to another window.
154 // To use MagnetismMatcher do the following: 154 // To use MagnetismMatcher do the following:
155 // . Create it with the bounds of the window being dragged. 155 // . Create it with the bounds of the window being dragged.
156 // . Iterate over the child windows checking if the window being dragged should 156 // . Iterate over the child windows checking if the window being dragged should
157 // attach to it using ShouldAttach(). 157 // attach to it using ShouldAttach().
158 // . Use AreEdgesObscured() to test if no other windows can match (because all 158 // . Use AreEdgesObscured() to test if no other windows can match (because all
159 // edges are completely obscured). 159 // edges are completely obscured).
160 class ASH_WM_COMMON_EXPORT MagnetismMatcher { 160 class ASH_EXPORT MagnetismMatcher {
161 public: 161 public:
162 static const int kMagneticDistance; 162 static const int kMagneticDistance;
163 163
164 // |edges| is a bitmask of MagnetismEdges to match against. 164 // |edges| is a bitmask of MagnetismEdges to match against.
165 MagnetismMatcher(const gfx::Rect& bounds, uint32_t edges); 165 MagnetismMatcher(const gfx::Rect& bounds, uint32_t edges);
166 ~MagnetismMatcher(); 166 ~MagnetismMatcher();
167 167
168 // Returns true if |bounds| is close enough to the initial bounds that the two 168 // Returns true if |bounds| is close enough to the initial bounds that the two
169 // should be attached. If true is returned |edge| is set to indicates how the 169 // should be attached. If true is returned |edge| is set to indicates how the
170 // two should snap together. See description of MatchedEdge for details. 170 // two should snap together. See description of MatchedEdge for details.
(...skipping 12 matching lines...) Expand all
183 const int32_t edges_; 183 const int32_t edges_;
184 184
185 ScopedVector<MagnetismEdgeMatcher> matchers_; 185 ScopedVector<MagnetismEdgeMatcher> matchers_;
186 186
187 DISALLOW_COPY_AND_ASSIGN(MagnetismMatcher); 187 DISALLOW_COPY_AND_ASSIGN(MagnetismMatcher);
188 }; 188 };
189 189
190 } // namespace ash 190 } // namespace ash
191 191
192 #endif // ASH_WM_COMMON_WORKSPACE_MAGNETISM_MATCHER_H_ 192 #endif // ASH_WM_COMMON_WORKSPACE_MAGNETISM_MATCHER_H_
OLDNEW
« no previous file with comments | « ash/wm/common/wm_window_observer.h ('k') | ash/wm/common/workspace/multi_window_resize_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698