Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller2.h

Issue 10162017: Re-reland Propagate OnNativeWidgetMove to delegate/observers, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 TabContentsWrapper; 29 class TabContentsWrapper;
30 struct TabRendererData; 30 struct TabRendererData;
31 class TabStripModel; 31 class TabStripModel;
32 32
33 // Implementation of TabDragController that creates a real Browser. 33 // Implementation of TabDragController that creates a real Browser.
34 class TabDragController2 : public TabDragController, 34 class TabDragController2 : public TabDragController,
35 public content::NotificationObserver, 35 public content::NotificationObserver,
36 public MessageLoopForUI::Observer, 36 public MessageLoopForUI::Observer,
37 public BrowserWindowMoveObserver, 37 public views::Widget::Observer,
38 public TabStripModelObserver { 38 public TabStripModelObserver {
39 public: 39 public:
40 TabDragController2(); 40 TabDragController2();
41 virtual ~TabDragController2(); 41 virtual ~TabDragController2();
42 42
43 // Initializes TabDragController2 to drag the tabs in |tabs| originating 43 // Initializes TabDragController2 to drag the tabs in |tabs| originating
44 // from |source_tabstrip|. |source_tab| is the tab that initiated the drag and 44 // 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 45 // 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| 46 // 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 47 // the offset from |source_tab|. |source_tab_offset| is the horizontal distant
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 const content::NotificationSource& source, 131 const content::NotificationSource& source,
132 const content::NotificationDetails& details) OVERRIDE; 132 const content::NotificationDetails& details) OVERRIDE;
133 133
134 // Overridden from MessageLoop::Observer: 134 // Overridden from MessageLoop::Observer:
135 #if defined(OS_WIN) || defined(USE_AURA) 135 #if defined(OS_WIN) || defined(USE_AURA)
136 virtual base::EventStatus WillProcessEvent( 136 virtual base::EventStatus WillProcessEvent(
137 const base::NativeEvent& event) OVERRIDE; 137 const base::NativeEvent& event) OVERRIDE;
138 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; 138 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
139 #endif 139 #endif
140 140
141 // Overriden from BrowserWindowMoveObserver: 141 // Overriden from views::Widget::Observer:
142 virtual void OnWidgetMoved() OVERRIDE; 142 virtual void OnWidgetMoved(views::Widget* widget) OVERRIDE;
143 143
144 // Overriden from TabStripModelObserver: 144 // Overriden from TabStripModelObserver:
145 virtual void TabStripEmpty() OVERRIDE; 145 virtual void TabStripEmpty() OVERRIDE;
146 146
147 // Initialize the offset used to calculate the position to create windows 147 // Initialize the offset used to calculate the position to create windows
148 // in |GetWindowCreatePoint|. This should only be invoked from |Init|. 148 // in |GetWindowCreatePoint|. This should only be invoked from |Init|.
149 void InitWindowCreatePoint(TabStrip* tab_strip); 149 void InitWindowCreatePoint(TabStrip* tab_strip);
150 150
151 // Returns the point where a detached window should be created given the 151 // Returns the point where a detached window should be created given the
152 // current mouse position. 152 // current mouse position.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 return source_tab_drag_data()->contents; 264 return source_tab_drag_data()->contents;
265 } 265 }
266 266
267 // Returns true if the tabs were originality one after the other in 267 // Returns true if the tabs were originality one after the other in
268 // |source_tabstrip_|. 268 // |source_tabstrip_|.
269 bool AreTabsConsecutive(); 269 bool AreTabsConsecutive();
270 270
271 // Returns the TabStripModel for the specified tabstrip. 271 // Returns the TabStripModel for the specified tabstrip.
272 static TabStripModel* GetModel(TabStrip* tabstrip); 272 static TabStripModel* GetModel(TabStrip* tabstrip);
273 273
274 // Returns the BrowserView of the currently attached TabStrip. 274 // Returns the Widget of the currently attached TabStrip's BrowserView.
275 BrowserView* GetAttachedBrowserView(); 275 views::Widget* GetAttachedBrowserWidget();
276 276
277 // Creates and returns a new Browser to handle the drag. 277 // Creates and returns a new Browser to handle the drag.
278 Browser* CreateBrowserForDrag(TabStrip* source, 278 Browser* CreateBrowserForDrag(TabStrip* source,
279 const gfx::Point& screen_point, 279 const gfx::Point& screen_point,
280 std::vector<gfx::Rect>* drag_bounds); 280 std::vector<gfx::Rect>* drag_bounds);
281 281
282 // Marks whether |window| is constrained. While dragging we set this to false 282 // Marks whether |window| is constrained. While dragging we set this to false
283 // to allow maximized windows to move any where. 283 // to allow maximized windows to move any where.
284 void SetTrackedByWorkspace(gfx::NativeWindow window, bool value); 284 void SetTrackedByWorkspace(gfx::NativeWindow window, bool value);
285 285
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 EndRunLoopBehavior end_run_loop_behavior_; 378 EndRunLoopBehavior end_run_loop_behavior_;
379 379
380 // If true, we're waiting for a move loop to complete. 380 // If true, we're waiting for a move loop to complete.
381 bool waiting_for_run_loop_to_exit_; 381 bool waiting_for_run_loop_to_exit_;
382 382
383 // The TabStrip to attach to after the move loop completes. 383 // The TabStrip to attach to after the move loop completes.
384 TabStrip* tab_strip_to_attach_to_after_exit_; 384 TabStrip* tab_strip_to_attach_to_after_exit_;
385 385
386 // Non-null for the duration of RunMoveLoop. 386 // Non-null for the duration of RunMoveLoop.
387 BrowserView* move_loop_browser_view_; 387 views::Widget* move_loop_widget_;
388 388
389 // If non-null set to true from destructor. 389 // If non-null set to true from destructor.
390 bool* destroyed_; 390 bool* destroyed_;
391 391
392 DISALLOW_COPY_AND_ASSIGN(TabDragController2); 392 DISALLOW_COPY_AND_ASSIGN(TabDragController2);
393 }; 393 };
394 394
395 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER2_H_ 395 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER2_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_window_move_observer.h ('k') | chrome/browser/ui/views/tabs/tab_drag_controller2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698