OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_ | |
7 | |
8 #include "ui/views/bubble/bubble_delegate.h" | |
9 #include "ui/views/controls/button/button.h" | |
10 | |
11 namespace views { | |
12 class TextButton; | |
13 } | |
14 | |
15 class Browser; | |
16 | |
17 // OutdatedUpgradeBubbleView warns the user that an upgrade is long overdue. | |
18 // It is intended to be used as the content of a bubble anchored off of the | |
19 // Chrome toolbar. Don't create an OutdatedUpgradeBubbleView directly, | |
20 // instead use the static ShowBubble method. | |
21 class OutdatedUpgradeBubbleView : public views::BubbleDelegateView, | |
22 public views::ButtonListener { | |
23 public: | |
24 static void ShowBubble(views::View* anchor_view, Browser* browser); | |
25 | |
26 // views::BubbleDelegateView method. | |
27 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | |
28 | |
29 // views::WidgetDelegate method. | |
30 virtual void WindowClosing() OVERRIDE; | |
31 | |
32 private: | |
33 OutdatedUpgradeBubbleView(views::View* anchor_view, Browser* browser); | |
Ben Goodger (Google)
2013/02/13 22:34:51
this code could be a little bit more isolated if i
MAD
2013/02/14 14:04:06
Cool, I didn't know about this interface... Thanks
| |
34 virtual ~OutdatedUpgradeBubbleView(); | |
35 | |
36 static bool IsShowing() { return upgrade_bubble_ != NULL; } | |
37 | |
38 // views::BubbleDelegateView method. | |
39 virtual void Init() OVERRIDE; | |
40 | |
41 // views::ButtonListener method. | |
42 virtual void ButtonPressed(views::Button* sender, | |
43 const ui::Event& event) OVERRIDE; | |
44 | |
45 // Handle the message when the user presses a button. | |
46 void HandleButtonPressed(views::Button* sender); | |
47 | |
48 // The upgrade bubble, if we're showing one. | |
49 static OutdatedUpgradeBubbleView* upgrade_bubble_; | |
50 | |
51 // The numer of times the user ignored the bubble before finally choosing to | |
52 // reinstall. | |
53 static int num_ignored_bubbles_; | |
54 | |
55 // Identifies if the reinstall button was hit before closing the bubble. | |
56 bool chose_to_reinstall_; | |
57 | |
58 // Button that takes the user to the Chrome download page. | |
59 views::TextButton* reinstall_button_; | |
60 | |
61 // Button for the user to be reminded later about the outdated upgrade. | |
62 views::TextButton* later_button_; | |
63 | |
64 // The browser to use for opening the Download Chrome URL. | |
65 Browser* browser_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(OutdatedUpgradeBubbleView); | |
68 }; | |
69 | |
70 #endif // CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_ | |
OLD | NEW |