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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/launcher/launcher_button.h" | 9 #include "ash/launcher/launcher_button.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/timer.h" | 11 #include "base/timer.h" |
12 #include "ui/base/animation/animation_delegate.h" | 12 #include "ui/base/animation/animation_delegate.h" |
13 #include "ui/views/controls/button/image_button.h" | 13 #include "ui/views/controls/button/image_button.h" |
14 #include "ui/views/controls/glow_hover_controller.h" | 14 #include "ui/views/controls/glow_hover_controller.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 class MultiAnimation; | 17 class MultiAnimation; |
18 } | 18 } |
19 | 19 |
20 namespace ash { | 20 namespace ash { |
| 21 |
| 22 class LauncherItem; |
| 23 |
21 namespace internal { | 24 namespace internal { |
22 | 25 |
23 // Button used for items on the launcher corresponding to tabbed windows. | 26 // Button used for items on the launcher corresponding to tabbed windows. |
24 class TabbedLauncherButton : public LauncherButton { | 27 class TabbedLauncherButton : public LauncherButton { |
25 public: | 28 public: |
| 29 // Indicates if this button is incognito or not. |
| 30 enum IncognitoState { |
| 31 STATE_INCOGNITO, |
| 32 STATE_NOT_INCOGNITO, |
| 33 }; |
| 34 |
26 static TabbedLauncherButton* Create(views::ButtonListener* listener, | 35 static TabbedLauncherButton* Create(views::ButtonListener* listener, |
27 LauncherButtonHost* host); | 36 LauncherButtonHost* host, |
| 37 IncognitoState is_incognito); |
28 virtual ~TabbedLauncherButton(); | 38 virtual ~TabbedLauncherButton(); |
29 | 39 |
30 // Notification that the images are about to change. Kicks off an animation. | 40 // Notification that the images are about to change. Kicks off an animation. |
31 void PrepareForImageChange(); | 41 void PrepareForImageChange(); |
32 | 42 |
33 // Sets the images to display for this entry. | 43 // Sets the images to display for this entry. |
34 void SetTabImage(const SkBitmap& image); | 44 void SetTabImage(const SkBitmap& image); |
35 | 45 |
36 protected: | 46 protected: |
37 TabbedLauncherButton(views::ButtonListener* listener, | 47 TabbedLauncherButton(views::ButtonListener* listener, |
38 LauncherButtonHost* host); | 48 LauncherButtonHost* host, |
| 49 IncognitoState is_incognito); |
39 // View override. | 50 // View override. |
40 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 51 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
41 | 52 |
42 // LauncherButton override. | 53 // LauncherButton override. |
43 virtual IconView* CreateIconView() OVERRIDE; | 54 virtual IconView* CreateIconView() OVERRIDE; |
44 | 55 |
45 private: | 56 private: |
46 // Used as the delegate for |animation_|. | 57 // Used as the delegate for |animation_|. |
47 class IconView : public LauncherButton::IconView, | 58 class IconView : public LauncherButton::IconView, |
48 public ui::AnimationDelegate { | 59 public ui::AnimationDelegate { |
49 public: | 60 public: |
50 explicit IconView(TabbedLauncherButton* host); | 61 IconView(TabbedLauncherButton* host, IncognitoState is_incognito); |
51 virtual ~IconView(); | 62 virtual ~IconView(); |
52 | 63 |
53 // ui::AnimationDelegateImpl overrides: | 64 // ui::AnimationDelegateImpl overrides: |
54 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 65 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
55 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 66 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
56 | 67 |
57 // Notification that the images are about to change. Kicks off an animation. | 68 // Notification that the images are about to change. Kicks off an animation. |
58 void PrepareForImageChange(); | 69 void PrepareForImageChange(); |
59 | 70 |
60 // Sets the image to display for this entry. | 71 // Sets the image to display for this entry. |
(...skipping 10 matching lines...) Expand all Loading... |
71 // Used to animate image. | 82 // Used to animate image. |
72 scoped_ptr<ui::MultiAnimation> animation_; | 83 scoped_ptr<ui::MultiAnimation> animation_; |
73 | 84 |
74 // Should |image_| be shown? This is set to false soon after | 85 // Should |image_| be shown? This is set to false soon after |
75 // PrepareForImageChange() is invoked without a following call to | 86 // PrepareForImageChange() is invoked without a following call to |
76 // SetImages(). | 87 // SetImages(). |
77 bool show_image_; | 88 bool show_image_; |
78 | 89 |
79 // Background images. Which one is chosen depends on the type of the window. | 90 // Background images. Which one is chosen depends on the type of the window. |
80 static SkBitmap* browser_image_; | 91 static SkBitmap* browser_image_; |
| 92 static SkBitmap* incognito_browser_image_; |
81 // TODO[dave] implement panel specific image. | 93 // TODO[dave] implement panel specific image. |
82 static SkBitmap* browser_panel_image_; | 94 static SkBitmap* browser_panel_image_; |
| 95 static SkBitmap* incognito_browser_panel_image_; |
83 | 96 |
84 DISALLOW_COPY_AND_ASSIGN(IconView); | 97 DISALLOW_COPY_AND_ASSIGN(IconView); |
85 }; | 98 }; |
86 | 99 |
87 IconView* tabbed_icon_view() { | 100 IconView* tabbed_icon_view() { |
88 return static_cast<IconView*>(icon_view()); | 101 return static_cast<IconView*>(icon_view()); |
89 } | 102 } |
90 | 103 |
| 104 // Indicates if the tabbed browser associated with this is an incognito |
| 105 // window. |
| 106 const IncognitoState is_incognito_; |
| 107 |
91 DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton); | 108 DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton); |
92 }; | 109 }; |
93 | 110 |
94 } // namespace internal | 111 } // namespace internal |
95 } // namespace ash | 112 } // namespace ash |
96 | 113 |
97 #endif // ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ | 114 #endif // ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ |
OLD | NEW |