OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SESSION_CRASHED_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_SESSION_CRASHED_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_SESSION_CRASHED_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_SESSION_CRASHED_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
9 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
10 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 : public views::BubbleDelegateView, | 34 : public views::BubbleDelegateView, |
35 public views::ButtonListener, | 35 public views::ButtonListener, |
36 public views::StyledLabelListener, | 36 public views::StyledLabelListener, |
37 public content::WebContentsObserver, | 37 public content::WebContentsObserver, |
38 public content::NotificationObserver, | 38 public content::NotificationObserver, |
39 public TabStripModelObserver { | 39 public TabStripModelObserver { |
40 public: | 40 public: |
41 static void Show(Browser* browser); | 41 static void Show(Browser* browser); |
42 | 42 |
43 private: | 43 private: |
| 44 // A helper class that listens to browser removal event. |
| 45 class BrowserRemovalObserver; |
| 46 |
44 SessionCrashedBubbleView(views::View* anchor_view, | 47 SessionCrashedBubbleView(views::View* anchor_view, |
45 Browser* browser, | 48 Browser* browser, |
46 content::WebContents* web_contents); | 49 content::WebContents* web_contents, |
| 50 bool offer_uma_optin); |
47 virtual ~SessionCrashedBubbleView(); | 51 virtual ~SessionCrashedBubbleView(); |
48 | 52 |
| 53 // Creates and shows the session crashed bubble, with |offer_uma_optin| |
| 54 // indicating whether the UMA opt-in checkbox should be shown. Called |
| 55 // by Show after checking whether the UMA option should be presented and it |
| 56 // takes ownership of |browser_observer|. |
| 57 static void ShowForReal(BrowserRemovalObserver* browser_observer, |
| 58 bool offer_uma_optin); |
| 59 |
49 // WidgetDelegateView methods. | 60 // WidgetDelegateView methods. |
50 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 61 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
51 | 62 |
52 // views::BubbleDelegateView methods. | 63 // views::BubbleDelegateView methods. |
53 virtual void Init() OVERRIDE; | 64 virtual void Init() OVERRIDE; |
54 | 65 |
55 // views::ButtonListener methods. | 66 // views::ButtonListener methods. |
56 virtual void ButtonPressed(views::Button* sender, | 67 virtual void ButtonPressed(views::Button* sender, |
57 const ui::Event& event) OVERRIDE; | 68 const ui::Event& event) OVERRIDE; |
58 | 69 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 116 |
106 // Button for the user to confirm a session restore. | 117 // Button for the user to confirm a session restore. |
107 views::LabelButton* restore_button_; | 118 views::LabelButton* restore_button_; |
108 | 119 |
109 // Button for the user to close this bubble. | 120 // Button for the user to close this bubble. |
110 views::LabelButton* close_; | 121 views::LabelButton* close_; |
111 | 122 |
112 // Checkbox for the user to opt-in to UMA reporting. | 123 // Checkbox for the user to opt-in to UMA reporting. |
113 views::Checkbox* uma_option_; | 124 views::Checkbox* uma_option_; |
114 | 125 |
| 126 // Whether or not the UMA opt-in option should be shown. |
| 127 bool offer_uma_optin_; |
| 128 |
115 // Whether or not a navigation has started on current tab. | 129 // Whether or not a navigation has started on current tab. |
116 bool started_navigation_; | 130 bool started_navigation_; |
117 | 131 |
118 DISALLOW_COPY_AND_ASSIGN(SessionCrashedBubbleView); | 132 DISALLOW_COPY_AND_ASSIGN(SessionCrashedBubbleView); |
119 }; | 133 }; |
120 | 134 |
121 #endif // CHROME_BROWSER_UI_VIEWS_SESSION_CRASHED_BUBBLE_VIEW_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_SESSION_CRASHED_BUBBLE_VIEW_H_ |
OLD | NEW |