| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_ | 6 #define CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "app/x11_util.h" | 13 #include "app/x11_util.h" |
| 14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "base/timer.h" | 15 #include "base/timer.h" |
| 16 #include "chrome/browser/dock_info.h" | 16 #include "chrome/browser/dock_info.h" |
| 17 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 17 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 18 #include "chrome/common/notification_observer.h" | 18 #include "chrome/common/notification_observer.h" |
| 19 #include "chrome/common/notification_registrar.h" | 19 #include "chrome/common/notification_registrar.h" |
| 20 | 20 |
| 21 class DraggedTabGtk; | 21 class DraggedTabGtk; |
| 22 class TabGtk; | 22 class TabGtk; |
| 23 class TabStripGtk; | 23 class TabStripGtk; |
| 24 class TabContentsWrapper; |
| 24 | 25 |
| 25 class DraggedTabControllerGtk : public NotificationObserver, | 26 class DraggedTabControllerGtk : public NotificationObserver, |
| 26 public TabContentsDelegate { | 27 public TabContentsDelegate { |
| 27 public: | 28 public: |
| 28 DraggedTabControllerGtk(TabGtk* source_tab, TabStripGtk* source_tabstrip); | 29 DraggedTabControllerGtk(TabGtk* source_tab, TabStripGtk* source_tabstrip); |
| 29 virtual ~DraggedTabControllerGtk(); | 30 virtual ~DraggedTabControllerGtk(); |
| 30 | 31 |
| 31 // Capture information needed to be used during a drag session for this | 32 // Capture information needed to be used during a drag session for this |
| 32 // controller's associated source Tab and TabStrip. |mouse_offset| is the | 33 // controller's associated source Tab and TabStrip. |mouse_offset| is the |
| 33 // distance of the mouse pointer from the Tab's origin. | 34 // distance of the mouse pointer from the Tab's origin. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 99 |
| 99 // Initialize the offset used to calculate the position to create windows | 100 // Initialize the offset used to calculate the position to create windows |
| 100 // in |GetWindowCreatePoint|. | 101 // in |GetWindowCreatePoint|. |
| 101 void InitWindowCreatePoint(); | 102 void InitWindowCreatePoint(); |
| 102 | 103 |
| 103 // Returns the point where a detached window should be created given the | 104 // Returns the point where a detached window should be created given the |
| 104 // current mouse position. | 105 // current mouse position. |
| 105 gfx::Point GetWindowCreatePoint() const; | 106 gfx::Point GetWindowCreatePoint() const; |
| 106 | 107 |
| 107 // Sets the TabContents being dragged with the specified |new_contents|. | 108 // Sets the TabContents being dragged with the specified |new_contents|. |
| 108 void SetDraggedContents(TabContents* new_contents); | 109 void SetDraggedContents(TabContentsWrapper* new_contents); |
| 109 | 110 |
| 110 // Move the DraggedTabView according to the current mouse screen position, | 111 // Move the DraggedTabView according to the current mouse screen position, |
| 111 // potentially updating the source and other TabStrips. | 112 // potentially updating the source and other TabStrips. |
| 112 void ContinueDragging(); | 113 void ContinueDragging(); |
| 113 | 114 |
| 114 // Handles moving the Tab within a TabStrip as well as updating the View. | 115 // Handles moving the Tab within a TabStrip as well as updating the View. |
| 115 void MoveTab(const gfx::Point& screen_point); | 116 void MoveTab(const gfx::Point& screen_point); |
| 116 | 117 |
| 117 // Returns the compatible TabStrip that is under the specified point (screen | 118 // Returns the compatible TabStrip that is under the specified point (screen |
| 118 // coordinates), or NULL if there is none. | 119 // coordinates), or NULL if there is none. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // position. | 193 // position. |
| 193 void OnAnimateToBoundsComplete(); | 194 void OnAnimateToBoundsComplete(); |
| 194 | 195 |
| 195 // Activates whichever window is under the mouse. | 196 // Activates whichever window is under the mouse. |
| 196 void BringWindowUnderMouseToFront(); | 197 void BringWindowUnderMouseToFront(); |
| 197 | 198 |
| 198 // Handles registering for notifications. | 199 // Handles registering for notifications. |
| 199 NotificationRegistrar registrar_; | 200 NotificationRegistrar registrar_; |
| 200 | 201 |
| 201 // The TabContents being dragged. | 202 // The TabContents being dragged. |
| 202 TabContents* dragged_contents_; | 203 TabContentsWrapper* dragged_contents_; |
| 203 | 204 |
| 204 // The original TabContentsDelegate of |dragged_contents_|, before it was | 205 // The original TabContentsDelegate of |dragged_contents_|, before it was |
| 205 // detached from the browser window. We store this so that we can forward | 206 // detached from the browser window. We store this so that we can forward |
| 206 // certain delegate notifications back to it if we can't handle them locally. | 207 // certain delegate notifications back to it if we can't handle them locally. |
| 207 TabContentsDelegate* original_delegate_; | 208 TabContentsDelegate* original_delegate_; |
| 208 | 209 |
| 209 // The tab that initiated the drag session. | 210 // The tab that initiated the drag session. |
| 210 TabGtk* source_tab_; | 211 TabGtk* source_tab_; |
| 211 | 212 |
| 212 // The tab strip |source_tab_| originated from. | 213 // The tab strip |source_tab_| originated from. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 263 |
| 263 // Timer used to bring the window under the cursor to front. If the user | 264 // Timer used to bring the window under the cursor to front. If the user |
| 264 // stops moving the mouse for a brief time over a browser window, it is | 265 // stops moving the mouse for a brief time over a browser window, it is |
| 265 // brought to front. | 266 // brought to front. |
| 266 base::OneShotTimer<DraggedTabControllerGtk> bring_to_front_timer_; | 267 base::OneShotTimer<DraggedTabControllerGtk> bring_to_front_timer_; |
| 267 | 268 |
| 268 DISALLOW_COPY_AND_ASSIGN(DraggedTabControllerGtk); | 269 DISALLOW_COPY_AND_ASSIGN(DraggedTabControllerGtk); |
| 269 }; | 270 }; |
| 270 | 271 |
| 271 #endif // CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_ | 272 #endif // CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_CONTROLLER_GTK_H_ |
| OLD | NEW |