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 namespace content { |
| 16 class PageNavigator; |
| 17 } |
| 18 |
| 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 { |
| 25 public: |
| 26 static void ShowBubble(views::View* anchor_view, |
| 27 content::PageNavigator* navigator); |
| 28 |
| 29 // Identifies if we are running a build that supports the |
| 30 // outdated upgrade bubble view. |
| 31 static bool IsAvailable(); |
| 32 |
| 33 // views::BubbleDelegateView method. |
| 34 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
| 35 |
| 36 // views::WidgetDelegate method. |
| 37 virtual void WindowClosing() OVERRIDE; |
| 38 |
| 39 private: |
| 40 OutdatedUpgradeBubbleView(views::View* anchor_view, |
| 41 content::PageNavigator* navigator); |
| 42 virtual ~OutdatedUpgradeBubbleView(); |
| 43 |
| 44 static bool IsShowing() { return upgrade_bubble_ != NULL; } |
| 45 |
| 46 // views::BubbleDelegateView method. |
| 47 virtual void Init() OVERRIDE; |
| 48 |
| 49 // views::ButtonListener method. |
| 50 virtual void ButtonPressed(views::Button* sender, |
| 51 const ui::Event& event) OVERRIDE; |
| 52 |
| 53 // Handle the message when the user presses a button. |
| 54 void HandleButtonPressed(views::Button* sender); |
| 55 |
| 56 // The upgrade bubble, if we're showing one. |
| 57 static OutdatedUpgradeBubbleView* upgrade_bubble_; |
| 58 |
| 59 // The numer of times the user ignored the bubble before finally choosing to |
| 60 // reinstall. |
| 61 static int num_ignored_bubbles_; |
| 62 |
| 63 // Identifies if the reinstall button was hit before closing the bubble. |
| 64 bool chose_to_reinstall_; |
| 65 |
| 66 // Button that takes the user to the Chrome download page. |
| 67 views::TextButton* reinstall_button_; |
| 68 |
| 69 // Button for the user to be reminded later about the outdated upgrade. |
| 70 views::TextButton* later_button_; |
| 71 |
| 72 // The PageNavigator to use for opening the Download Chrome URL. |
| 73 content::PageNavigator* navigator_; |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(OutdatedUpgradeBubbleView); |
| 76 }; |
| 77 |
| 78 #endif // CHROME_BROWSER_UI_VIEWS_OUTDATED_UPGRADE_BUBBLE_VIEW_H_ |
OLD | NEW |