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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/ui/sad_tab.h"
11 #include "ui/views/controls/button/button.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"
15 #include "ui/views/view.h"
26 ///////////////////////////////////////////////////////////////////////////////
30 // A views::View subclass used to render the presentation of the crashed
31 // "sad tab" in the browser window when a renderer is destroyed unnaturally.
33 ///////////////////////////////////////////////////////////////////////////////
34 class SadTabView
: public chrome::SadTab
,
36 public views::LinkListener
,
37 public views::ButtonListener
{
39 // Tag to denote which type of action button is displayed.
41 SAD_TAB_BUTTON_FEEDBACK
,
42 SAD_TAB_BUTTON_RELOAD
,
45 SadTabView(content::WebContents
* web_contents
, chrome::SadTabKind kind
);
46 ~SadTabView() override
;
48 // Overridden from views::View:
49 void Layout() override
;
51 // Overridden from views::LinkListener:
52 void LinkClicked(views::Link
* source
, int event_flags
) override
;
54 // Overridden from views::ButtonListener:
55 void ButtonPressed(views::Button
* source
, const ui::Event
& event
) override
;
58 // Overridden from views::View:
59 void OnPaint(gfx::Canvas
* canvas
) override
;
62 // Overridden from chrome::SadTab:
64 void Close() override
;
66 views::Label
* CreateLabel(const base::string16
& text
);
67 views::Link
* CreateLink(const base::string16
& text
, const SkColor
& color
);
69 content::WebContents
* web_contents_
;
70 chrome::SadTabKind kind_
;
72 views::Label
* message_
;
73 views::Link
* help_link_
;
74 views::LabelButton
* action_button_
;
76 views::StyledLabel
* help_message_
;
77 static int total_crashes_
;
79 DISALLOW_COPY_AND_ASSIGN(SadTabView
);
82 #endif // CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H__