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_CONTROLLER2_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER2_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER2_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER2_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/timer.h" | 13 #include "base/timer.h" |
14 #include "chrome/browser/tabs/tab_strip_model_observer.h" | 14 #include "chrome/browser/tabs/tab_strip_model_observer.h" |
15 #include "chrome/browser/tabs/tab_strip_selection_model.h" | 15 #include "chrome/browser/tabs/tab_strip_selection_model.h" |
16 #include "chrome/browser/ui/tabs/dock_info.h" | 16 #include "chrome/browser/ui/tabs/dock_info.h" |
17 #include "chrome/browser/ui/views/frame/browser_window_move_observer.h" | |
18 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" | 17 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" |
19 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
21 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| 21 #include "ui/views/widget/widget.h" |
22 | 22 |
23 namespace views { | 23 namespace views { |
24 class View; | 24 class View; |
25 } | 25 } // namespace views |
| 26 |
26 class BaseTab; | 27 class BaseTab; |
27 class Browser; | 28 class Browser; |
28 class BrowserView; | 29 class BrowserView; |
29 class TabContentsWrapper; | 30 class TabContentsWrapper; |
30 struct TabRendererData; | 31 struct TabRendererData; |
31 class TabStripModel; | 32 class TabStripModel; |
32 | 33 |
33 // Implementation of TabDragController that creates a real Browser. | 34 // Implementation of TabDragController that creates a real Browser. |
34 class TabDragController2 : public TabDragController, | 35 class TabDragController2 : public TabDragController, |
35 public content::NotificationObserver, | 36 public content::NotificationObserver, |
36 public MessageLoopForUI::Observer, | 37 public MessageLoopForUI::Observer, |
37 public BrowserWindowMoveObserver, | 38 public views::Widget::Observer, |
38 public TabStripModelObserver { | 39 public TabStripModelObserver { |
39 public: | 40 public: |
40 TabDragController2(); | 41 TabDragController2(); |
41 virtual ~TabDragController2(); | 42 virtual ~TabDragController2(); |
42 | 43 |
43 // Initializes TabDragController2 to drag the tabs in |tabs| originating | 44 // Initializes TabDragController2 to drag the tabs in |tabs| originating |
44 // from |source_tabstrip|. |source_tab| is the tab that initiated the drag and | 45 // from |source_tabstrip|. |source_tab| is the tab that initiated the drag and |
45 // is contained in |tabs|. |mouse_offset| is the distance of the mouse | 46 // is contained in |tabs|. |mouse_offset| is the distance of the mouse |
46 // pointer from the origin of the first tab in |tabs| and |source_tab_offset| | 47 // pointer from the origin of the first tab in |tabs| and |source_tab_offset| |
47 // the offset from |source_tab|. |source_tab_offset| is the horizontal distant | 48 // the offset from |source_tab|. |source_tab_offset| is the horizontal distant |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 const content::NotificationSource& source, | 132 const content::NotificationSource& source, |
132 const content::NotificationDetails& details) OVERRIDE; | 133 const content::NotificationDetails& details) OVERRIDE; |
133 | 134 |
134 // Overridden from MessageLoop::Observer: | 135 // Overridden from MessageLoop::Observer: |
135 #if defined(OS_WIN) || defined(USE_AURA) | 136 #if defined(OS_WIN) || defined(USE_AURA) |
136 virtual base::EventStatus WillProcessEvent( | 137 virtual base::EventStatus WillProcessEvent( |
137 const base::NativeEvent& event) OVERRIDE; | 138 const base::NativeEvent& event) OVERRIDE; |
138 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; | 139 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; |
139 #endif | 140 #endif |
140 | 141 |
141 // Overriden from BrowserWindowMoveObserver: | 142 // Overriden from views::Widget::Observer: |
142 virtual void OnWidgetMoved() OVERRIDE; | 143 virtual void OnWidgetMove(views::Widget* widget) OVERRIDE; |
143 | 144 |
144 // Overriden from TabStripModelObserver: | 145 // Overriden from TabStripModelObserver: |
145 virtual void TabStripEmpty() OVERRIDE; | 146 virtual void TabStripEmpty() OVERRIDE; |
146 | 147 |
147 // Initialize the offset used to calculate the position to create windows | 148 // Initialize the offset used to calculate the position to create windows |
148 // in |GetWindowCreatePoint|. This should only be invoked from |Init|. | 149 // in |GetWindowCreatePoint|. This should only be invoked from |Init|. |
149 void InitWindowCreatePoint(TabStrip* tab_strip); | 150 void InitWindowCreatePoint(TabStrip* tab_strip); |
150 | 151 |
151 // Returns the point where a detached window should be created given the | 152 // Returns the point where a detached window should be created given the |
152 // current mouse position. | 153 // current mouse position. |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 // Non-null for the duration of RunMoveLoop. | 387 // Non-null for the duration of RunMoveLoop. |
387 BrowserView* move_loop_browser_view_; | 388 BrowserView* move_loop_browser_view_; |
388 | 389 |
389 // If non-null set to true from destructor. | 390 // If non-null set to true from destructor. |
390 bool* destroyed_; | 391 bool* destroyed_; |
391 | 392 |
392 DISALLOW_COPY_AND_ASSIGN(TabDragController2); | 393 DISALLOW_COPY_AND_ASSIGN(TabDragController2); |
393 }; | 394 }; |
394 | 395 |
395 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER2_H_ | 396 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER2_H_ |
OLD | NEW |