| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "gfx/font.h" | 10 #include "gfx/font.h" |
| 11 #include "views/controls/link.h" | 11 #include "views/controls/link.h" |
| 12 #include "views/view.h" | 12 #include "views/view.h" |
| 13 | 13 |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 class TabContents; | 15 class TabContents; |
| 16 | 16 |
| 17 /////////////////////////////////////////////////////////////////////////////// | 17 /////////////////////////////////////////////////////////////////////////////// |
| 18 // | 18 // |
| 19 // SadTabView | 19 // SadTabView |
| 20 // | 20 // |
| 21 // A views::View subclass used to render the presentation of the crashed | 21 // A views::View subclass used to render the presentation of the crashed |
| 22 // "sad tab" in the browser window when a renderer is destroyed unnaturally. | 22 // "sad tab" in the browser window when a renderer is destroyed unnaturally. |
| 23 // | 23 // |
| 24 /////////////////////////////////////////////////////////////////////////////// | 24 /////////////////////////////////////////////////////////////////////////////// |
| 25 class SadTabView : public views::View, | 25 class SadTabView : public views::View, |
| 26 public views::LinkController { | 26 public views::LinkController { |
| 27 public: | 27 public: |
| 28 explicit SadTabView(TabContents* tab_contents); | 28 enum Kind { |
| 29 CRASHED, // The tab crashed. Display the "Aw, Snap!" page. |
| 30 KILLED // The tab was killed. Display the killed tab page. |
| 31 }; |
| 32 |
| 33 explicit SadTabView(TabContents* tab_contents, Kind kind); |
| 29 virtual ~SadTabView() {} | 34 virtual ~SadTabView() {} |
| 30 | 35 |
| 31 // Overridden from views::View: | 36 // Overridden from views::View: |
| 32 virtual void Paint(gfx::Canvas* canvas); | 37 virtual void Paint(gfx::Canvas* canvas); |
| 33 virtual void Layout(); | 38 virtual void Layout(); |
| 34 | 39 |
| 35 // Overridden from views::LinkController: | 40 // Overridden from views::LinkController: |
| 36 virtual void LinkActivated(views::Link* source, int event_flags); | 41 virtual void LinkActivated(views::Link* source, int event_flags); |
| 37 | 42 |
| 38 private: | 43 private: |
| 39 static void InitClass(); | 44 static void InitClass(Kind kind); |
| 40 | 45 |
| 41 // Assorted resources for display. | 46 // Assorted resources for display. |
| 42 static SkBitmap* sad_tab_bitmap_; | 47 static SkBitmap* sad_tab_bitmap_; |
| 43 static gfx::Font* title_font_; | 48 static gfx::Font* title_font_; |
| 44 static gfx::Font* message_font_; | 49 static gfx::Font* message_font_; |
| 45 static std::wstring title_; | 50 static std::wstring title_; |
| 46 static std::wstring message_; | 51 static std::wstring message_; |
| 47 static int title_width_; | 52 static int title_width_; |
| 48 | 53 |
| 49 TabContents* tab_contents_; | 54 TabContents* tab_contents_; |
| 50 views::Link* learn_more_link_; | 55 views::Link* learn_more_link_; |
| 51 | 56 |
| 52 // Regions within the display for different components, populated by | 57 // Regions within the display for different components, populated by |
| 53 // Layout(). | 58 // Layout(). |
| 54 gfx::Rect icon_bounds_; | 59 gfx::Rect icon_bounds_; |
| 55 gfx::Rect title_bounds_; | 60 gfx::Rect title_bounds_; |
| 56 gfx::Rect message_bounds_; | 61 gfx::Rect message_bounds_; |
| 57 gfx::Rect link_bounds_; | 62 gfx::Rect link_bounds_; |
| 58 | 63 |
| 64 Kind kind_; |
| 65 |
| 59 DISALLOW_COPY_AND_ASSIGN(SadTabView); | 66 DISALLOW_COPY_AND_ASSIGN(SadTabView); |
| 60 }; | 67 }; |
| 61 | 68 |
| 62 #endif // CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H__ | 69 #endif // CHROME_BROWSER_UI_VIEWS_SAD_TAB_VIEW_H__ |
| OLD | NEW |