OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include "chrome/browser/views/tabs/browser_tab_strip.h" | 5 #include "chrome/browser/views/tabs/browser_tab_strip.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "chrome/browser/tab_contents/tab_contents.h" | 8 #include "chrome/browser/tab_contents/tab_contents.h" |
| 9 #include "chrome/browser/views/tabs/tab_strip.h" // for CreateTabStrip only. |
9 | 10 |
10 namespace { | 11 namespace { |
11 | 12 |
12 //////////////////////////////////////////////////////////////////////////////// | 13 //////////////////////////////////////////////////////////////////////////////// |
13 // RemovingTabModel | 14 // RemovingTabModel |
14 // After a tab is removed from the TabStrip2's model, the model can no longer | 15 // After a tab is removed from the TabStrip2's model, the model can no longer |
15 // provide information about the tab needed to update the display, however the | 16 // provide information about the tab needed to update the display, however the |
16 // TabStrip2 continues to display the tab until it animates out of existence. | 17 // TabStrip2 continues to display the tab until it animates out of existence. |
17 // During this period, this model serves as a dummy. It is created and assigned | 18 // During this period, this model serves as a dummy. It is created and assigned |
18 // to the tab when the tab is removed from the model and owned by the Tab2. | 19 // to the tab when the tab is removed from the model and owned by the Tab2. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void BrowserTabStrip::MoveTabAt(int index, int to_index) { | 141 void BrowserTabStrip::MoveTabAt(int index, int to_index) { |
141 model_->MoveTabContentsAt(index, to_index, true); | 142 model_->MoveTabContentsAt(index, to_index, true); |
142 } | 143 } |
143 | 144 |
144 void BrowserTabStrip::DetachTabAt(int index, const gfx::Rect& window_bounds, | 145 void BrowserTabStrip::DetachTabAt(int index, const gfx::Rect& window_bounds, |
145 const gfx::Rect& tab_bounds) { | 146 const gfx::Rect& tab_bounds) { |
146 TabContents* contents = DetachTab(index); | 147 TabContents* contents = DetachTab(index); |
147 model_->delegate()->ContinueDraggingDetachedTab(contents, window_bounds, | 148 model_->delegate()->ContinueDraggingDetachedTab(contents, window_bounds, |
148 tab_bounds); | 149 tab_bounds); |
149 } | 150 } |
| 151 |
| 152 //////////////////////////////////////////////////////////////////////////////// |
| 153 // BrowserTabStrip, TabStripWrapper implementation: |
| 154 |
| 155 int BrowserTabStrip::GetPreferredHeight() { |
| 156 return GetPreferredSize().height(); |
| 157 } |
| 158 |
| 159 bool BrowserTabStrip::IsAnimating() const { |
| 160 return false; |
| 161 } |
| 162 |
| 163 void BrowserTabStrip::SetBackgroundOffset(gfx::Point offset) { |
| 164 } |
| 165 |
| 166 bool BrowserTabStrip::PointIsWithinWindowCaption( |
| 167 const gfx::Point& point) { |
| 168 return false; |
| 169 } |
| 170 |
| 171 bool BrowserTabStrip::IsDragSessionActive() const { |
| 172 return false; |
| 173 } |
| 174 |
| 175 bool BrowserTabStrip::IsCompatibleWith(TabStripWrapper* other) const { |
| 176 return false; |
| 177 } |
| 178 |
| 179 void BrowserTabStrip::SetDraggedTabBounds(int tab_index, |
| 180 const gfx::Rect& tab_bounds) { |
| 181 TabStrip2::SetDraggedTabBounds(tab_index, tab_bounds); |
| 182 } |
| 183 |
| 184 void BrowserTabStrip::UpdateLoadingAnimations() { |
| 185 } |
| 186 |
| 187 views::View* BrowserTabStrip::GetView() { |
| 188 return this; |
| 189 } |
| 190 |
| 191 BrowserTabStrip* BrowserTabStrip::AsBrowserTabStrip() { |
| 192 return this; |
| 193 } |
| 194 |
| 195 TabStrip* BrowserTabStrip::AsTabStrip() { |
| 196 return NULL; |
| 197 } |
| 198 |
| 199 //////////////////////////////////////////////////////////////////////////////// |
| 200 // TabStripWrapper, public: |
| 201 |
| 202 // static |
| 203 TabStripWrapper* TabStripWrapper::CreateTabStrip(TabStripModel* model) { |
| 204 if (TabStrip2::Enabled()) |
| 205 return new BrowserTabStrip(model); |
| 206 return new TabStrip(model); |
| 207 } |
OLD | NEW |