Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / views / tab_icon_view.h
blob4f3d722d5978e9b7c83df46ac7481b7dfbcbbc45
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/controls/button/menu_button.h"
11 #include "ui/views/view.h"
13 namespace chrome {
14 class TabIconViewModel;
17 namespace gfx {
18 class ImageSkia;
21 // A view to display a tab favicon or a throbber.
22 class TabIconView : public views::MenuButton {
23 public:
24 static void InitializeIfNeeded();
26 TabIconView(chrome::TabIconViewModel* model,
27 views::MenuButtonListener* menu_button_listener);
28 ~TabIconView() override;
30 // Invoke whenever the tab state changes or the throbber should update.
31 void Update();
33 // Set the throbber to the light style (for use on dark backgrounds).
34 void set_is_light(bool is_light) { is_light_ = is_light; }
36 private:
37 // views::MenuButton:
38 gfx::Size GetPreferredSize() const override;
39 const char* GetClassName() const override;
40 void OnPaint(gfx::Canvas* canvas) override;
42 void PaintThrobber(gfx::Canvas* canvas);
43 void PaintFavicon(gfx::Canvas* canvas, const gfx::ImageSkia& image);
44 void PaintIcon(gfx::Canvas* canvas,
45 const gfx::ImageSkia& image,
46 int src_x,
47 int src_y,
48 int src_w,
49 int src_h,
50 bool filter);
52 // Our model.
53 chrome::TabIconViewModel* model_;
55 // Whether the throbber is running.
56 bool throbber_running_;
58 // Whether we should display our light or dark style.
59 bool is_light_;
61 // Current frame of the throbber being painted. This is only used if
62 // throbber_running_ is true.
63 int throbber_frame_;
65 DISALLOW_COPY_AND_ASSIGN(TabIconView);
68 #endif // CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_