OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SAD_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_SAD_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_UI_SAD_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_SAD_TAB_HELPER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/public/browser/notification_observer.h" | |
12 #include "content/public/browser/notification_registrar.h" | |
13 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
14 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
15 | 13 |
16 namespace chrome { | 14 namespace chrome { |
17 class SadTab; | 15 class SadTab; |
18 } | 16 } |
19 | 17 |
20 // Per-tab class to manage sad tab views. | 18 // Per-tab class to manage sad tab views. |
21 class SadTabHelper : public content::WebContentsObserver, | 19 class SadTabHelper : public content::WebContentsObserver, |
22 public content::NotificationObserver, | |
23 public content::WebContentsUserData<SadTabHelper> { | 20 public content::WebContentsUserData<SadTabHelper> { |
24 public: | 21 public: |
25 virtual ~SadTabHelper(); | 22 virtual ~SadTabHelper(); |
26 | 23 |
27 chrome::SadTab* sad_tab() { return sad_tab_.get(); } | 24 chrome::SadTab* sad_tab() { return sad_tab_.get(); } |
28 | 25 |
29 private: | 26 private: |
30 friend class content::WebContentsUserData<SadTabHelper>; | 27 friend class content::WebContentsUserData<SadTabHelper>; |
31 | 28 |
32 explicit SadTabHelper(content::WebContents* web_contents); | 29 explicit SadTabHelper(content::WebContents* web_contents); |
33 | 30 |
34 void InstallSadTab(base::TerminationStatus status); | 31 void InstallSadTab(base::TerminationStatus status); |
35 | 32 |
36 // Overridden from content::WebContentsObserver: | 33 // Overridden from content::WebContentsObserver: |
| 34 virtual void RenderViewReady() OVERRIDE; |
37 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 35 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
38 | 36 |
39 // Overridden from content::NotificationObserver: | |
40 virtual void Observe(int type, | |
41 const content::NotificationSource& source, | |
42 const content::NotificationDetails& details) OVERRIDE; | |
43 | |
44 // Used to get notifications about renderers coming and going. | |
45 content::NotificationRegistrar registrar_; | |
46 | |
47 scoped_ptr<chrome::SadTab> sad_tab_; | 37 scoped_ptr<chrome::SadTab> sad_tab_; |
48 | 38 |
49 DISALLOW_COPY_AND_ASSIGN(SadTabHelper); | 39 DISALLOW_COPY_AND_ASSIGN(SadTabHelper); |
50 }; | 40 }; |
51 | 41 |
52 #endif // CHROME_BROWSER_UI_SAD_TAB_HELPER_H_ | 42 #endif // CHROME_BROWSER_UI_SAD_TAB_HELPER_H_ |
OLD | NEW |