| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| 11 | 11 |
| 12 class SkBitmap; |
| 13 |
| 12 namespace gfx { | 14 namespace gfx { |
| 13 class ImageSkia; | 15 class ImageSkia; |
| 14 } | 16 } |
| 15 | 17 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
| 17 // | 19 // |
| 18 // A view to display a tab favicon or a throbber. | 20 // A view to display a tab favicon or a throbber. |
| 19 // | 21 // |
| 20 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
| 21 class TabIconView : public views::View { | 23 class TabIconView : public views::View { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 42 void set_is_light(bool is_light) { is_light_ = is_light; } | 44 void set_is_light(bool is_light) { is_light_ = is_light; } |
| 43 | 45 |
| 44 // Overridden from View | 46 // Overridden from View |
| 45 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 47 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 46 virtual gfx::Size GetPreferredSize() OVERRIDE; | 48 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 47 | 49 |
| 48 private: | 50 private: |
| 49 void PaintThrobber(gfx::Canvas* canvas); | 51 void PaintThrobber(gfx::Canvas* canvas); |
| 50 void PaintFavicon(gfx::Canvas* canvas, const SkBitmap& bitmap); | 52 void PaintFavicon(gfx::Canvas* canvas, const SkBitmap& bitmap); |
| 51 void PaintIcon(gfx::Canvas* canvas, | 53 void PaintIcon(gfx::Canvas* canvas, |
| 52 const SkBitmap& bitmap, | 54 const gfx::ImageSkia& image, |
| 53 int src_x, | 55 int src_x, |
| 54 int src_y, | 56 int src_y, |
| 55 int src_w, | 57 int src_w, |
| 56 int src_h, | 58 int src_h, |
| 57 bool filter); | 59 bool filter); |
| 58 | 60 |
| 59 // Our model. | 61 // Our model. |
| 60 TabIconViewModel* model_; | 62 TabIconViewModel* model_; |
| 61 | 63 |
| 62 // Whether the throbber is running. | 64 // Whether the throbber is running. |
| 63 bool throbber_running_; | 65 bool throbber_running_; |
| 64 | 66 |
| 65 // Whether we should display our light or dark style. | 67 // Whether we should display our light or dark style. |
| 66 bool is_light_; | 68 bool is_light_; |
| 67 | 69 |
| 68 // Current frame of the throbber being painted. This is only used if | 70 // Current frame of the throbber being painted. This is only used if |
| 69 // throbber_running_ is true. | 71 // throbber_running_ is true. |
| 70 int throbber_frame_; | 72 int throbber_frame_; |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(TabIconView); | 74 DISALLOW_COPY_AND_ASSIGN(TabIconView); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 #endif // CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_ | 77 #endif // CHROME_BROWSER_UI_VIEWS_TAB_ICON_VIEW_H_ |
| OLD | NEW |