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 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 enum EventSource { | 64 enum EventSource { |
65 EVENT_SOURCE_MOUSE, | 65 EVENT_SOURCE_MOUSE, |
66 EVENT_SOURCE_TOUCH, | 66 EVENT_SOURCE_TOUCH, |
67 }; | 67 }; |
68 | 68 |
69 // Amount above or below the tabstrip the user has to drag before detaching. | 69 // Amount above or below the tabstrip the user has to drag before detaching. |
70 static const int kTouchVerticalDetachMagnetism; | 70 static const int kTouchVerticalDetachMagnetism; |
71 static const int kVerticalDetachMagnetism; | 71 static const int kVerticalDetachMagnetism; |
72 | 72 |
73 TabDragController(); | 73 TabDragController(); |
74 virtual ~TabDragController(); | 74 ~TabDragController() override; |
75 | 75 |
76 // Initializes TabDragController to drag the tabs in |tabs| originating from | 76 // Initializes TabDragController to drag the tabs in |tabs| originating from |
77 // |source_tabstrip|. |source_tab| is the tab that initiated the drag and is | 77 // |source_tabstrip|. |source_tab| is the tab that initiated the drag and is |
78 // contained in |tabs|. |mouse_offset| is the distance of the mouse pointer | 78 // contained in |tabs|. |mouse_offset| is the distance of the mouse pointer |
79 // from the origin of the first tab in |tabs| and |source_tab_offset| the | 79 // from the origin of the first tab in |tabs| and |source_tab_offset| the |
80 // offset from |source_tab|. |source_tab_offset| is the horizontal offset of | 80 // offset from |source_tab|. |source_tab_offset| is the horizontal offset of |
81 // |mouse_offset| relative to |source_tab|. |initial_selection_model| is the | 81 // |mouse_offset| relative to |source_tab|. |initial_selection_model| is the |
82 // selection model before the drag started and is only non-empty if | 82 // selection model before the drag started and is only non-empty if |
83 // |source_tab| was not initially selected. | 83 // |source_tab| was not initially selected. |
84 void Init(TabStrip* source_tabstrip, | 84 void Init(TabStrip* source_tabstrip, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 bool pinned; | 201 bool pinned; |
202 }; | 202 }; |
203 | 203 |
204 typedef std::vector<TabDragData> DragData; | 204 typedef std::vector<TabDragData> DragData; |
205 | 205 |
206 // Sets |drag_data| from |tab|. This also registers for necessary | 206 // Sets |drag_data| from |tab|. This also registers for necessary |
207 // notifications and resets the delegate of the WebContents. | 207 // notifications and resets the delegate of the WebContents. |
208 void InitTabDragData(Tab* tab, TabDragData* drag_data); | 208 void InitTabDragData(Tab* tab, TabDragData* drag_data); |
209 | 209 |
210 // Overridden from content::NotificationObserver: | 210 // Overridden from content::NotificationObserver: |
211 virtual void Observe(int type, | 211 void Observe(int type, |
212 const content::NotificationSource& source, | 212 const content::NotificationSource& source, |
213 const content::NotificationDetails& details) override; | 213 const content::NotificationDetails& details) override; |
214 | 214 |
215 // Overriden from views::WidgetObserver: | 215 // Overriden from views::WidgetObserver: |
216 virtual void OnWidgetBoundsChanged(views::Widget* widget, | 216 void OnWidgetBoundsChanged(views::Widget* widget, |
217 const gfx::Rect& new_bounds) override; | 217 const gfx::Rect& new_bounds) override; |
218 | 218 |
219 // Overriden from TabStripModelObserver: | 219 // Overriden from TabStripModelObserver: |
220 virtual void TabStripEmpty() override; | 220 void TabStripEmpty() override; |
221 | 221 |
222 // Initialize the offset used to calculate the position to create windows | 222 // Initialize the offset used to calculate the position to create windows |
223 // in |GetWindowCreatePoint|. This should only be invoked from |Init|. | 223 // in |GetWindowCreatePoint|. This should only be invoked from |Init|. |
224 void InitWindowCreatePoint(); | 224 void InitWindowCreatePoint(); |
225 | 225 |
226 // Returns the point where a detached window should be created given the | 226 // Returns the point where a detached window should be created given the |
227 // current mouse position |origin|. | 227 // current mouse position |origin|. |
228 gfx::Point GetWindowCreatePoint(const gfx::Point& origin) const; | 228 gfx::Point GetWindowCreatePoint(const gfx::Point& origin) const; |
229 | 229 |
230 void UpdateDockInfo(const gfx::Point& point_in_screen); | 230 void UpdateDockInfo(const gfx::Point& point_in_screen); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 int attach_index_; | 599 int attach_index_; |
600 | 600 |
601 scoped_ptr<ui::EventHandler> escape_tracker_; | 601 scoped_ptr<ui::EventHandler> escape_tracker_; |
602 | 602 |
603 base::WeakPtrFactory<TabDragController> weak_factory_; | 603 base::WeakPtrFactory<TabDragController> weak_factory_; |
604 | 604 |
605 DISALLOW_COPY_AND_ASSIGN(TabDragController); | 605 DISALLOW_COPY_AND_ASSIGN(TabDragController); |
606 }; | 606 }; |
607 | 607 |
608 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 608 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
OLD | NEW |