[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / outdated_upgrade_bubble_view.h
blobba3ce201da3e658f43eaeb0dbf417d9c2fee2d6e
1 // Copyright (c) 2013 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 CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_
8 #include "ui/views/bubble/bubble_delegate.h"
9 #include "ui/views/controls/button/button.h"
11 class ElevationIconSetter;
13 namespace views {
14 class LabelButton;
17 namespace content {
18 class PageNavigator;
21 // OutdatedUpgradeBubbleView warns the user that an upgrade is long overdue.
22 // It is intended to be used as the content of a bubble anchored off of the
23 // Chrome toolbar. Don't create an OutdatedUpgradeBubbleView directly,
24 // instead use the static ShowBubble method.
25 class OutdatedUpgradeBubbleView : public views::BubbleDelegateView,
26 public views::ButtonListener {
27 public:
28 static void ShowBubble(views::View* anchor_view,
29 content::PageNavigator* navigator,
30 bool auto_update_enabled);
32 // Identifies if we are running a build that supports the
33 // outdated upgrade bubble view.
34 static bool IsAvailable();
36 // views::BubbleDelegateView method.
37 virtual views::View* GetInitiallyFocusedView() OVERRIDE;
39 // views::WidgetDelegate method.
40 virtual void WindowClosing() OVERRIDE;
42 private:
43 OutdatedUpgradeBubbleView(views::View* anchor_view,
44 content::PageNavigator* navigator,
45 bool auto_update_enabled);
46 virtual ~OutdatedUpgradeBubbleView();
48 static bool IsShowing() { return upgrade_bubble_ != NULL; }
50 // views::BubbleDelegateView method.
51 virtual void Init() OVERRIDE;
53 // views::ButtonListener method.
54 virtual void ButtonPressed(views::Button* sender,
55 const ui::Event& event) OVERRIDE;
57 // Handle the message when the user presses a button.
58 void HandleButtonPressed(views::Button* sender);
60 // The upgrade bubble, if we're showing one.
61 static OutdatedUpgradeBubbleView* upgrade_bubble_;
63 // The numer of times the user ignored the bubble before finally choosing to
64 // reinstall.
65 static int num_ignored_bubbles_;
67 // Identifies if auto-update is enabled or not.
68 bool auto_update_enabled_;
70 // Identifies if the accept button was hit before closing the bubble.
71 bool accepted_;
73 // Button that lets the user accept the proposal, which is to navigate to a
74 // Chrome download page when |auto_update_enabled_| is true, or attempt to
75 // re-enable auto-update otherwise.
76 views::LabelButton* accept_button_;
78 // Button for the user to be reminded later about the outdated upgrade.
79 views::LabelButton* later_button_;
81 // The PageNavigator to use for opening the Download Chrome URL.
82 content::PageNavigator* navigator_;
84 scoped_ptr<ElevationIconSetter> elevation_icon_setter_;
86 DISALLOW_COPY_AND_ASSIGN(OutdatedUpgradeBubbleView);
89 #endif // CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_