| 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_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Retrieves the ideal bounds for the Tab at the specified index. | 137 // Retrieves the ideal bounds for the Tab at the specified index. |
| 138 const gfx::Rect& ideal_bounds(int tab_data_index) { | 138 const gfx::Rect& ideal_bounds(int tab_data_index) { |
| 139 return tabs_.ideal_bounds(tab_data_index); | 139 return tabs_.ideal_bounds(tab_data_index); |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Returns the Tab at |index|. | 142 // Returns the Tab at |index|. |
| 143 Tab* tab_at(int index) const { | 143 Tab* tab_at(int index) const { |
| 144 return static_cast<Tab*>(tabs_.view_at(index)); | 144 return static_cast<Tab*>(tabs_.view_at(index)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Returns the index of the specified tab in the model coordinate system, or | |
| 148 // -1 if tab is closing or not valid. | |
| 149 int GetModelIndexOfTab(const Tab* tab) const; | |
| 150 | |
| 151 // Gets the number of Tabs in the tab strip. | |
| 152 int tab_count() const { return tabs_.view_size(); } | |
| 153 | |
| 154 // Cover method for TabStripController::GetCount. | 147 // Cover method for TabStripController::GetCount. |
| 155 int GetModelCount() const; | 148 int GetModelCount() const; |
| 156 | 149 |
| 157 // Cover method for TabStripController::IsValidIndex. | 150 // Cover method for TabStripController::IsValidIndex. |
| 158 bool IsValidModelIndex(int model_index) const; | 151 bool IsValidModelIndex(int model_index) const; |
| 159 | 152 |
| 160 TabStripController* controller() const { return controller_.get(); } | 153 TabStripController* controller() const { return controller_.get(); } |
| 161 | 154 |
| 162 // Returns true if a drag session is currently active. | 155 // Returns true if a drag session is currently active. |
| 163 bool IsDragSessionActive() const; | 156 bool IsDragSessionActive() const; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // NOTE: the drag and drop methods are invoked from FrameView. This is done | 236 // NOTE: the drag and drop methods are invoked from FrameView. This is done |
| 244 // to allow for a drop region that extends outside the bounds of the TabStrip. | 237 // to allow for a drop region that extends outside the bounds of the TabStrip. |
| 245 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; | 238 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
| 246 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 239 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
| 247 virtual void OnDragExited() OVERRIDE; | 240 virtual void OnDragExited() OVERRIDE; |
| 248 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 241 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
| 249 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 242 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
| 250 virtual views::View* GetEventHandlerForRect(const gfx::Rect& rect) OVERRIDE; | 243 virtual views::View* GetEventHandlerForRect(const gfx::Rect& rect) OVERRIDE; |
| 251 virtual views::View* GetTooltipHandlerForPoint( | 244 virtual views::View* GetTooltipHandlerForPoint( |
| 252 const gfx::Point& point) OVERRIDE; | 245 const gfx::Point& point) OVERRIDE; |
| 246 virtual int GetModelIndexOfTab(const Tab* tab) const OVERRIDE; |
| 247 virtual int GetTabCount() const OVERRIDE; |
| 253 | 248 |
| 254 // Returns preferred height in immersive style. | 249 // Returns preferred height in immersive style. |
| 255 static int GetImmersiveHeight(); | 250 static int GetImmersiveHeight(); |
| 256 | 251 |
| 257 private: | 252 private: |
| 258 typedef std::vector<Tab*> Tabs; | 253 typedef std::vector<Tab*> Tabs; |
| 259 typedef std::map<int, Tabs> TabsClosingMap; | 254 typedef std::map<int, Tabs> TabsClosingMap; |
| 260 typedef std::pair<TabsClosingMap::iterator, | 255 typedef std::pair<TabsClosingMap::iterator, |
| 261 Tabs::iterator> FindClosingTabResult; | 256 Tabs::iterator> FindClosingTabResult; |
| 262 | 257 |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 bool immersive_style_; | 666 bool immersive_style_; |
| 672 | 667 |
| 673 // Our observers. | 668 // Our observers. |
| 674 typedef ObserverList<TabStripObserver> TabStripObservers; | 669 typedef ObserverList<TabStripObserver> TabStripObservers; |
| 675 TabStripObservers observers_; | 670 TabStripObservers observers_; |
| 676 | 671 |
| 677 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 672 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
| 678 }; | 673 }; |
| 679 | 674 |
| 680 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 675 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| OLD | NEW |