diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-18 02:00:53 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-18 02:00:53 +0000 |
commit | 7a16aeeb28850afdf5d512cc2e4bb2e58f4b1c10 (patch) | |
tree | 1070bdfc922ca45660dc6bf56b26fc19dfeba7d6 /chrome/browser/views/tab_icon_view.cc | |
parent | f47c61458a0c89c9ec57b3bb3a51d4ef46528ca6 (diff) | |
download | chromium_src-7a16aeeb28850afdf5d512cc2e4bb2e58f4b1c10.zip chromium_src-7a16aeeb28850afdf5d512cc2e4bb2e58f4b1c10.tar.gz chromium_src-7a16aeeb28850afdf5d512cc2e4bb2e58f4b1c10.tar.bz2 |
Last couple of bits of new-frame related cleanup:
- Remove frame_util.cc, moving functions to BrowserList (endsession) and BrowserView (GetBrowserWindowForHWND)
- Tidy up interface for TabIconView model. The model now sources only the information it needs (loading state and favicon).
- Replace BrowserType class with an enum on Browser.
http://crbug.com/2320
http://crbug.com/3363
Review URL: http://codereview.chromium.org/10786
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5596 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tab_icon_view.cc')
-rw-r--r-- | chrome/browser/views/tab_icon_view.cc | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/chrome/browser/views/tab_icon_view.cc b/chrome/browser/views/tab_icon_view.cc index 245a38d..46595f6 100644 --- a/chrome/browser/views/tab_icon_view.cc +++ b/chrome/browser/views/tab_icon_view.cc @@ -50,8 +50,8 @@ void TabIconView::InitializeIfNeeded() { } } -TabIconView::TabIconView(TabContentsProvider* provider) - : provider_(provider), +TabIconView::TabIconView(TabIconViewModel* model) + : model_(model), is_light_(false), throbber_running_(false), throbber_frame_(0) { @@ -62,10 +62,9 @@ TabIconView::~TabIconView() { } void TabIconView::Update() { - TabContents* contents = provider_->GetCurrentTabContents(); if (throbber_running_) { // We think the tab is loading. - if (!contents || !contents->is_loading()) { + if (!model_->ShouldTabIconViewAnimate()) { // Woops, tab is invalid or not loading, reset our status and schedule // a paint. throbber_running_ = false; @@ -75,7 +74,7 @@ void TabIconView::Update() { throbber_frame_ = (throbber_frame_ + 1) % g_throbber_frame_count; SchedulePaint(); } - } else if (contents && contents->is_loading()) { + } else if (model_->ShouldTabIconViewAnimate()) { // We didn't think we were loading, but the tab is loading. Reset the // frame and status and schedule a paint. throbber_running_ = true; @@ -106,25 +105,21 @@ void TabIconView::PaintFavIcon(ChromeCanvas* canvas, const SkBitmap& bitmap) { } void TabIconView::Paint(ChromeCanvas* canvas) { - TabContents* contents = provider_->GetCurrentTabContents(); bool rendered = false; - if (contents) { - if (throbber_running_) { + if (throbber_running_) { + rendered = true; + PaintThrobber(canvas); + } else { + SkBitmap favicon = model_->GetFavIconForTabIconView(); + if (!favicon.isNull()) { rendered = true; - PaintThrobber(canvas); - } else { - SkBitmap favicon = provider_->GetFavIcon(); - if (!favicon.isNull()) { - rendered = true; - PaintFavIcon(canvas, favicon); - } + PaintFavIcon(canvas, favicon); } } - if (!rendered) { + if (!rendered) PaintFavIcon(canvas, *g_default_fav_icon); - } } gfx::Size TabIconView::GetPreferredSize() { |