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 COMPONENTS_SAD_TAB_SAD_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_UI_SAD_TAB_HELPER_H_ | 6 #define COMPONENTS_SAD_TAB_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/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
12 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
13 | 13 |
14 namespace chrome { | 14 namespace sad_tab { |
| 15 |
15 class SadTab; | 16 class SadTab; |
16 } | 17 class SadTabClient; |
17 | 18 |
18 // Per-tab class to manage sad tab views. | 19 // Per-tab class to manage sad tab views. |
19 class SadTabHelper : public content::WebContentsObserver, | 20 class SadTabHelper : public content::WebContentsObserver, |
20 public content::WebContentsUserData<SadTabHelper> { | 21 public content::WebContentsUserData<SadTabHelper> { |
21 public: | 22 public: |
| 23 static void CreateForWebContentsWithClient( |
| 24 content::WebContents* contents, |
| 25 scoped_ptr<SadTabClient> client); |
| 26 |
22 virtual ~SadTabHelper(); | 27 virtual ~SadTabHelper(); |
23 | 28 |
24 chrome::SadTab* sad_tab() { return sad_tab_.get(); } | 29 SadTab* sad_tab() { return sad_tab_.get(); } |
25 | 30 |
26 private: | 31 private: |
27 friend class content::WebContentsUserData<SadTabHelper>; | 32 friend class content::WebContentsUserData<SadTabHelper>; |
28 | 33 |
29 explicit SadTabHelper(content::WebContents* web_contents); | 34 SadTabHelper(content::WebContents* web_contents, |
| 35 scoped_ptr<SadTabClient> client); |
30 | 36 |
31 void InstallSadTab(base::TerminationStatus status); | 37 void InstallSadTab(base::TerminationStatus status); |
32 | 38 |
33 // Overridden from content::WebContentsObserver: | 39 // Overridden from content::WebContentsObserver: |
34 virtual void RenderViewReady() OVERRIDE; | 40 virtual void RenderViewReady() OVERRIDE; |
35 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 41 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
36 | 42 |
37 scoped_ptr<chrome::SadTab> sad_tab_; | 43 scoped_ptr<SadTabClient> client_; |
| 44 scoped_ptr<SadTab> sad_tab_; |
38 | 45 |
39 DISALLOW_COPY_AND_ASSIGN(SadTabHelper); | 46 DISALLOW_COPY_AND_ASSIGN(SadTabHelper); |
40 }; | 47 }; |
41 | 48 |
42 #endif // CHROME_BROWSER_UI_SAD_TAB_HELPER_H_ | 49 } // namespace sad_tab |
| 50 |
| 51 #endif // COMPONENTS_SAD_TAB_SAD_TAB_HELPER_H_ |
OLD | NEW |