Move "pack" button in the top toolbar to an action in the list of unpacked items.
[chromium-blink-merge.git] / ash / launcher / tabbed_launcher_button.h
blob6eb0b9eb6aa539422c3e84810ffeda696cc2cfbd
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 ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_
6 #define ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_
8 #include "ash/launcher/launcher_button.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/timer.h"
11 #include "ui/base/animation/animation_delegate.h"
12 #include "ui/views/controls/button/image_button.h"
13 #include "ui/views/controls/glow_hover_controller.h"
15 namespace gfx {
16 class ImageSkia;
19 namespace ui {
20 class MultiAnimation;
23 namespace ash {
25 struct LauncherItem;
27 namespace internal {
29 // Button used for items on the launcher corresponding to tabbed windows.
30 class TabbedLauncherButton : public LauncherButton {
31 public:
32 // Indicates if this button is incognito or not.
33 enum IncognitoState {
34 STATE_INCOGNITO,
35 STATE_NOT_INCOGNITO,
38 static TabbedLauncherButton* Create(views::ButtonListener* listener,
39 LauncherButtonHost* host,
40 ShelfLayoutManager* shelf_layout_manager,
41 IncognitoState is_incognito);
42 virtual ~TabbedLauncherButton();
44 // Sets the images to display for this entry.
45 void SetTabImage(const gfx::ImageSkia& image);
47 // This only defines how the icon is drawn. Do not use it for other purposes.
48 IncognitoState is_incognito() const { return is_incognito_; }
50 protected:
51 TabbedLauncherButton(views::ButtonListener* listener,
52 LauncherButtonHost* host,
53 ShelfLayoutManager* shelf_layout_manager,
54 IncognitoState is_incognito);
55 // View override.
56 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
58 // LauncherButton override.
59 virtual IconView* CreateIconView() OVERRIDE;
61 private:
62 // Used as the delegate for |animation_|.
63 class IconView : public LauncherButton::IconView,
64 public ui::AnimationDelegate {
65 public:
66 explicit IconView(TabbedLauncherButton* host);
67 virtual ~IconView();
69 // ui::AnimationDelegateImpl overrides:
70 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
71 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
73 // Sets the image to display for this entry.
74 void SetTabImage(const gfx::ImageSkia& image);
76 protected:
77 // View override.
78 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
80 private:
81 TabbedLauncherButton* host_;
82 gfx::ImageSkia image_;
83 gfx::ImageSkia animating_image_;
85 // Used to animate image.
86 scoped_ptr<ui::MultiAnimation> animation_;
88 // Background images. Which one is chosen depends on the type of the window.
89 static const gfx::ImageSkia* browser_image_;
90 static const gfx::ImageSkia* incognito_browser_image_;
91 // TODO[dave] implement panel specific image.
92 static const gfx::ImageSkia* browser_panel_image_;
93 static const gfx::ImageSkia* incognito_browser_panel_image_;
95 DISALLOW_COPY_AND_ASSIGN(IconView);
98 IconView* tabbed_icon_view() {
99 return static_cast<IconView*>(icon_view());
102 // Indicates how the icon is drawn. If true an Incognito symbol will be
103 // drawn. It does not necessarily indicate if the window is 'incognito'.
104 const IncognitoState is_incognito_;
106 DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton);
109 } // namespace internal
110 } // namespace ash
112 #endif // ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_