From b2204fb914f96e9cc505c640aeb7986b25124ca0 Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Mon, 6 Apr 2009 21:30:27 +0000 Subject: Implement loading animations. I've ignored the app mode and popup cases since I don't think the Linux port supports those modes yet. I also ignored RTL. I've made some minor lint/style cleanups along the way. BUG=9380 Review URL: http://codereview.chromium.org/60104 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13195 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/tabs/tab_strip_gtk.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'chrome/browser/gtk/tabs/tab_strip_gtk.cc') diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index 7e9a153..1c0e5c4 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -102,6 +102,26 @@ void TabStripGtk::Layout() { gtk_widget_queue_draw(tabstrip_.get()); } +void TabStripGtk::UpdateLoadingAnimations() { + for (int i = 0, index = 0; i < GetTabCount(); ++i, ++index) { + TabGtk* current_tab = GetTabAt(i); + if (current_tab->closing()) { + --index; + } else { + TabContents* contents = model_->GetTabContentsAt(index); + if (!contents || !contents->is_loading()) { + current_tab->ValidateLoadingAnimation(TabGtk::ANIMATION_NONE); + } else if (contents->waiting_for_response()) { + current_tab->ValidateLoadingAnimation(TabGtk::ANIMATION_WAITING); + } else { + current_tab->ValidateLoadingAnimation(TabGtk::ANIMATION_LOADING); + } + } + } + + gtk_widget_queue_draw(tabstrip_.get()); +} + //////////////////////////////////////////////////////////////////////////////// // TabStripGtk, TabStripModelObserver implementation: @@ -294,7 +314,8 @@ int TabStripGtk::GetIndexOfTab(const TabGtk* tab) const { } TabGtk* TabStripGtk::GetTabAt(int index) const { - DCHECK(index >= 0 && index < GetTabCount()); + DCHECK_GE(index, 0); + DCHECK_LT(index, GetTabCount()); return tab_data_.at(index).tab; } -- cgit v1.1