| 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_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 | 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 "chrome/browser/ui/sad_tab.h" | 10 #include "chrome/browser/ui/sad_tab.h" |
| 11 #include "ui/views/controls/button/button.h" | 11 #include "ui/views/controls/button/button.h" |
| 12 #include "ui/views/controls/link_listener.h" | 12 #include "ui/views/controls/link_listener.h" |
| 13 #include "ui/views/controls/styled_label.h" |
| 14 #include "ui/views/controls/styled_label_listener.h" |
| 13 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
| 14 | 16 |
| 15 namespace content { | 17 namespace content { |
| 16 class WebContents; | 18 class WebContents; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace views { | 21 namespace views { |
| 20 class Label; | 22 class Label; |
| 21 class LabelButton; | 23 class LabelButton; |
| 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 chrome::SadTab, | 34 class SadTabView : public chrome::SadTab, |
| 33 public views::View, | 35 public views::View, |
| 34 public views::LinkListener, | 36 public views::LinkListener, |
| 35 public views::ButtonListener { | 37 public views::ButtonListener, |
| 38 public views::StyledLabelListener { |
| 36 public: | 39 public: |
| 37 SadTabView(content::WebContents* web_contents, chrome::SadTabKind kind); | 40 SadTabView(content::WebContents* web_contents, chrome::SadTabKind kind); |
| 38 ~SadTabView() override; | 41 ~SadTabView() override; |
| 39 | 42 |
| 40 // Overridden from views::View: | 43 // Overridden from views::View: |
| 41 void Layout() override; | 44 void Layout() override; |
| 42 | 45 |
| 43 // Overridden from views::LinkListener: | 46 // Overridden from views::LinkListener: |
| 44 void LinkClicked(views::Link* source, int event_flags) override; | 47 void LinkClicked(views::Link* source, int event_flags) override; |
| 45 | 48 |
| 46 // Overridden from views::ButtonListener: | 49 // Overridden from views::ButtonListener: |
| 47 void ButtonPressed(views::Button* source, const ui::Event& event) override; | 50 void ButtonPressed(views::Button* source, const ui::Event& event) override; |
| 48 | 51 |
| 49 protected: | 52 protected: |
| 50 // Overridden from views::View: | 53 // Overridden from views::View: |
| 51 void OnPaint(gfx::Canvas* canvas) override; | 54 void OnPaint(gfx::Canvas* canvas) override; |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 // Overridden from chrome::SadTab: | 57 // Overridden from chrome::SadTab: |
| 55 void Show() override; | 58 void Show() override; |
| 56 void Close() override; | 59 void Close() override; |
| 57 | 60 |
| 61 // views::StyledLabelListener methods. |
| 62 void StyledLabelLinkClicked(const gfx::Range& range, |
| 63 int event_flags) override; |
| 64 |
| 58 views::Label* CreateLabel(const base::string16& text); | 65 views::Label* CreateLabel(const base::string16& text); |
| 59 views::Link* CreateLink(const base::string16& text); | 66 views::Link* CreateLink(const base::string16& text, const SkColor& color); |
| 60 | 67 |
| 61 content::WebContents* web_contents_; | 68 content::WebContents* web_contents_; |
| 62 chrome::SadTabKind kind_; | 69 chrome::SadTabKind kind_; |
| 63 bool painted_; | 70 bool painted_; |
| 64 views::Label* message_; | 71 views::Label* message_; |
| 65 views::Link* help_link_; | 72 views::Link* help_link_; |
| 66 views::Link* feedback_link_; | 73 views::Link* feedback_link_; |
| 67 views::LabelButton* reload_button_; | 74 views::LabelButton* reload_button_; |
| 75 views::Label* title_; |
| 76 views::StyledLabel* help_message_; |
| 68 | 77 |
| 69 DISALLOW_COPY_AND_ASSIGN(SadTabView); | 78 DISALLOW_COPY_AND_ASSIGN(SadTabView); |
| 70 }; | 79 }; |
| 71 | 80 |
| 72 #endif // CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H__ | 81 #endif // CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H__ |
| OLD | NEW |