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

Unified Diff: chrome/browser/views/tabs/tab_strip.cc

Issue 10761: Rewire the throbber so that the timer for updating lives on BrowserView, not ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/tabs/tab_strip.cc
===================================================================
--- chrome/browser/views/tabs/tab_strip.cc (revision 5492)
+++ chrome/browser/views/tabs/tab_strip.cc (working copy)
@@ -32,14 +32,12 @@
#undef min
#undef max
-using base::TimeDelta;
using views::DropTargetEvent;
static const int kDefaultAnimationDurationMs = 100;
static const int kResizeLayoutAnimationDurationMs = 166;
static const int kReorderAnimationDurationMs = 166;
-static const int kLoadingAnimationFrameTimeMs = 30;
static const int kNewTabButtonHOffset = -5;
static const int kNewTabButtonVOffset = 5;
static const int kResizeTabsTimeMs = 300;
@@ -590,6 +588,24 @@
return tab_data_.at(index).ideal_bounds;
}
+void TabStrip::UpdateLoadingAnimations() {
+ for (int i = 0, index = 0; i < GetTabCount(); ++i, ++index) {
+ Tab* current_tab = GetTabAt(i);
+ if (current_tab->closing()) {
+ --index;
+ } else {
+ TabContents* contents = model_->GetTabContentsAt(index);
+ if (!contents || !contents->is_loading()) {
+ current_tab->ValidateLoadingAnimation(Tab::ANIMATION_NONE);
+ } else if (contents->waiting_for_response()) {
+ current_tab->ValidateLoadingAnimation(Tab::ANIMATION_WAITING);
+ } else {
+ current_tab->ValidateLoadingAnimation(Tab::ANIMATION_LOADING);
+ }
+ }
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// TabStrip, views::View overrides:
@@ -881,23 +897,6 @@
tab->UpdateFromModel();
}
-void TabStrip::TabValidateAnimations() {
- if (model_->TabsAreLoading()) {
- if (!loading_animation_timer_.IsRunning()) {
- // Loads are happening, and the timer isn't running, so start it.
- loading_animation_timer_.Start(
- TimeDelta::FromMilliseconds(kLoadingAnimationFrameTimeMs), this,
- &TabStrip::LoadingAnimationCallback);
- }
- } else {
- if (loading_animation_timer_.IsRunning()) {
- loading_animation_timer_.Stop();
- // Loads are now complete, update the state if a task was scheduled.
- LoadingAnimationCallback();
- }
- }
-}
-
///////////////////////////////////////////////////////////////////////////////
// TabStrip, Tab::Delegate implementation:
@@ -1253,29 +1252,6 @@
}
}
-void TabStrip::LoadingAnimationCallback() {
- for (int i = 0, index = 0; i < GetTabCount(); ++i, ++index) {
- Tab* current_tab = GetTabAt(i);
- if (current_tab->closing()) {
- --index;
- } else {
- TabContents* contents = model_->GetTabContentsAt(index);
- if (!contents || !contents->is_loading()) {
- current_tab->ValidateLoadingAnimation(Tab::ANIMATION_NONE);
- } else if (contents->waiting_for_response()) {
- current_tab->ValidateLoadingAnimation(Tab::ANIMATION_WAITING);
- } else {
- current_tab->ValidateLoadingAnimation(Tab::ANIMATION_LOADING);
- }
- }
- }
-
- // Make sure the model delegates updates the animation as well.
- TabStripModelDelegate* delegate;
- if (model_ && (delegate = model_->delegate()))
- delegate->ValidateLoadingAnimations();
-}
-
gfx::Rect TabStrip::GetDropBounds(int drop_index,
bool drop_before,
bool* is_beneath) {
« chrome/browser/views/frame/browser_view.cc ('K') | « chrome/browser/views/tabs/tab_strip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698