Chromium Code Reviews| 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" |
| 11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
| 12 #include "ui/views/bubble/bubble_delegate.h" | 12 #include "ui/views/bubble/bubble_delegate.h" |
| 13 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/button.h" |
| 14 #include "ui/views/controls/styled_label_listener.h" | 14 #include "ui/views/controls/styled_label_listener.h" |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 class Checkbox; | 17 class Checkbox; |
| 18 class GridLayout; | 18 class GridLayout; |
| 19 class LabelButton; | 19 class LabelButton; |
| 20 class Widget; | 20 class Widget; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class WebContents; | 24 class WebContents; |
| 25 class RenderViewHost; | 25 class RenderViewHost; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace { | |
| 29 class BrowserRemovalObserver; | |
|
Alexei Svitkine (slow)
2014/05/20 15:52:42
I think you can make it an inner class inside Sess
yao
2014/05/20 16:25:44
Done.
| |
| 30 } | |
| 31 | |
| 28 class Browser; | 32 class Browser; |
| 29 | 33 |
| 30 // It creates a session restore request bubble when the previous session has | 34 // It creates a session restore request bubble when the previous session has |
| 31 // crashed. It also presents an option to enable metrics reporting, if it not | 35 // crashed. It also presents an option to enable metrics reporting, if it not |
| 32 // enabled already. | 36 // enabled already. |
| 33 class SessionCrashedBubbleView | 37 class SessionCrashedBubbleView |
| 34 : public views::BubbleDelegateView, | 38 : public views::BubbleDelegateView, |
| 35 public views::ButtonListener, | 39 public views::ButtonListener, |
| 36 public views::StyledLabelListener, | 40 public views::StyledLabelListener, |
| 37 public content::WebContentsObserver, | 41 public content::WebContentsObserver, |
| 38 public content::NotificationObserver, | 42 public content::NotificationObserver, |
| 39 public TabStripModelObserver { | 43 public TabStripModelObserver { |
| 40 public: | 44 public: |
| 41 static void Show(Browser* browser); | 45 static void Show(Browser* browser); |
| 42 | 46 |
| 43 private: | 47 private: |
| 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. | |
| 57 static void ShowForReal(BrowserRemovalObserver* browser_observer, | |
| 58 Browser* browser, | |
| 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 |