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->drawRectCoords(0, 0, | 60 canvas->AsCanvasSkia()->drawRectCoords( |
61 SkIntToScalar(width()), SkIntToScalar(height()), | 61 0, 0, SkIntToScalar(width()), SkIntToScalar(height()), paint); |
62 paint); | |
63 | 62 |
64 canvas->DrawBitmapInt(*sad_tab_bitmap_, icon_bounds_.x(), icon_bounds_.y()); | 63 canvas->DrawBitmapInt(*sad_tab_bitmap_, icon_bounds_.x(), icon_bounds_.y()); |
65 | 64 |
66 canvas->DrawStringInt(title_, *title_font_, kTitleColor, title_bounds_.x(), | 65 canvas->DrawStringInt(title_, *title_font_, kTitleColor, title_bounds_.x(), |
67 title_bounds_.y(), title_bounds_.width(), | 66 title_bounds_.y(), title_bounds_.width(), |
68 title_bounds_.height(), | 67 title_bounds_.height(), |
69 gfx::Canvas::TEXT_ALIGN_CENTER); | 68 gfx::Canvas::TEXT_ALIGN_CENTER); |
70 | 69 |
71 canvas->DrawStringInt(message_, *message_font_, kMessageColor, | 70 canvas->DrawStringInt(message_, *message_font_, kMessageColor, |
72 message_bounds_.x(), message_bounds_.y(), | 71 message_bounds_.x(), message_bounds_.y(), |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(1)); | 126 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(1)); |
128 sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB); | 127 sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB); |
129 | 128 |
130 title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE); | 129 title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE); |
131 title_width_ = title_font_->GetStringWidth(title_); | 130 title_width_ = title_font_->GetStringWidth(title_); |
132 message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE); | 131 message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE); |
133 | 132 |
134 initialized = true; | 133 initialized = true; |
135 } | 134 } |
136 } | 135 } |
OLD | NEW |