| 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 #include <limits> | 5 #include <limits> |
| 6 | 6 |
| 7 #include "chrome/browser/views/tabs/tab_renderer.h" | 7 #include "chrome/browser/views/tabs/tab_renderer.h" |
| 8 | 8 |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 hover_animation_->SetSlideDuration(kHoverDurationMs); | 229 hover_animation_->SetSlideDuration(kHoverDurationMs); |
| 230 | 230 |
| 231 pulse_animation_.reset(new ThrobAnimation(this)); | 231 pulse_animation_.reset(new ThrobAnimation(this)); |
| 232 pulse_animation_->SetSlideDuration(kPulseDurationMs); | 232 pulse_animation_->SetSlideDuration(kPulseDurationMs); |
| 233 } | 233 } |
| 234 | 234 |
| 235 TabRenderer::~TabRenderer() { | 235 TabRenderer::~TabRenderer() { |
| 236 delete crash_animation_; | 236 delete crash_animation_; |
| 237 } | 237 } |
| 238 | 238 |
| 239 void TabRenderer::UpdateData(TabContents* contents) { | 239 void TabRenderer::UpdateData(TabContents* contents, bool loading_only) { |
| 240 DCHECK(contents); | 240 DCHECK(contents); |
| 241 data_.favicon = contents->GetFavIcon(); | 241 if (!loading_only) { |
| 242 data_.title = UTF16ToWideHack(contents->GetTitle()); | 242 data_.title = UTF16ToWideHack(contents->GetTitle()); |
| 243 data_.off_the_record = contents->profile()->IsOffTheRecord(); |
| 244 data_.show_download_icon = contents->IsDownloadShelfVisible(); |
| 245 data_.crashed = contents->is_crashed(); |
| 246 data_.favicon = contents->GetFavIcon(); |
| 247 } |
| 248 |
| 249 // Loading state also involves whether we show the favicon, since that's where |
| 250 // we display the throbber. |
| 243 data_.loading = contents->is_loading(); | 251 data_.loading = contents->is_loading(); |
| 244 data_.off_the_record = contents->profile()->IsOffTheRecord(); | |
| 245 data_.show_icon = contents->ShouldDisplayFavIcon(); | 252 data_.show_icon = contents->ShouldDisplayFavIcon(); |
| 246 data_.show_download_icon = contents->IsDownloadShelfVisible(); | |
| 247 data_.crashed = contents->is_crashed(); | |
| 248 } | 253 } |
| 249 | 254 |
| 250 void TabRenderer::UpdateFromModel() { | 255 void TabRenderer::UpdateFromModel() { |
| 251 // Force a layout, since the tab may have grown a favicon. | 256 // Force a layout, since the tab may have grown a favicon. |
| 252 Layout(); | 257 Layout(); |
| 253 SchedulePaint(); | 258 SchedulePaint(); |
| 254 | 259 |
| 255 if (data_.crashed) { | 260 if (data_.crashed) { |
| 256 if (!should_display_crashed_favicon_ && !IsPerformingCrashAnimation()) | 261 if (!should_display_crashed_favicon_ && !IsPerformingCrashAnimation()) |
| 257 StartCrashAnimation(); | 262 StartCrashAnimation(); |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 tab_inactive_otr.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_OTR); | 699 tab_inactive_otr.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_OTR); |
| 695 tab_inactive_otr.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_OTR); | 700 tab_inactive_otr.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_OTR); |
| 696 tab_inactive_otr.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_OTR); | 701 tab_inactive_otr.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_OTR); |
| 697 } | 702 } |
| 698 | 703 |
| 699 tab_inactive.l_width = tab_inactive.image_l->width(); | 704 tab_inactive.l_width = tab_inactive.image_l->width(); |
| 700 tab_inactive.r_width = tab_inactive.image_r->width(); | 705 tab_inactive.r_width = tab_inactive.image_r->width(); |
| 701 // tab_[hover,inactive_otr] width are not used and are initialized to 0 | 706 // tab_[hover,inactive_otr] width are not used and are initialized to 0 |
| 702 // during static initialization. | 707 // during static initialization. |
| 703 } | 708 } |
| OLD | NEW |