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_TAB_STRIP_H__ | 5 #ifndef CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H__ |
6 #define CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H__ | 6 #define CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H__ |
7 | 7 |
8 #include "base/gfx/point.h" | 8 #include "base/gfx/point.h" |
9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
10 #include "chrome/browser/views/tabs/tab.h" | 10 #include "chrome/browser/views/tabs/tab.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // Destroys the active drag controller. | 86 // Destroys the active drag controller. |
87 void DestroyDragController(); | 87 void DestroyDragController(); |
88 | 88 |
89 // Removes the drag source Tab from this TabStrip, and deletes it. | 89 // Removes the drag source Tab from this TabStrip, and deletes it. |
90 void DestroyDraggedSourceTab(Tab* tab); | 90 void DestroyDraggedSourceTab(Tab* tab); |
91 | 91 |
92 // Retrieve the ideal bounds for the Tab at the specified index. | 92 // Retrieve the ideal bounds for the Tab at the specified index. |
93 gfx::Rect GetIdealBounds(int index); | 93 gfx::Rect GetIdealBounds(int index); |
94 | 94 |
| 95 // Updates loading animations for the TabStrip. |
| 96 void UpdateLoadingAnimations(); |
| 97 |
95 // views::View overrides: | 98 // views::View overrides: |
96 virtual void PaintChildren(ChromeCanvas* canvas); | 99 virtual void PaintChildren(ChromeCanvas* canvas); |
97 virtual views::View* GetViewByID(int id) const; | 100 virtual views::View* GetViewByID(int id) const; |
98 virtual void Layout(); | 101 virtual void Layout(); |
99 virtual gfx::Size GetPreferredSize(); | 102 virtual gfx::Size GetPreferredSize(); |
100 // NOTE: the drag and drop methods are invoked from FrameView. This is done to | 103 // NOTE: the drag and drop methods are invoked from FrameView. This is done to |
101 // allow for a drop region that extends outside the bounds of the TabStrip. | 104 // allow for a drop region that extends outside the bounds of the TabStrip. |
102 virtual void OnDragEntered(const views::DropTargetEvent& event); | 105 virtual void OnDragEntered(const views::DropTargetEvent& event); |
103 virtual int OnDragUpdated(const views::DropTargetEvent& event); | 106 virtual int OnDragUpdated(const views::DropTargetEvent& event); |
104 virtual void OnDragExited(); | 107 virtual void OnDragExited(); |
(...skipping 10 matching lines...) Expand all Loading... |
115 virtual void TabInsertedAt(TabContents* contents, | 118 virtual void TabInsertedAt(TabContents* contents, |
116 int index, | 119 int index, |
117 bool foreground); | 120 bool foreground); |
118 virtual void TabDetachedAt(TabContents* contents, int index); | 121 virtual void TabDetachedAt(TabContents* contents, int index); |
119 virtual void TabSelectedAt(TabContents* old_contents, | 122 virtual void TabSelectedAt(TabContents* old_contents, |
120 TabContents* contents, | 123 TabContents* contents, |
121 int index, | 124 int index, |
122 bool user_gesture); | 125 bool user_gesture); |
123 virtual void TabMoved(TabContents* contents, int from_index, int to_index); | 126 virtual void TabMoved(TabContents* contents, int from_index, int to_index); |
124 virtual void TabChangedAt(TabContents* contents, int index); | 127 virtual void TabChangedAt(TabContents* contents, int index); |
125 virtual void TabValidateAnimations(); | |
126 | 128 |
127 // Tab::Delegate implementation: | 129 // Tab::Delegate implementation: |
128 virtual bool IsTabSelected(const Tab* tab) const; | 130 virtual bool IsTabSelected(const Tab* tab) const; |
129 virtual void SelectTab(Tab* tab); | 131 virtual void SelectTab(Tab* tab); |
130 virtual void CloseTab(Tab* tab); | 132 virtual void CloseTab(Tab* tab); |
131 virtual bool IsCommandEnabledForTab( | 133 virtual bool IsCommandEnabledForTab( |
132 TabStripModel::ContextMenuCommand command_id, const Tab* tab) const; | 134 TabStripModel::ContextMenuCommand command_id, const Tab* tab) const; |
133 virtual void ExecuteCommandForTab( | 135 virtual void ExecuteCommandForTab( |
134 TabStripModel::ContextMenuCommand command_id, Tab* tab); | 136 TabStripModel::ContextMenuCommand command_id, Tab* tab); |
135 virtual void StartHighlightTabsForCommand( | 137 virtual void StartHighlightTabsForCommand( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // which is defined as the region above the TabStrip and a bit below it. | 199 // which is defined as the region above the TabStrip and a bit below it. |
198 // Note: this method cannot be const because |ConvertPointToScreen| is not. | 200 // Note: this method cannot be const because |ConvertPointToScreen| is not. |
199 // #@*($&(#!!! | 201 // #@*($&(#!!! |
200 bool IsCursorInTabStripZone(); | 202 bool IsCursorInTabStripZone(); |
201 | 203 |
202 // Ensure that the message loop observer used for event spying is added and | 204 // Ensure that the message loop observer used for event spying is added and |
203 // removed appropriately so we can tell when to resize layout the tab strip. | 205 // removed appropriately so we can tell when to resize layout the tab strip. |
204 void AddMessageLoopObserver(); | 206 void AddMessageLoopObserver(); |
205 void RemoveMessageLoopObserver(); | 207 void RemoveMessageLoopObserver(); |
206 | 208 |
207 // Called to update the frame of the Loading animations. | |
208 void LoadingAnimationCallback(); | |
209 | |
210 // -- Link Drag & Drop ------------------------------------------------------ | 209 // -- Link Drag & Drop ------------------------------------------------------ |
211 | 210 |
212 // Returns the bounds to render the drop at, in screen coordinates. Sets | 211 // Returns the bounds to render the drop at, in screen coordinates. Sets |
213 // |is_beneath| to indicate whether the arrow is beneath the tab, or above | 212 // |is_beneath| to indicate whether the arrow is beneath the tab, or above |
214 // it. | 213 // it. |
215 gfx::Rect GetDropBounds(int drop_index, bool drop_before, bool* is_beneath); | 214 gfx::Rect GetDropBounds(int drop_index, bool drop_before, bool* is_beneath); |
216 | 215 |
217 // Updates the location of the drop based on the event. | 216 // Updates the location of the drop based on the event. |
218 void UpdateDropIndex(const views::DropTargetEvent& event); | 217 void UpdateDropIndex(const views::DropTargetEvent& event); |
219 | 218 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 ScopedRunnableMethodFactory<TabStrip> resize_layout_factory_; | 282 ScopedRunnableMethodFactory<TabStrip> resize_layout_factory_; |
284 | 283 |
285 // True if the TabStrip has already been added as a MessageLoop observer. | 284 // True if the TabStrip has already been added as a MessageLoop observer. |
286 bool added_as_message_loop_observer_; | 285 bool added_as_message_loop_observer_; |
287 | 286 |
288 // True if a resize layout animation should be run a short delay after the | 287 // True if a resize layout animation should be run a short delay after the |
289 // mouse exits the TabStrip. | 288 // mouse exits the TabStrip. |
290 // TODO(beng): (Cleanup) this would be better named "needs_resize_layout_". | 289 // TODO(beng): (Cleanup) this would be better named "needs_resize_layout_". |
291 bool resize_layout_scheduled_; | 290 bool resize_layout_scheduled_; |
292 | 291 |
293 // The timer used to update frames for the Loading Animation. | |
294 base::RepeatingTimer<TabStrip> loading_animation_timer_; | |
295 | |
296 // The "New Tab" button. | 292 // The "New Tab" button. |
297 views::Button* newtab_button_; | 293 views::Button* newtab_button_; |
298 gfx::Size newtab_button_size_; | 294 gfx::Size newtab_button_size_; |
299 gfx::Size actual_newtab_button_size_; | 295 gfx::Size actual_newtab_button_size_; |
300 | 296 |
301 // The current widths of various types of tabs. We save these so that, as | 297 // The current widths of various types of tabs. We save these so that, as |
302 // users close tabs while we're holding them at the same size, we can lay out | 298 // users close tabs while we're holding them at the same size, we can lay out |
303 // tabs exactly and eliminate the "pixel jitter" we'd get from just leaving | 299 // tabs exactly and eliminate the "pixel jitter" we'd get from just leaving |
304 // them all at their existing, rounded widths. | 300 // them all at their existing, rounded widths. |
305 double current_unselected_width_; | 301 double current_unselected_width_; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 std::vector<TabData> tab_data_; | 354 std::vector<TabData> tab_data_; |
359 | 355 |
360 // The currently running animation. | 356 // The currently running animation. |
361 scoped_ptr<TabAnimation> active_animation_; | 357 scoped_ptr<TabAnimation> active_animation_; |
362 | 358 |
363 DISALLOW_EVIL_CONSTRUCTORS(TabStrip); | 359 DISALLOW_EVIL_CONSTRUCTORS(TabStrip); |
364 }; | 360 }; |
365 | 361 |
366 #endif // CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H__ | 362 #endif // CHROME_BROWSER_VIEWS_TABS_TAB_STRIP_H__ |
367 | 363 |
OLD | NEW |