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
;
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
{
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 views::View
* GetInitiallyFocusedView() override
;
39 // views::WidgetDelegate method.
40 void WindowClosing() override
;
43 OutdatedUpgradeBubbleView(views::View
* anchor_view
,
44 content::PageNavigator
* navigator
,
45 bool auto_update_enabled
);
46 ~OutdatedUpgradeBubbleView() override
;
48 static bool IsShowing() { return upgrade_bubble_
!= NULL
; }
50 // views::BubbleDelegateView method.
53 // views::ButtonListener method.
54 void ButtonPressed(views::Button
* sender
, const ui::Event
& event
) override
;
56 // Handle the message when the user presses a button.
57 void HandleButtonPressed(views::Button
* sender
);
59 // The upgrade bubble, if we're showing one.
60 static OutdatedUpgradeBubbleView
* upgrade_bubble_
;
62 // The numer of times the user ignored the bubble before finally choosing to
64 static int num_ignored_bubbles_
;
66 // Identifies if auto-update is enabled or not.
67 bool auto_update_enabled_
;
69 // Identifies if the accept button was hit before closing the bubble.
72 // Button that lets the user accept the proposal, which is to navigate to a
73 // Chrome download page when |auto_update_enabled_| is true, or attempt to
74 // re-enable auto-update otherwise.
75 views::LabelButton
* accept_button_
;
77 // Button for the user to be reminded later about the outdated upgrade.
78 views::LabelButton
* later_button_
;
80 // The PageNavigator to use for opening the Download Chrome URL.
81 content::PageNavigator
* navigator_
;
83 scoped_ptr
<ElevationIconSetter
> elevation_icon_setter_
;
85 DISALLOW_COPY_AND_ASSIGN(OutdatedUpgradeBubbleView
);
88 #endif // CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_