| 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 "ash/accelerators/accelerator_commands.h" | 10 #include "ash/accelerators/accelerator_commands.h" |
| 11 #include "ash/wm/coordinate_conversion.h" | |
| 12 #include "ash/wm/window_state.h" | 11 #include "ash/wm/window_state.h" |
| 13 #include "base/auto_reset.h" | 12 #include "base/auto_reset.h" |
| 14 #include "base/callback.h" | 13 #include "base/callback.h" |
| 15 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
| 19 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 21 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 #include "extensions/browser/extension_function_dispatcher.h" | 33 #include "extensions/browser/extension_function_dispatcher.h" |
| 35 #include "ui/aura/env.h" | 34 #include "ui/aura/env.h" |
| 36 #include "ui/aura/window.h" | 35 #include "ui/aura/window.h" |
| 37 #include "ui/events/event_constants.h" | 36 #include "ui/events/event_constants.h" |
| 38 #include "ui/events/gestures/gesture_recognizer.h" | 37 #include "ui/events/gestures/gesture_recognizer.h" |
| 39 #include "ui/gfx/geometry/point_conversions.h" | 38 #include "ui/gfx/geometry/point_conversions.h" |
| 40 #include "ui/gfx/screen.h" | 39 #include "ui/gfx/screen.h" |
| 41 #include "ui/views/focus/view_storage.h" | 40 #include "ui/views/focus/view_storage.h" |
| 42 #include "ui/views/widget/root_view.h" | 41 #include "ui/views/widget/root_view.h" |
| 43 #include "ui/views/widget/widget.h" | 42 #include "ui/views/widget/widget.h" |
| 43 #include "ui/wm/core/coordinate_conversion.h" |
| 44 #include "ui/wm/core/window_modality_controller.h" | 44 #include "ui/wm/core/window_modality_controller.h" |
| 45 | 45 |
| 46 using base::UserMetricsAction; | 46 using base::UserMetricsAction; |
| 47 using content::OpenURLParams; | 47 using content::OpenURLParams; |
| 48 using content::WebContents; | 48 using content::WebContents; |
| 49 | 49 |
| 50 // If non-null there is a drag underway. | 50 // If non-null there is a drag underway. |
| 51 static TabDragController* instance_ = NULL; | 51 static TabDragController* instance_ = NULL; |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| (...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 views::Widget* widget = GetAttachedBrowserWidget(); | 1707 views::Widget* widget = GetAttachedBrowserWidget(); |
| 1708 DCHECK(widget); | 1708 DCHECK(widget); |
| 1709 aura::Window* widget_window = widget->GetNativeWindow(); | 1709 aura::Window* widget_window = widget->GetNativeWindow(); |
| 1710 DCHECK(widget_window->GetRootWindow()); | 1710 DCHECK(widget_window->GetRootWindow()); |
| 1711 gfx::PointF touch_point_f; | 1711 gfx::PointF touch_point_f; |
| 1712 bool got_touch_point = ui::GestureRecognizer::Get()-> | 1712 bool got_touch_point = ui::GestureRecognizer::Get()-> |
| 1713 GetLastTouchPointForTarget(widget_window, &touch_point_f); | 1713 GetLastTouchPointForTarget(widget_window, &touch_point_f); |
| 1714 // TODO(tdresser): Switch to using gfx::PointF. See crbug.com/337824. | 1714 // TODO(tdresser): Switch to using gfx::PointF. See crbug.com/337824. |
| 1715 gfx::Point touch_point = gfx::ToFlooredPoint(touch_point_f); | 1715 gfx::Point touch_point = gfx::ToFlooredPoint(touch_point_f); |
| 1716 DCHECK(got_touch_point); | 1716 DCHECK(got_touch_point); |
| 1717 ash::wm::ConvertPointToScreen(widget_window->GetRootWindow(), &touch_point); | 1717 wm::ConvertPointToScreen(widget_window->GetRootWindow(), &touch_point); |
| 1718 return touch_point; | 1718 return touch_point; |
| 1719 } | 1719 } |
| 1720 | 1720 |
| 1721 return screen_->GetCursorScreenPoint(); | 1721 return screen_->GetCursorScreenPoint(); |
| 1722 } | 1722 } |
| 1723 | 1723 |
| 1724 gfx::Vector2d TabDragController::GetWindowOffset( | 1724 gfx::Vector2d TabDragController::GetWindowOffset( |
| 1725 const gfx::Point& point_in_screen) { | 1725 const gfx::Point& point_in_screen) { |
| 1726 TabStrip* owning_tabstrip = attached_tabstrip_ ? | 1726 TabStrip* owning_tabstrip = attached_tabstrip_ ? |
| 1727 attached_tabstrip_ : source_tabstrip_; | 1727 attached_tabstrip_ : source_tabstrip_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1754 it != browser_list->end(); ++it) { | 1754 it != browser_list->end(); ++it) { |
| 1755 if ((*it)->tab_strip_model()->empty()) | 1755 if ((*it)->tab_strip_model()->empty()) |
| 1756 exclude.insert((*it)->window()->GetNativeWindow()); | 1756 exclude.insert((*it)->window()->GetNativeWindow()); |
| 1757 } | 1757 } |
| 1758 #endif | 1758 #endif |
| 1759 return GetLocalProcessWindowAtPoint(host_desktop_type_, | 1759 return GetLocalProcessWindowAtPoint(host_desktop_type_, |
| 1760 screen_point, | 1760 screen_point, |
| 1761 exclude); | 1761 exclude); |
| 1762 | 1762 |
| 1763 } | 1763 } |
| OLD | NEW |