| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_ | 6 #define CHROME_BROWSER_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/gfx/rect.h" | 8 #include "base/gfx/rect.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/timer.h" | 10 #include "base/timer.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 void CaptureDragInfo(const gfx::Point& mouse_offset); | 50 void CaptureDragInfo(const gfx::Point& mouse_offset); |
| 51 | 51 |
| 52 // Responds to drag events subsequent to StartDrag. If the mouse moves a | 52 // Responds to drag events subsequent to StartDrag. If the mouse moves a |
| 53 // sufficient distance before the mouse is released, a drag session is | 53 // sufficient distance before the mouse is released, a drag session is |
| 54 // initiated. | 54 // initiated. |
| 55 void Drag(); | 55 void Drag(); |
| 56 | 56 |
| 57 // Complete the current drag session. If the drag session was canceled | 57 // Complete the current drag session. If the drag session was canceled |
| 58 // because the user pressed Escape or something interrupted it, |canceled| | 58 // because the user pressed Escape or something interrupted it, |canceled| |
| 59 // is true so the helper can revert the state to the world before the drag | 59 // is true so the helper can revert the state to the world before the drag |
| 60 // begun. | 60 // begun. Returns whether the tab has been destroyed. |
| 61 void EndDrag(bool canceled); | 61 bool EndDrag(bool canceled); |
| 62 | 62 |
| 63 // Retrieve the source Tab if the TabContents specified matches the one being | 63 // Retrieve the source Tab if the TabContents specified matches the one being |
| 64 // dragged by this controller, or NULL if the specified TabContents is not | 64 // dragged by this controller, or NULL if the specified TabContents is not |
| 65 // the same as the one being dragged. | 65 // the same as the one being dragged. |
| 66 Tab* GetDragSourceTabForContents(TabContents* contents) const; | 66 Tab* GetDragSourceTabForContents(TabContents* contents) const; |
| 67 | 67 |
| 68 // Returns true if the specified Tab matches the Tab being dragged. | 68 // Returns true if the specified Tab matches the Tab being dragged. |
| 69 bool IsDragSourceTab(Tab* tab) const; | 69 bool IsDragSourceTab(Tab* tab) const; |
| 70 | 70 |
| 71 private: | 71 private: |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 gfx::Rect GetDraggedViewTabStripBounds(const gfx::Point& screen_point); | 179 gfx::Rect GetDraggedViewTabStripBounds(const gfx::Point& screen_point); |
| 180 | 180 |
| 181 // Get the position of the dragged tab view relative to the attached tab | 181 // Get the position of the dragged tab view relative to the attached tab |
| 182 // strip. | 182 // strip. |
| 183 gfx::Point GetDraggedViewPoint(const gfx::Point& screen_point); | 183 gfx::Point GetDraggedViewPoint(const gfx::Point& screen_point); |
| 184 | 184 |
| 185 // Finds the Tab within the specified TabStrip that corresponds to the | 185 // Finds the Tab within the specified TabStrip that corresponds to the |
| 186 // dragged TabContents. | 186 // dragged TabContents. |
| 187 Tab* GetTabMatchingDraggedContents(TabStrip* tabstrip) const; | 187 Tab* GetTabMatchingDraggedContents(TabStrip* tabstrip) const; |
| 188 | 188 |
| 189 // Does the work for EndDrag. | 189 // Does the work for EndDrag. Returns whether the tab has been destroyed. |
| 190 void EndDragImpl(EndDragType how_end); | 190 bool EndDragImpl(EndDragType how_end); |
| 191 | 191 |
| 192 // If the drag was aborted for some reason, this function is called to un-do | 192 // If the drag was aborted for some reason, this function is called to un-do |
| 193 // the changes made during the drag operation. | 193 // the changes made during the drag operation. |
| 194 void RevertDrag(); | 194 void RevertDrag(); |
| 195 | 195 |
| 196 // Finishes the drag operation. Returns true if the drag controller should | 196 // Finishes the drag operation. Returns true if the drag controller should |
| 197 // be destroyed immediately, false otherwise. | 197 // be destroyed immediately, false otherwise. |
| 198 bool CompleteDrag(); | 198 bool CompleteDrag(); |
| 199 | 199 |
| 200 // Create the DraggedTabView, if it does not yet exist. | 200 // Create the DraggedTabView, if it does not yet exist. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 // Timer used to bring the window under the cursor to front. If the user | 302 // Timer used to bring the window under the cursor to front. If the user |
| 303 // stops moving the mouse for a brief time over a browser window, it is | 303 // stops moving the mouse for a brief time over a browser window, it is |
| 304 // brought to front. | 304 // brought to front. |
| 305 base::OneShotTimer<DraggedTabController> bring_to_front_timer_; | 305 base::OneShotTimer<DraggedTabController> bring_to_front_timer_; |
| 306 | 306 |
| 307 DISALLOW_COPY_AND_ASSIGN(DraggedTabController); | 307 DISALLOW_COPY_AND_ASSIGN(DraggedTabController); |
| 308 }; | 308 }; |
| 309 | 309 |
| 310 #endif // CHROME_BROWSER_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_ | 310 #endif // CHROME_BROWSER_VIEWS_TABS_DRAGGED_TAB_CONTROLLER_H_ |
| OLD | NEW |