OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ADD_TO_APP_LAUNCHER_VIEW_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ADD_TO_APP_LAUNCHER_VIEW_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "ui/gfx/animation/animation_delegate.h" | |
10 #include "ui/gfx/animation/slide_animation.h" | |
11 #include "ui/views/painter.h" | |
12 #include "ui/views/view.h" | |
13 | |
14 class LocationBarView; | |
15 | |
16 namespace content { | |
17 class WebContents; | |
18 } | |
19 | |
20 namespace gfx { | |
21 class FontList; | |
22 } | |
23 | |
24 namespace views { | |
25 class ImageView; | |
26 class Label; | |
27 } | |
28 | |
29 // The AddToAppLauncherView displays a UI to allow adding the current page to | |
30 // the App Launcher in the location bar. | |
31 class AddToAppLauncherView : public gfx::AnimationDelegate, public views::View { | |
32 public: | |
33 AddToAppLauncherView(LocationBarView* parent, | |
34 const gfx::FontList& font_list, | |
35 SkColor text_color, | |
36 SkColor parent_background_color); | |
37 virtual ~AddToAppLauncherView(); | |
38 | |
39 // Updates the decoration from the shown WebContents. | |
40 void Update(content::WebContents* web_contents); | |
41 | |
42 private: | |
43 // gfx::AnimationDelegate: | |
44 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | |
45 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | |
46 virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; | |
47 | |
48 // views::View: | |
49 virtual gfx::Size GetPreferredSize() const OVERRIDE; | |
50 virtual void Layout() OVERRIDE; | |
51 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; | |
52 | |
53 bool background_showing() const { | |
54 return slide_animator_.is_animating() || pause_animation_; | |
55 } | |
56 | |
57 int GetTotalSpacingWhileAnimating() const; | |
calamity
2014/06/11 04:17:27
Looks like this can be moved into the anonymous na
benwells
2014/06/11 07:34:42
Done.
| |
58 | |
59 LocationBarView* parent_; // Weak, owns us. | |
60 scoped_ptr<views::Painter> background_painter_; | |
61 views::ImageView* icon_; | |
62 views::Label* text_label_; | |
63 gfx::SlideAnimation slide_animator_; | |
64 bool pause_animation_; | |
calamity
2014/06/11 04:17:27
Unused.
benwells
2014/06/11 07:34:42
Done.
| |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(AddToAppLauncherView); | |
67 }; | |
68 | |
69 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ADD_TO_APP_LAUNCHER_VIEW_H_ | |
OLD | NEW |