OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/views/tabs/tab.h" | 5 #include "chrome/browser/views/tabs/tab.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "app/multi_animation.h" | 9 #include "app/multi_animation.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 // static | 178 // static |
179 int Tab::GetMiniWidth() { | 179 int Tab::GetMiniWidth() { |
180 return browser_defaults::kMiniTabWidth; | 180 return browser_defaults::kMiniTabWidth; |
181 } | 181 } |
182 | 182 |
183 //////////////////////////////////////////////////////////////////////////////// | 183 //////////////////////////////////////////////////////////////////////////////// |
184 // Tab, protected: | 184 // Tab, protected: |
185 | 185 |
186 void Tab::DataChanged(const TabRendererData& old) { | 186 void Tab::DataChanged(const TabRendererData& old) { |
187 if (data().phantom) | |
188 StopMiniTabTitleAnimation(); | |
189 | |
190 if (data().blocked != old.blocked) { | 187 if (data().blocked != old.blocked) { |
191 if (data().blocked) | 188 if (data().blocked) |
192 StartPulse(); | 189 StartPulse(); |
193 else | 190 else |
194 StopPulse(); | 191 StopPulse(); |
195 } | 192 } |
196 } | 193 } |
197 | 194 |
198 //////////////////////////////////////////////////////////////////////////////// | 195 //////////////////////////////////////////////////////////////////////////////// |
199 // Tab, views::View overrides: | 196 // Tab, views::View overrides: |
200 | 197 |
201 void Tab::Paint(gfx::Canvas* canvas) { | 198 void Tab::Paint(gfx::Canvas* canvas) { |
202 if (render_as_new_tab_) { | 199 if (render_as_new_tab_) { |
203 if (base::i18n::IsRTL()) { | 200 if (base::i18n::IsRTL()) { |
204 canvas->TranslateInt(width(), 0); | 201 canvas->TranslateInt(width(), 0); |
205 canvas->ScaleInt(-1, 1); | 202 canvas->ScaleInt(-1, 1); |
206 } | 203 } |
207 PaintAsNewTab(canvas); | 204 PaintAsNewTab(canvas); |
208 return; | 205 return; |
209 } | 206 } |
210 | 207 |
211 // Don't paint if we're narrower than we can render correctly. (This should | 208 // Don't paint if we're narrower than we can render correctly. (This should |
212 // only happen during animations). | 209 // only happen during animations). |
213 if (width() < GetMinimumUnselectedSize().width() && !data().mini) | 210 if (width() < GetMinimumUnselectedSize().width() && !data().mini) |
214 return; | 211 return; |
215 | 212 |
216 // See if the model changes whether the icons should be painted. | 213 // See if the model changes whether the icons should be painted. |
217 const bool show_icon = ShouldShowIcon() && !data().phantom; | 214 const bool show_icon = ShouldShowIcon(); |
218 const bool show_close_button = ShouldShowCloseBox(); | 215 const bool show_close_button = ShouldShowCloseBox(); |
219 if (show_icon != showing_icon_ || show_close_button != showing_close_button_) | 216 if (show_icon != showing_icon_ || show_close_button != showing_close_button_) |
220 Layout(); | 217 Layout(); |
221 | 218 |
222 PaintTabBackground(canvas); | 219 PaintTabBackground(canvas); |
223 | 220 |
224 SkColor title_color = GetThemeProvider()-> | 221 SkColor title_color = GetThemeProvider()-> |
225 GetColor(IsSelected() ? | 222 GetColor(IsSelected() ? |
226 BrowserThemeProvider::COLOR_TAB_TEXT : | 223 BrowserThemeProvider::COLOR_TAB_TEXT : |
227 BrowserThemeProvider::COLOR_BACKGROUND_TAB_TEXT); | 224 BrowserThemeProvider::COLOR_BACKGROUND_TAB_TEXT); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 tab_inactive_nano.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_LEFT); | 699 tab_inactive_nano.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_LEFT); |
703 tab_inactive_nano.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_CENTER); | 700 tab_inactive_nano.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_CENTER); |
704 tab_inactive_nano.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_RIGHT); | 701 tab_inactive_nano.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_RIGHT); |
705 tab_inactive_nano.l_width = tab_inactive_nano.image_l->width(); | 702 tab_inactive_nano.l_width = tab_inactive_nano.image_l->width(); |
706 tab_inactive_nano.r_width = tab_inactive_nano.image_r->width(); | 703 tab_inactive_nano.r_width = tab_inactive_nano.image_r->width(); |
707 tab_inactive_nano.y_offset = kNanoTabDiffHeight; | 704 tab_inactive_nano.y_offset = kNanoTabDiffHeight; |
708 | 705 |
709 new_tab_mask = rb.GetBitmapNamed(IDR_TAB_ALPHA_NEW_TAB); | 706 new_tab_mask = rb.GetBitmapNamed(IDR_TAB_ALPHA_NEW_TAB); |
710 new_tab_shadow = rb.GetBitmapNamed(IDR_TAB_NEW_TAB_SHADOW); | 707 new_tab_shadow = rb.GetBitmapNamed(IDR_TAB_NEW_TAB_SHADOW); |
711 } | 708 } |
OLD | NEW |