| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/tabs/base_tab.h" | 5 #include "chrome/browser/ui/views/tabs/base_tab.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 close_button_->SetAnimationDuration(0); | 165 close_button_->SetAnimationDuration(0); |
| 166 AddChildView(close_button_); | 166 AddChildView(close_button_); |
| 167 | 167 |
| 168 SetContextMenuController(this); | 168 SetContextMenuController(this); |
| 169 } | 169 } |
| 170 | 170 |
| 171 BaseTab::~BaseTab() { | 171 BaseTab::~BaseTab() { |
| 172 } | 172 } |
| 173 | 173 |
| 174 void BaseTab::SetData(const TabRendererData& data) { | 174 void BaseTab::SetData(const TabRendererData& data) { |
| 175 if (data_.Equals(data)) |
| 176 return; |
| 177 |
| 175 TabRendererData old(data_); | 178 TabRendererData old(data_); |
| 176 data_ = data; | 179 data_ = data; |
| 177 | 180 |
| 178 if (data_.IsCrashed()) { | 181 if (data_.IsCrashed()) { |
| 179 if (!should_display_crashed_favicon_ && !IsPerformingCrashAnimation()) { | 182 if (!should_display_crashed_favicon_ && !IsPerformingCrashAnimation()) { |
| 180 // When --reload-killed-tabs is specified, then the idea is that | 183 // When --reload-killed-tabs is specified, then the idea is that |
| 181 // when tab is killed, the tab has no visual indication that it | 184 // when tab is killed, the tab has no visual indication that it |
| 182 // died and should reload when the tab is next focused without | 185 // died and should reload when the tab is next focused without |
| 183 // the user seeing the killed tab page. | 186 // the user seeing the killed tab page. |
| 184 // | 187 // |
| (...skipping 19 matching lines...) Expand all Loading... |
| 204 StopCrashAnimation(); | 207 StopCrashAnimation(); |
| 205 ResetCrashedFavIcon(); | 208 ResetCrashedFavIcon(); |
| 206 } | 209 } |
| 207 | 210 |
| 208 // Sets the accessible name for the tab. | 211 // Sets the accessible name for the tab. |
| 209 SetAccessibleName(data_.title); | 212 SetAccessibleName(data_.title); |
| 210 | 213 |
| 211 DataChanged(old); | 214 DataChanged(old); |
| 212 | 215 |
| 213 Layout(); | 216 Layout(); |
| 217 SchedulePaint(); |
| 214 } | 218 } |
| 215 | 219 |
| 216 void BaseTab::UpdateLoadingAnimation(TabRendererData::NetworkState state) { | 220 void BaseTab::UpdateLoadingAnimation(TabRendererData::NetworkState state) { |
| 217 // If this is an extension app and a command line flag is set, | 221 // If this is an extension app and a command line flag is set, |
| 218 // then disable the throbber. | 222 // then disable the throbber. |
| 219 throbber_disabled_ = data().app && | 223 throbber_disabled_ = data().app && |
| 220 CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsNoThrob); | 224 CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsNoThrob); |
| 221 | 225 |
| 222 if (throbber_disabled_) | 226 if (throbber_disabled_) |
| 223 return; | 227 return; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // static | 522 // static |
| 519 void BaseTab::InitResources() { | 523 void BaseTab::InitResources() { |
| 520 static bool initialized = false; | 524 static bool initialized = false; |
| 521 if (!initialized) { | 525 if (!initialized) { |
| 522 initialized = true; | 526 initialized = true; |
| 523 font_ = new gfx::Font( | 527 font_ = new gfx::Font( |
| 524 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); | 528 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); |
| 525 font_height_ = font_->GetHeight(); | 529 font_height_ = font_->GetHeight(); |
| 526 } | 530 } |
| 527 } | 531 } |
| OLD | NEW |