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

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

Issue 598013003: Added views::ViewModelT<T>, a type-safe template version of ViewModel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@appsgridview-static-casts
Patch Set: Created 6 years, 2 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
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_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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // Invoked when the title of a tab changes and the tab isn't loading. 136 // Invoked when the title of a tab changes and the tab isn't loading.
137 void TabTitleChangedNotLoading(int model_index); 137 void TabTitleChangedNotLoading(int model_index);
138 138
139 // Retrieves the ideal bounds for the Tab at the specified index. 139 // Retrieves the ideal bounds for the Tab at the specified index.
140 const gfx::Rect& ideal_bounds(int tab_data_index) { 140 const gfx::Rect& ideal_bounds(int tab_data_index) {
141 return tabs_.ideal_bounds(tab_data_index); 141 return tabs_.ideal_bounds(tab_data_index);
142 } 142 }
143 143
144 // Returns the Tab at |index|. 144 // Returns the Tab at |index|.
145 Tab* tab_at(int index) const { 145 Tab* tab_at(int index) const {
146 return static_cast<Tab*>(tabs_.view_at(index)); 146 return tabs_.view_at(index);
147 } 147 }
148 148
149 // Returns the index of the specified tab in the model coordinate system, or 149 // Returns the index of the specified tab in the model coordinate system, or
150 // -1 if tab is closing or not valid. 150 // -1 if tab is closing or not valid.
151 int GetModelIndexOfTab(const Tab* tab) const; 151 int GetModelIndexOfTab(const Tab* tab) const;
152 152
153 // Gets the number of Tabs in the tab strip. 153 // Gets the number of Tabs in the tab strip.
154 int tab_count() const { return tabs_.view_size(); } 154 int tab_count() const { return tabs_.view_size(); }
155 155
156 // Cover method for TabStripController::GetCount. 156 // Cover method for TabStripController::GetCount.
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 588
589 // -- Member Variables ------------------------------------------------------ 589 // -- Member Variables ------------------------------------------------------
590 590
591 // There is a one-to-one mapping between each of the tabs in the 591 // There is a one-to-one mapping between each of the tabs in the
592 // TabStripController (TabStripModel) and |tabs_|. Because we animate tab 592 // TabStripController (TabStripModel) and |tabs_|. Because we animate tab
593 // removal there exists a period of time where a tab is displayed but not in 593 // removal there exists a period of time where a tab is displayed but not in
594 // the model. When this occurs the tab is removed from |tabs_| and placed in 594 // the model. When this occurs the tab is removed from |tabs_| and placed in
595 // |tabs_closing_map_|. When the animation completes the tab is removed from 595 // |tabs_closing_map_|. When the animation completes the tab is removed from
596 // |tabs_closing_map_|. The painting code ensures both sets of tabs are 596 // |tabs_closing_map_|. The painting code ensures both sets of tabs are
597 // painted, and the event handling code ensures only tabs in |tabs_| are used. 597 // painted, and the event handling code ensures only tabs in |tabs_| are used.
598 views::ViewModel tabs_; 598 views::ViewModel<Tab> tabs_;
599 TabsClosingMap tabs_closing_map_; 599 TabsClosingMap tabs_closing_map_;
600 600
601 scoped_ptr<TabStripController> controller_; 601 scoped_ptr<TabStripController> controller_;
602 602
603 // The "New Tab" button. 603 // The "New Tab" button.
604 NewTabButton* newtab_button_; 604 NewTabButton* newtab_button_;
605 605
606 // Ideal bounds of the new tab button. 606 // Ideal bounds of the new tab button.
607 gfx::Rect newtab_button_bounds_; 607 gfx::Rect newtab_button_bounds_;
608 608
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 bool immersive_style_; 678 bool immersive_style_;
679 679
680 // Our observers. 680 // Our observers.
681 typedef ObserverList<TabStripObserver> TabStripObservers; 681 typedef ObserverList<TabStripObserver> TabStripObservers;
682 TabStripObservers observers_; 682 TabStripObservers observers_;
683 683
684 DISALLOW_COPY_AND_ASSIGN(TabStrip); 684 DISALLOW_COPY_AND_ASSIGN(TabStrip);
685 }; 685 };
686 686
687 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ 687 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698