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"
19 // OutdatedUpgradeBubbleView warns the user that an upgrade is long overdue.
20 // It is intended to be used as the content of a bubble anchored off of the
21 // Chrome toolbar. Don't create an OutdatedUpgradeBubbleView directly,
22 // instead use the static ShowBubble method.
23 class OutdatedUpgradeBubbleView
: public views::BubbleDelegateView
,
24 public views::ButtonListener
{
26 static void ShowBubble(views::View
* anchor_view
,
27 content::PageNavigator
* navigator
);
29 // Identifies if we are running a build that supports the
30 // outdated upgrade bubble view.
31 static bool IsAvailable();
33 // views::BubbleDelegateView method.
34 virtual views::View
* GetInitiallyFocusedView() OVERRIDE
;
36 // views::WidgetDelegate method.
37 virtual void WindowClosing() OVERRIDE
;
40 OutdatedUpgradeBubbleView(views::View
* anchor_view
,
41 content::PageNavigator
* navigator
);
42 virtual ~OutdatedUpgradeBubbleView();
44 static bool IsShowing() { return upgrade_bubble_
!= NULL
; }
46 // views::BubbleDelegateView method.
47 virtual void Init() OVERRIDE
;
49 // views::ButtonListener method.
50 virtual void ButtonPressed(views::Button
* sender
,
51 const ui::Event
& event
) OVERRIDE
;
53 // Handle the message when the user presses a button.
54 void HandleButtonPressed(views::Button
* sender
);
56 // The upgrade bubble, if we're showing one.
57 static OutdatedUpgradeBubbleView
* upgrade_bubble_
;
59 // The numer of times the user ignored the bubble before finally choosing to
61 static int num_ignored_bubbles_
;
63 // Identifies if the reinstall button was hit before closing the bubble.
64 bool chose_to_reinstall_
;
66 // Button that takes the user to the Chrome download page.
67 views::LabelButton
* reinstall_button_
;
69 // Button for the user to be reminded later about the outdated upgrade.
70 views::LabelButton
* later_button_
;
72 // The PageNavigator to use for opening the Download Chrome URL.
73 content::PageNavigator
* navigator_
;
75 DISALLOW_COPY_AND_ASSIGN(OutdatedUpgradeBubbleView
);
78 #endif // CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_