OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include "ui/views/bubble/bubble_delegate.h" | 8 #include "ui/views/bubble/bubble_delegate.h" |
9 #include "ui/views/controls/button/button.h" | 9 #include "ui/views/controls/button/button.h" |
10 | 10 |
11 namespace views { | 11 namespace views { |
12 class LabelButton; | 12 class LabelButton; |
13 } | 13 } |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class PageNavigator; | 16 class PageNavigator; |
17 } | 17 } |
18 | 18 |
19 // OutdatedUpgradeBubbleView warns the user that an upgrade is long overdue. | 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 | 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, | 21 // Chrome toolbar. Don't create an OutdatedUpgradeBubbleView directly, |
22 // instead use the static ShowBubble method. | 22 // instead use the static ShowBubble method. |
23 class OutdatedUpgradeBubbleView : public views::BubbleDelegateView, | 23 class OutdatedUpgradeBubbleView : public views::BubbleDelegateView, |
24 public views::ButtonListener { | 24 public views::ButtonListener { |
25 public: | 25 public: |
26 static void ShowBubble(views::View* anchor_view, | 26 static void ShowBubble(views::View* anchor_view, |
27 content::PageNavigator* navigator); | 27 content::PageNavigator* navigator, |
28 bool auto_update_on); | |
28 | 29 |
29 // Identifies if we are running a build that supports the | 30 // Identifies if we are running a build that supports the |
30 // outdated upgrade bubble view. | 31 // outdated upgrade bubble view. |
31 static bool IsAvailable(); | 32 static bool IsAvailable(); |
32 | 33 |
33 // views::BubbleDelegateView method. | 34 // views::BubbleDelegateView method. |
34 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 35 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
35 | 36 |
36 // views::WidgetDelegate method. | 37 // views::WidgetDelegate method. |
37 virtual void WindowClosing() OVERRIDE; | 38 virtual void WindowClosing() OVERRIDE; |
38 | 39 |
39 private: | 40 private: |
40 OutdatedUpgradeBubbleView(views::View* anchor_view, | 41 OutdatedUpgradeBubbleView(views::View* anchor_view, |
41 content::PageNavigator* navigator); | 42 content::PageNavigator* navigator, |
43 bool auto_update_on); | |
42 virtual ~OutdatedUpgradeBubbleView(); | 44 virtual ~OutdatedUpgradeBubbleView(); |
43 | 45 |
44 static bool IsShowing() { return upgrade_bubble_ != NULL; } | 46 static bool IsShowing() { return upgrade_bubble_ != NULL; } |
45 | 47 |
46 // views::BubbleDelegateView method. | 48 // views::BubbleDelegateView method. |
47 virtual void Init() OVERRIDE; | 49 virtual void Init() OVERRIDE; |
48 | 50 |
49 // views::ButtonListener method. | 51 // views::ButtonListener method. |
50 virtual void ButtonPressed(views::Button* sender, | 52 virtual void ButtonPressed(views::Button* sender, |
51 const ui::Event& event) OVERRIDE; | 53 const ui::Event& event) OVERRIDE; |
52 | 54 |
53 // Handle the message when the user presses a button. | 55 // Handle the message when the user presses a button. |
54 void HandleButtonPressed(views::Button* sender); | 56 void HandleButtonPressed(views::Button* sender); |
55 | 57 |
56 // The upgrade bubble, if we're showing one. | 58 // The upgrade bubble, if we're showing one. |
57 static OutdatedUpgradeBubbleView* upgrade_bubble_; | 59 static OutdatedUpgradeBubbleView* upgrade_bubble_; |
58 | 60 |
59 // The numer of times the user ignored the bubble before finally choosing to | 61 // The numer of times the user ignored the bubble before finally choosing to |
60 // reinstall. | 62 // reinstall. |
61 static int num_ignored_bubbles_; | 63 static int num_ignored_bubbles_; |
62 | 64 |
63 // Identifies if the reinstall button was hit before closing the bubble. | 65 // Identifies if auto-update is on or not. |
64 bool chose_to_reinstall_; | 66 bool auto_update_on_; |
65 | 67 |
66 // Button that takes the user to the Chrome download page. | 68 // Identifies if the accept button was hit before closing the bubble. |
67 views::LabelButton* reinstall_button_; | 69 bool accepted_; |
70 | |
71 // Button that let the user accept the proposal, which is to navigate to a | |
robertshield
2014/03/26 03:20:11
*lets
MAD
2014/03/26 19:30:16
Done.
| |
72 // Chrome download page when |auto_update_on_| is true, or turn on auto-update | |
robertshield
2014/03/26 03:20:11
or attempt to re-enable auto-update otherwise.
MAD
2014/03/26 19:30:16
Done.
| |
73 // otherwise. | |
74 views::LabelButton* accept_button_; | |
68 | 75 |
69 // Button for the user to be reminded later about the outdated upgrade. | 76 // Button for the user to be reminded later about the outdated upgrade. |
70 views::LabelButton* later_button_; | 77 views::LabelButton* later_button_; |
71 | 78 |
72 // The PageNavigator to use for opening the Download Chrome URL. | 79 // The PageNavigator to use for opening the Download Chrome URL. |
73 content::PageNavigator* navigator_; | 80 content::PageNavigator* navigator_; |
74 | 81 |
75 DISALLOW_COPY_AND_ASSIGN(OutdatedUpgradeBubbleView); | 82 DISALLOW_COPY_AND_ASSIGN(OutdatedUpgradeBubbleView); |
76 }; | 83 }; |
77 | 84 |
78 #endif // CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_ | 85 #endif // CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_ |
OLD | NEW |