Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/browser/views/sad_tab_view.cc

Issue 113441: ChromeFont->gfx::Font... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/views/sad_tab_view.h ('k') | chrome/browser/views/shelf_item_dialog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/gfx/chrome_canvas.h" 7 #include "app/gfx/chrome_canvas.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "base/gfx/size.h" 10 #include "base/gfx/size.h"
11 #include "grit/generated_resources.h" 11 #include "grit/generated_resources.h"
12 #include "grit/theme_resources.h" 12 #include "grit/theme_resources.h"
13 #include "skia/ext/skia_utils.h" 13 #include "skia/ext/skia_utils.h"
14 #include "third_party/skia/include/effects/SkGradientShader.h" 14 #include "third_party/skia/include/effects/SkGradientShader.h"
15 15
16 static const int kSadTabOffset = -64; 16 static const int kSadTabOffset = -64;
17 static const int kIconTitleSpacing = 20; 17 static const int kIconTitleSpacing = 20;
18 static const int kTitleMessageSpacing = 15; 18 static const int kTitleMessageSpacing = 15;
19 static const int kMessageBottomMargin = 20; 19 static const int kMessageBottomMargin = 20;
20 static const float kMessageSize = 0.65f; 20 static const float kMessageSize = 0.65f;
21 static const SkColor kTitleColor = SK_ColorWHITE; 21 static const SkColor kTitleColor = SK_ColorWHITE;
22 static const SkColor kMessageColor = SK_ColorWHITE; 22 static const SkColor kMessageColor = SK_ColorWHITE;
23 static const SkColor kBackgroundColor = SkColorSetRGB(35, 48, 64); 23 static const SkColor kBackgroundColor = SkColorSetRGB(35, 48, 64);
24 static const SkColor kBackgroundEndColor = SkColorSetRGB(35, 48, 64); 24 static const SkColor kBackgroundEndColor = SkColorSetRGB(35, 48, 64);
25 25
26 // static 26 // static
27 SkBitmap* SadTabView::sad_tab_bitmap_ = NULL; 27 SkBitmap* SadTabView::sad_tab_bitmap_ = NULL;
28 ChromeFont* SadTabView::title_font_ = NULL; 28 gfx::Font* SadTabView::title_font_ = NULL;
29 ChromeFont* SadTabView::message_font_ = NULL; 29 gfx::Font* SadTabView::message_font_ = NULL;
30 std::wstring SadTabView::title_; 30 std::wstring SadTabView::title_;
31 std::wstring SadTabView::message_; 31 std::wstring SadTabView::message_;
32 int SadTabView::title_width_; 32 int SadTabView::title_width_;
33 33
34 SadTabView::SadTabView() { 34 SadTabView::SadTabView() {
35 InitClass(); 35 InitClass();
36 } 36 }
37 37
38 void SadTabView::Paint(ChromeCanvas* canvas) { 38 void SadTabView::Paint(ChromeCanvas* canvas) {
39 SkPaint paint; 39 SkPaint paint;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 int message_x = (width() - message_width) / 2; 78 int message_x = (width() - message_width) / 2;
79 int message_y = title_bounds_.bottom() + kTitleMessageSpacing; 79 int message_y = title_bounds_.bottom() + kTitleMessageSpacing;
80 message_bounds_.SetRect(message_x, message_y, message_width, message_height); 80 message_bounds_.SetRect(message_x, message_y, message_width, message_height);
81 } 81 }
82 82
83 // static 83 // static
84 void SadTabView::InitClass() { 84 void SadTabView::InitClass() {
85 static bool initialized = false; 85 static bool initialized = false;
86 if (!initialized) { 86 if (!initialized) {
87 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 87 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
88 title_font_ = new ChromeFont( 88 title_font_ = new gfx::Font(
89 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(2, ChromeFont::BOLD)); 89 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(2, gfx::Font::BOLD));
90 message_font_ = new ChromeFont( 90 message_font_ = new gfx::Font(
91 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(1)); 91 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(1));
92 sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB); 92 sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB);
93 93
94 title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE); 94 title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE);
95 title_width_ = title_font_->GetStringWidth(title_); 95 title_width_ = title_font_->GetStringWidth(title_);
96 message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE); 96 message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE);
97 97
98 initialized = true; 98 initialized = true;
99 } 99 }
100 } 100 }
OLDNEW
« no previous file with comments | « chrome/browser/views/sad_tab_view.h ('k') | chrome/browser/views/shelf_item_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698