1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/views/view.h"
13 class TabIconViewModel;
20 // A view to display a tab favicon or a throbber.
21 class TabIconView : public views::View {
23 static void InitializeIfNeeded();
25 explicit TabIconView(chrome::TabIconViewModel* model);
26 virtual ~TabIconView();
28 // Invoke whenever the tab state changes or the throbber should update.
31 // Set the throbber to the light style (for use on dark backgrounds).
32 void set_is_light(bool is_light) { is_light_ = is_light; }
34 // Overridden from View
35 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
36 virtual gfx::Size GetPreferredSize() OVERRIDE;
39 void PaintThrobber(gfx::Canvas* canvas);
40 void PaintFavicon(gfx::Canvas* canvas, const gfx::ImageSkia& image);
41 void PaintIcon(gfx::Canvas* canvas,
42 const gfx::ImageSkia& image,
50 chrome::TabIconViewModel* model_;
52 // Whether the throbber is running.
53 bool throbber_running_;
55 // Whether we should display our light or dark style.
58 // Current frame of the throbber being painted. This is only used if
59 // throbber_running_ is true.
62 DISALLOW_COPY_AND_ASSIGN(TabIconView);
65 #endif // CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_