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 ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ | 5 #ifndef ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ |
6 #define ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ | 6 #define ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ |
7 | 7 |
8 #include "ash/launcher/launcher_button.h" | 8 #include "ash/launcher/launcher_button.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/timer.h" | 10 #include "base/timer.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 STATE_INCOGNITO, | 30 STATE_INCOGNITO, |
31 STATE_NOT_INCOGNITO, | 31 STATE_NOT_INCOGNITO, |
32 }; | 32 }; |
33 | 33 |
34 static TabbedLauncherButton* Create(views::ButtonListener* listener, | 34 static TabbedLauncherButton* Create(views::ButtonListener* listener, |
35 LauncherButtonHost* host, | 35 LauncherButtonHost* host, |
36 IncognitoState is_incognito); | 36 IncognitoState is_incognito); |
37 virtual ~TabbedLauncherButton(); | 37 virtual ~TabbedLauncherButton(); |
38 | 38 |
39 // Sets the images to display for this entry. | 39 // Sets the images to display for this entry. |
40 void SetTabImage(const SkBitmap& image); | 40 void SetTabImage(const gfx::ImageSkia& image); |
41 | 41 |
42 // This only defines how the icon is drawn. Do not use it for other purposes. | 42 // This only defines how the icon is drawn. Do not use it for other purposes. |
43 IncognitoState is_incognito() const { return is_incognito_; } | 43 IncognitoState is_incognito() const { return is_incognito_; } |
44 | 44 |
45 protected: | 45 protected: |
46 TabbedLauncherButton(views::ButtonListener* listener, | 46 TabbedLauncherButton(views::ButtonListener* listener, |
47 LauncherButtonHost* host, | 47 LauncherButtonHost* host, |
48 IncognitoState is_incognito); | 48 IncognitoState is_incognito); |
49 // View override. | 49 // View override. |
50 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 50 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
51 | 51 |
52 // LauncherButton override. | 52 // LauncherButton override. |
53 virtual IconView* CreateIconView() OVERRIDE; | 53 virtual IconView* CreateIconView() OVERRIDE; |
54 | 54 |
55 private: | 55 private: |
56 // Used as the delegate for |animation_|. | 56 // Used as the delegate for |animation_|. |
57 class IconView : public LauncherButton::IconView, | 57 class IconView : public LauncherButton::IconView, |
58 public ui::AnimationDelegate { | 58 public ui::AnimationDelegate { |
59 public: | 59 public: |
60 explicit IconView(TabbedLauncherButton* host); | 60 explicit IconView(TabbedLauncherButton* host); |
61 virtual ~IconView(); | 61 virtual ~IconView(); |
62 | 62 |
63 // ui::AnimationDelegateImpl overrides: | 63 // ui::AnimationDelegateImpl overrides: |
64 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 64 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
65 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 65 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
66 | 66 |
67 // Sets the image to display for this entry. | 67 // Sets the image to display for this entry. |
68 void SetTabImage(const SkBitmap& image); | 68 void SetTabImage(const gfx::ImageSkia& image); |
69 | 69 |
70 protected: | 70 protected: |
71 // View override. | 71 // View override. |
72 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 72 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
73 | 73 |
74 private: | 74 private: |
75 TabbedLauncherButton* host_; | 75 TabbedLauncherButton* host_; |
76 SkBitmap image_; | 76 gfx::ImageSkia image_; |
77 SkBitmap animating_image_; | 77 gfx::ImageSkia animating_image_; |
78 | 78 |
79 // Used to animate image. | 79 // Used to animate image. |
80 scoped_ptr<ui::MultiAnimation> animation_; | 80 scoped_ptr<ui::MultiAnimation> animation_; |
81 | 81 |
82 // Background images. Which one is chosen depends on the type of the window. | 82 // Background images. Which one is chosen depends on the type of the window. |
83 static SkBitmap* browser_image_; | 83 static SkBitmap* browser_image_; |
84 static SkBitmap* incognito_browser_image_; | 84 static SkBitmap* incognito_browser_image_; |
85 // TODO[dave] implement panel specific image. | 85 // TODO[dave] implement panel specific image. |
86 static SkBitmap* browser_panel_image_; | 86 static SkBitmap* browser_panel_image_; |
87 static SkBitmap* incognito_browser_panel_image_; | 87 static SkBitmap* incognito_browser_panel_image_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(IconView); | 89 DISALLOW_COPY_AND_ASSIGN(IconView); |
90 }; | 90 }; |
91 | 91 |
92 IconView* tabbed_icon_view() { | 92 IconView* tabbed_icon_view() { |
93 return static_cast<IconView*>(icon_view()); | 93 return static_cast<IconView*>(icon_view()); |
94 } | 94 } |
95 | 95 |
96 // Indicates how the icon is drawn. If true an Incognito symbol will be | 96 // Indicates how the icon is drawn. If true an Incognito symbol will be |
97 // drawn. It does not necessarily indicate if the window is 'incognito'. | 97 // drawn. It does not necessarily indicate if the window is 'incognito'. |
98 const IncognitoState is_incognito_; | 98 const IncognitoState is_incognito_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton); | 100 DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton); |
101 }; | 101 }; |
102 | 102 |
103 } // namespace internal | 103 } // namespace internal |
104 } // namespace ash | 104 } // namespace ash |
105 | 105 |
106 #endif // ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ | 106 #endif // ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ |
OLD | NEW |