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 #include "chrome/browser/views/sad_tab_view.h" | 5 #include "chrome/browser/views/sad_tab_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "chrome/browser/tab_contents/tab_contents.h" | 9 #include "chrome/browser/tab_contents/tab_contents.h" |
10 #include "gfx/canvas.h" | 10 #include "gfx/canvas.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 AddChildView(learn_more_link_); | 50 AddChildView(learn_more_link_); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 void SadTabView::Paint(gfx::Canvas* canvas) { | 54 void SadTabView::Paint(gfx::Canvas* canvas) { |
55 SkPaint paint; | 55 SkPaint paint; |
56 paint.setShader(gfx::CreateGradientShader(0, height(), | 56 paint.setShader(gfx::CreateGradientShader(0, height(), |
57 kBackgroundColor, | 57 kBackgroundColor, |
58 kBackgroundEndColor))->safeUnref(); | 58 kBackgroundEndColor))->safeUnref(); |
59 paint.setStyle(SkPaint::kFill_Style); | 59 paint.setStyle(SkPaint::kFill_Style); |
60 canvas->AsCanvasSkia()->drawRectCoords( | 60 canvas->drawRectCoords(0, 0, |
61 0, 0, SkIntToScalar(width()), SkIntToScalar(height()), paint); | 61 SkIntToScalar(width()), SkIntToScalar(height()), |
| 62 paint); |
62 | 63 |
63 canvas->DrawBitmapInt(*sad_tab_bitmap_, icon_bounds_.x(), icon_bounds_.y()); | 64 canvas->DrawBitmapInt(*sad_tab_bitmap_, icon_bounds_.x(), icon_bounds_.y()); |
64 | 65 |
65 canvas->DrawStringInt(title_, *title_font_, kTitleColor, title_bounds_.x(), | 66 canvas->DrawStringInt(title_, *title_font_, kTitleColor, title_bounds_.x(), |
66 title_bounds_.y(), title_bounds_.width(), | 67 title_bounds_.y(), title_bounds_.width(), |
67 title_bounds_.height(), | 68 title_bounds_.height(), |
68 gfx::Canvas::TEXT_ALIGN_CENTER); | 69 gfx::Canvas::TEXT_ALIGN_CENTER); |
69 | 70 |
70 canvas->DrawStringInt(message_, *message_font_, kMessageColor, | 71 canvas->DrawStringInt(message_, *message_font_, kMessageColor, |
71 message_bounds_.x(), message_bounds_.y(), | 72 message_bounds_.x(), message_bounds_.y(), |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(1)); | 127 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(1)); |
127 sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB); | 128 sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB); |
128 | 129 |
129 title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE); | 130 title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE); |
130 title_width_ = title_font_->GetStringWidth(title_); | 131 title_width_ = title_font_->GetStringWidth(title_); |
131 message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE); | 132 message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE); |
132 | 133 |
133 initialized = true; | 134 initialized = true; |
134 } | 135 } |
135 } | 136 } |
OLD | NEW |