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 "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 static void Show(Browser* browser); | 42 static void Show(Browser* browser); |
43 | 43 |
44 private: | 44 private: |
45 // A helper class that listens to browser removal event. | 45 // A helper class that listens to browser removal event. |
46 class BrowserRemovalObserver; | 46 class BrowserRemovalObserver; |
47 | 47 |
48 SessionCrashedBubbleView(views::View* anchor_view, | 48 SessionCrashedBubbleView(views::View* anchor_view, |
49 Browser* browser, | 49 Browser* browser, |
50 content::WebContents* web_contents, | 50 content::WebContents* web_contents, |
51 bool offer_uma_optin); | 51 bool offer_uma_optin); |
52 virtual ~SessionCrashedBubbleView(); | 52 ~SessionCrashedBubbleView() override; |
53 | 53 |
54 // Creates and shows the session crashed bubble, with |uma_opted_in_already| | 54 // Creates and shows the session crashed bubble, with |uma_opted_in_already| |
55 // indicating whether the user has already opted-in to UMA. It will be called | 55 // indicating whether the user has already opted-in to UMA. It will be called |
56 // by Show. It takes ownership of |browser_observer|. | 56 // by Show. It takes ownership of |browser_observer|. |
57 static void ShowForReal(scoped_ptr<BrowserRemovalObserver> browser_observer, | 57 static void ShowForReal(scoped_ptr<BrowserRemovalObserver> browser_observer, |
58 bool uma_opted_in_already); | 58 bool uma_opted_in_already); |
59 | 59 |
60 // WidgetDelegateView methods. | 60 // WidgetDelegateView methods. |
61 virtual views::View* GetInitiallyFocusedView() override; | 61 views::View* GetInitiallyFocusedView() override; |
62 virtual base::string16 GetWindowTitle() const override; | 62 base::string16 GetWindowTitle() const override; |
63 virtual bool ShouldShowWindowTitle() const override; | 63 bool ShouldShowWindowTitle() const override; |
64 virtual bool ShouldShowCloseButton() const override; | 64 bool ShouldShowCloseButton() const override; |
65 virtual void OnWidgetDestroying(views::Widget* widget) override; | 65 void OnWidgetDestroying(views::Widget* widget) override; |
66 | 66 |
67 // views::BubbleDelegateView methods. | 67 // views::BubbleDelegateView methods. |
68 virtual void Init() override; | 68 void Init() override; |
69 | 69 |
70 // views::ButtonListener methods. | 70 // views::ButtonListener methods. |
71 virtual void ButtonPressed(views::Button* sender, | 71 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
72 const ui::Event& event) override; | |
73 | 72 |
74 // views::StyledLabelListener methods. | 73 // views::StyledLabelListener methods. |
75 virtual void StyledLabelLinkClicked(const gfx::Range& range, | 74 void StyledLabelLinkClicked(const gfx::Range& range, |
76 int event_flags) override; | 75 int event_flags) override; |
77 | 76 |
78 // content::WebContentsObserver methods. | 77 // content::WebContentsObserver methods. |
79 virtual void DidStartNavigationToPendingEntry( | 78 void DidStartNavigationToPendingEntry( |
80 const GURL& url, | 79 const GURL& url, |
81 content::NavigationController::ReloadType reload_type) override; | 80 content::NavigationController::ReloadType reload_type) override; |
82 virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, | 81 void DidFinishLoad(content::RenderFrameHost* render_frame_host, |
83 const GURL& validated_url) override; | 82 const GURL& validated_url) override; |
84 virtual void WasShown() override; | 83 void WasShown() override; |
85 virtual void WasHidden() override; | 84 void WasHidden() override; |
86 | 85 |
87 // content::NotificationObserver methods. | 86 // content::NotificationObserver methods. |
88 virtual void Observe( | 87 void Observe(int type, |
89 int type, | 88 const content::NotificationSource& source, |
90 const content::NotificationSource& source, | 89 const content::NotificationDetails& details) override; |
91 const content::NotificationDetails& details) override; | |
92 | 90 |
93 // TabStripModelObserver methods. | 91 // TabStripModelObserver methods. |
94 // When the tab with current bubble is being dragged and dropped to a new | 92 // When the tab with current bubble is being dragged and dropped to a new |
95 // window or to another window, the bubble will be dismissed as if the user | 93 // window or to another window, the bubble will be dismissed as if the user |
96 // chose not to restore the previous session. | 94 // chose not to restore the previous session. |
97 virtual void TabDetachedAt( | 95 void TabDetachedAt(content::WebContents* contents, int index) override; |
98 content::WebContents* contents, | |
99 int index) override; | |
100 | 96 |
101 // Create the view for the user to opt in to UMA. | 97 // Create the view for the user to opt in to UMA. |
102 views::View* CreateUMAOptinView(); | 98 views::View* CreateUMAOptinView(); |
103 | 99 |
104 // Restore previous session after user selects so. | 100 // Restore previous session after user selects so. |
105 void RestorePreviousSession(views::Button* sender); | 101 void RestorePreviousSession(views::Button* sender); |
106 | 102 |
107 // Close and destroy the bubble. | 103 // Close and destroy the bubble. |
108 void CloseBubble(); | 104 void CloseBubble(); |
109 | 105 |
(...skipping 18 matching lines...) Expand all Loading... |
128 bool started_navigation_; | 124 bool started_navigation_; |
129 | 125 |
130 // Whether or not the user chose to restore previous session. It is used to | 126 // Whether or not the user chose to restore previous session. It is used to |
131 // collect bubble usage stats. | 127 // collect bubble usage stats. |
132 bool restored_; | 128 bool restored_; |
133 | 129 |
134 DISALLOW_COPY_AND_ASSIGN(SessionCrashedBubbleView); | 130 DISALLOW_COPY_AND_ASSIGN(SessionCrashedBubbleView); |
135 }; | 131 }; |
136 | 132 |
137 #endif // CHROME_BROWSER_UI_VIEWS_SESSION_CRASHED_BUBBLE_VIEW_H_ | 133 #endif // CHROME_BROWSER_UI_VIEWS_SESSION_CRASHED_BUBBLE_VIEW_H_ |
OLD | NEW |