| 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 "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/timer.h" | 10 #include "base/timer.h" |
| 11 #include "ui/base/animation/animation_delegate.h" | 11 #include "ui/base/animation/animation_delegate.h" |
| 12 #include "ui/views/controls/button/image_button.h" | 12 #include "ui/views/controls/button/image_button.h" |
| 13 #include "ui/views/controls/glow_hover_controller.h" | 13 #include "ui/views/controls/glow_hover_controller.h" |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 class MultiAnimation; | 16 class MultiAnimation; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 |
| 21 class LauncherItem; |
| 22 |
| 20 namespace internal { | 23 namespace internal { |
| 21 | 24 |
| 22 class LauncherButtonHost; | 25 class LauncherButtonHost; |
| 23 | 26 |
| 24 // Button used for items on the launcher corresponding to tabbed windows. | 27 // Button used for items on the launcher corresponding to tabbed windows. |
| 25 class TabbedLauncherButton : public views::ImageButton { | 28 class TabbedLauncherButton : public views::ImageButton { |
| 26 public: | 29 public: |
| 27 TabbedLauncherButton(views::ButtonListener* listener, | 30 TabbedLauncherButton(views::ButtonListener* listener, |
| 28 LauncherButtonHost* host); | 31 LauncherButtonHost* host); |
| 29 virtual ~TabbedLauncherButton(); | 32 virtual ~TabbedLauncherButton(); |
| 30 | 33 |
| 31 // Notification that the images are about to change. Kicks off an animation. | 34 // Notification that the images are about to change. Kicks off an animation. |
| 32 void PrepareForImageChange(); | 35 void PrepareForImageChange(); |
| 33 | 36 |
| 34 // Sets the images to display for this entry. | 37 // Sets the images to display for this entry. |
| 35 void SetTabImage(const SkBitmap& image, int count); | 38 void SetTabImage(const LauncherItem& item); |
| 36 | 39 |
| 37 protected: | 40 protected: |
| 38 // View overrides: | 41 // View overrides: |
| 39 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 42 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 40 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 43 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 41 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 44 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
| 42 virtual void OnMouseCaptureLost() OVERRIDE; | 45 virtual void OnMouseCaptureLost() OVERRIDE; |
| 43 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; | 46 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; |
| 44 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 47 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
| 45 virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE; | 48 virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 AnimationDelegateImpl animation_delegate_; | 86 AnimationDelegateImpl animation_delegate_; |
| 84 | 87 |
| 85 // Used to animate image. | 88 // Used to animate image. |
| 86 scoped_ptr<ui::MultiAnimation> animation_; | 89 scoped_ptr<ui::MultiAnimation> animation_; |
| 87 | 90 |
| 88 // Should |images_| be shown? This is set to false soon after | 91 // Should |images_| be shown? This is set to false soon after |
| 89 // PrepareForImageChange() is invoked without a following call to SetImages(). | 92 // PrepareForImageChange() is invoked without a following call to SetImages(). |
| 90 bool show_image_; | 93 bool show_image_; |
| 91 | 94 |
| 92 // Background images. Which one is chosen depends upon how many images are | 95 // Background images. Which one is chosen depends upon how many images are |
| 93 // provided. | 96 // provided and if the browser window is incognito. |
| 94 static ImageSet* bg_image_1_; | 97 static ImageSet* bg_image_1_; |
| 95 static ImageSet* bg_image_2_; | 98 static ImageSet* bg_image_2_; |
| 96 static ImageSet* bg_image_3_; | 99 static ImageSet* bg_image_3_; |
| 97 | 100 |
| 101 static ImageSet* bg_private_image_1_; |
| 102 static ImageSet* bg_private_image_2_; |
| 103 static ImageSet* bg_private_image_3_; |
| 104 |
| 98 views::GlowHoverController hover_controller_; | 105 views::GlowHoverController hover_controller_; |
| 99 | 106 |
| 100 DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton); | 107 DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton); |
| 101 }; | 108 }; |
| 102 | 109 |
| 103 } // namespace internal | 110 } // namespace internal |
| 104 } // namespace ash | 111 } // namespace ash |
| 105 | 112 |
| 106 #endif // ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ | 113 #endif // ASH_LAUNCHER_TABBED_LAUNCHER_BUTTON_H_ |
| OLD | NEW |