OLD | NEW |
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 "chrome/browser/ui/views/tabs/tab_drag_controller.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 const gfx::Rect& bounds, | 210 const gfx::Rect& bounds, |
211 int vertical_adjustment, | 211 int vertical_adjustment, |
212 int y) { | 212 int y) { |
213 int upper_threshold = bounds.bottom() + vertical_adjustment; | 213 int upper_threshold = bounds.bottom() + vertical_adjustment; |
214 int lower_threshold = bounds.y() - vertical_adjustment; | 214 int lower_threshold = bounds.y() - vertical_adjustment; |
215 return y >= lower_threshold && y <= upper_threshold; | 215 return y >= lower_threshold && y <= upper_threshold; |
216 } | 216 } |
217 | 217 |
218 // WidgetObserver implementation that resets the window position managed | 218 // WidgetObserver implementation that resets the window position managed |
219 // property on Show. | 219 // property on Show. |
220 // We're forced to do this here since BrowserFrameAura resets the 'window | 220 // We're forced to do this here since BrowserFrameAsh resets the 'window |
221 // position managed' property during a show and we need the property set to | 221 // position managed' property during a show and we need the property set to |
222 // false before WorkspaceLayoutManager2 sees the visibility change. | 222 // false before WorkspaceLayoutManager sees the visibility change. |
223 class WindowPositionManagedUpdater : public views::WidgetObserver { | 223 class WindowPositionManagedUpdater : public views::WidgetObserver { |
224 public: | 224 public: |
225 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 225 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
226 bool visible) OVERRIDE { | 226 bool visible) OVERRIDE { |
227 SetWindowPositionManaged(widget->GetNativeView(), false); | 227 SetWindowPositionManaged(widget->GetNativeView(), false); |
228 } | 228 } |
229 }; | 229 }; |
230 | 230 |
231 } // namespace | 231 } // namespace |
232 | 232 |
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2221 gfx::Vector2d TabDragController::GetWindowOffset( | 2221 gfx::Vector2d TabDragController::GetWindowOffset( |
2222 const gfx::Point& point_in_screen) { | 2222 const gfx::Point& point_in_screen) { |
2223 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? | 2223 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? |
2224 attached_tabstrip_ : source_tabstrip_; | 2224 attached_tabstrip_ : source_tabstrip_; |
2225 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); | 2225 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); |
2226 | 2226 |
2227 gfx::Point point = point_in_screen; | 2227 gfx::Point point = point_in_screen; |
2228 views::View::ConvertPointFromScreen(toplevel_view, &point); | 2228 views::View::ConvertPointFromScreen(toplevel_view, &point); |
2229 return point.OffsetFromOrigin(); | 2229 return point.OffsetFromOrigin(); |
2230 } | 2230 } |
OLD | NEW |