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/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/timer.h" | 12 #include "base/timer.h" |
13 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
14 #include "chrome/browser/ui/tabs/dock_info.h" | 14 #include "chrome/browser/ui/tabs/dock_info.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_selection_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_selection_model.h" |
17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/web_contents_delegate.h" | 19 #include "content/public/browser/web_contents_delegate.h" |
20 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget_observer.h" |
22 | 22 |
23 namespace views { | 23 namespace views { |
24 class View; | 24 class View; |
25 } | 25 } |
26 class BaseTab; | 26 class BaseTab; |
27 class Browser; | 27 class Browser; |
28 class DraggedTabView; | 28 class DraggedTabView; |
29 struct TabRendererData; | 29 struct TabRendererData; |
30 class TabStrip; | 30 class TabStrip; |
31 class TabStripModel; | 31 class TabStripModel; |
(...skipping 11 matching lines...) Expand all Loading... |
43 // can happen (this state is referred to as detached): | 43 // can happen (this state is referred to as detached): |
44 // . If |detach_into_browser_| is true then a new Browser is created and | 44 // . If |detach_into_browser_| is true then a new Browser is created and |
45 // RunMoveLoop() is invoked on the Widget to drag the browser around. This is | 45 // RunMoveLoop() is invoked on the Widget to drag the browser around. This is |
46 // the default on chromeos and can be enabled on windows with a flag. | 46 // the default on chromeos and can be enabled on windows with a flag. |
47 // . If |detach_into_browser_| is false a small representation of the active tab | 47 // . If |detach_into_browser_| is false a small representation of the active tab |
48 // is created and that is dragged around. This mode does not run a nested | 48 // is created and that is dragged around. This mode does not run a nested |
49 // message loop. | 49 // message loop. |
50 class TabDragController : public content::WebContentsDelegate, | 50 class TabDragController : public content::WebContentsDelegate, |
51 public content::NotificationObserver, | 51 public content::NotificationObserver, |
52 public MessageLoopForUI::Observer, | 52 public MessageLoopForUI::Observer, |
53 public views::Widget::Observer, | 53 public views::WidgetObserver, |
54 public TabStripModelObserver { | 54 public TabStripModelObserver { |
55 public: | 55 public: |
56 enum DetachBehavior { | 56 enum DetachBehavior { |
57 DETACHABLE, | 57 DETACHABLE, |
58 NOT_DETACHABLE | 58 NOT_DETACHABLE |
59 }; | 59 }; |
60 | 60 |
61 // What should happen as the mouse is dragged within the tabstrip. | 61 // What should happen as the mouse is dragged within the tabstrip. |
62 enum MoveBehavior { | 62 enum MoveBehavior { |
63 // Only the set of visible tabs should change. This is only applicable when | 63 // Only the set of visible tabs should change. This is only applicable when |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // Overridden from content::NotificationObserver: | 220 // Overridden from content::NotificationObserver: |
221 virtual void Observe(int type, | 221 virtual void Observe(int type, |
222 const content::NotificationSource& source, | 222 const content::NotificationSource& source, |
223 const content::NotificationDetails& details) OVERRIDE; | 223 const content::NotificationDetails& details) OVERRIDE; |
224 | 224 |
225 // Overridden from MessageLoop::Observer: | 225 // Overridden from MessageLoop::Observer: |
226 virtual base::EventStatus WillProcessEvent( | 226 virtual base::EventStatus WillProcessEvent( |
227 const base::NativeEvent& event) OVERRIDE; | 227 const base::NativeEvent& event) OVERRIDE; |
228 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; | 228 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; |
229 | 229 |
230 // Overriden from views::Widget::Observer: | 230 // Overriden from views::WidgetObserver: |
231 virtual void OnWidgetMoved(views::Widget* widget) OVERRIDE; | 231 virtual void OnWidgetMoved(views::Widget* widget) OVERRIDE; |
232 | 232 |
233 // Overriden from TabStripModelObserver: | 233 // Overriden from TabStripModelObserver: |
234 virtual void TabStripEmpty() OVERRIDE; | 234 virtual void TabStripEmpty() OVERRIDE; |
235 | 235 |
236 // Initialize the offset used to calculate the position to create windows | 236 // Initialize the offset used to calculate the position to create windows |
237 // in |GetWindowCreatePoint|. This should only be invoked from |Init|. | 237 // in |GetWindowCreatePoint|. This should only be invoked from |Init|. |
238 void InitWindowCreatePoint(); | 238 void InitWindowCreatePoint(); |
239 | 239 |
240 // Returns the point where a detached window should be created given the | 240 // Returns the point where a detached window should be created given the |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 // Non-null for the duration of RunMoveLoop. | 567 // Non-null for the duration of RunMoveLoop. |
568 views::Widget* move_loop_widget_; | 568 views::Widget* move_loop_widget_; |
569 | 569 |
570 // If non-null set to true from destructor. | 570 // If non-null set to true from destructor. |
571 bool* destroyed_; | 571 bool* destroyed_; |
572 | 572 |
573 DISALLOW_COPY_AND_ASSIGN(TabDragController); | 573 DISALLOW_COPY_AND_ASSIGN(TabDragController); |
574 }; | 574 }; |
575 | 575 |
576 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 576 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
OLD | NEW |