Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / location_bar / add_to_app_launcher_view.h
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 in the location bar to allow adding
30 // the current page to the App Launcher.
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   LocationBarView* parent_;  // Weak, owns us.
54   scoped_ptr<views::Painter> background_painter_;
55   views::ImageView* icon_;
56   views::Label* text_label_;
57   gfx::SlideAnimation slide_animator_;
58
59   DISALLOW_COPY_AND_ASSIGN(AddToAppLauncherView);
60 };
61
62 #endif  // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ADD_TO_APP_LAUNCHER_VIEW_H_