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