OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SAD_TAB_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "views/controls/button/button.h" |
11 #include "views/controls/link_listener.h" | 12 #include "views/controls/link_listener.h" |
12 #include "views/view.h" | 13 #include "views/view.h" |
13 | 14 |
14 class TabContents; | 15 class TabContents; |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 class Font; | 18 class Font; |
18 } | 19 } |
19 | 20 |
20 namespace views { | 21 namespace views { |
21 class Label; | 22 class Label; |
| 23 class TextButton; |
22 } | 24 } |
23 | 25 |
24 /////////////////////////////////////////////////////////////////////////////// | 26 /////////////////////////////////////////////////////////////////////////////// |
25 // | 27 // |
26 // SadTabView | 28 // SadTabView |
27 // | 29 // |
28 // A views::View subclass used to render the presentation of the crashed | 30 // A views::View subclass used to render the presentation of the crashed |
29 // "sad tab" in the browser window when a renderer is destroyed unnaturally. | 31 // "sad tab" in the browser window when a renderer is destroyed unnaturally. |
30 // | 32 // |
31 /////////////////////////////////////////////////////////////////////////////// | 33 /////////////////////////////////////////////////////////////////////////////// |
32 class SadTabView : public views::View, | 34 class SadTabView : public views::View, |
33 public views::LinkListener { | 35 public views::LinkListener, |
| 36 public views::ButtonListener { |
34 public: | 37 public: |
35 // NOTE: Do not remove or reorder the elements in this enum, and only add new | 38 // NOTE: Do not remove or reorder the elements in this enum, and only add new |
36 // items at the end. We depend on these specific values in a histogram. | 39 // items at the end. We depend on these specific values in a histogram. |
37 enum Kind { | 40 enum Kind { |
38 CRASHED = 0, // Tab crashed. Display the "Aw, Snap!" page. | 41 CRASHED = 0, // Tab crashed. Display the "Aw, Snap!" page. |
39 KILLED // Tab killed. Display the "He's dead, Jim!" tab page. | 42 KILLED // Tab killed. Display the "He's dead, Jim!" tab page. |
40 }; | 43 }; |
41 | 44 |
42 SadTabView(TabContents* tab_contents, Kind kind); | 45 SadTabView(TabContents* tab_contents, Kind kind); |
43 virtual ~SadTabView(); | 46 virtual ~SadTabView(); |
44 | 47 |
45 // Overridden from views::View: | 48 // Overridden from views::View: |
46 virtual void Layout() OVERRIDE; | 49 virtual void Layout() OVERRIDE; |
47 | 50 |
48 // Overridden from views::LinkListener: | 51 // Overridden from views::LinkListener: |
49 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 52 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
50 | 53 |
| 54 // Overridden from views::ButtonListener: |
| 55 virtual void ButtonPressed(views::Button* source, |
| 56 const views::Event& event) OVERRIDE; |
| 57 |
51 protected: | 58 protected: |
52 // Overridden from views::View: | 59 // Overridden from views::View: |
53 virtual void ViewHierarchyChanged(bool is_add, | 60 virtual void ViewHierarchyChanged(bool is_add, |
54 views::View* parent, | 61 views::View* parent, |
55 views::View* child) OVERRIDE; | 62 views::View* child) OVERRIDE; |
56 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 63 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
57 | 64 |
58 private: | 65 private: |
59 views::Label* CreateLabel(const string16& text); | 66 views::Label* CreateLabel(const string16& text); |
60 views::Link* CreateLink(const string16& text); | 67 views::Link* CreateLink(const string16& text); |
61 | 68 |
62 TabContents* tab_contents_; | 69 TabContents* tab_contents_; |
63 Kind kind_; | 70 Kind kind_; |
64 bool painted_; | 71 bool painted_; |
65 const gfx::Font& base_font_; | 72 const gfx::Font& base_font_; |
66 views::Label* message_; | 73 views::Label* message_; |
67 views::Link* help_link_; | 74 views::Link* help_link_; |
68 views::Link* feedback_link_; | 75 views::Link* feedback_link_; |
| 76 views::TextButton* reload_button_; |
69 | 77 |
70 DISALLOW_COPY_AND_ASSIGN(SadTabView); | 78 DISALLOW_COPY_AND_ASSIGN(SadTabView); |
71 }; | 79 }; |
72 | 80 |
73 #endif // CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H__ | 81 #endif // CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H__ |
OLD | NEW |