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( | |
Peter Kasting
2011/11/21 21:31:06
Nit: Wrap like this:
virtual void ButtonPressed
kevers
2011/11/22 13:52:02
Done.
| |
56 views::Button* source, | |
57 const views::Event& event) OVERRIDE; | |
58 | |
51 protected: | 59 protected: |
52 // Overridden from views::View: | 60 // Overridden from views::View: |
53 virtual void ViewHierarchyChanged(bool is_add, | 61 virtual void ViewHierarchyChanged(bool is_add, |
54 views::View* parent, | 62 views::View* parent, |
55 views::View* child) OVERRIDE; | 63 views::View* child) OVERRIDE; |
56 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 64 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
57 | 65 |
58 private: | 66 private: |
59 views::Label* CreateLabel(const string16& text); | 67 views::Label* CreateLabel(const string16& text); |
60 views::Link* CreateLink(const string16& text); | 68 views::Link* CreateLink(const string16& text); |
69 views::TextButton* CreateButton(const string16& text); | |
61 | 70 |
62 TabContents* tab_contents_; | 71 TabContents* tab_contents_; |
63 Kind kind_; | 72 Kind kind_; |
64 bool painted_; | 73 bool painted_; |
65 const gfx::Font& base_font_; | 74 const gfx::Font& base_font_; |
66 views::Label* message_; | 75 views::Label* message_; |
67 views::Link* help_link_; | 76 views::Link* help_link_; |
68 views::Link* feedback_link_; | 77 views::Link* feedback_link_; |
78 views::TextButton* reload_button_; | |
69 | 79 |
70 DISALLOW_COPY_AND_ASSIGN(SadTabView); | 80 DISALLOW_COPY_AND_ASSIGN(SadTabView); |
71 }; | 81 }; |
72 | 82 |
73 #endif // CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H__ | 83 #endif // CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H__ |
OLD | NEW |