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/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 static const int kIconTitleSpacing = 20; | 23 static const int kIconTitleSpacing = 20; |
24 static const int kTitleMessageSpacing = 15; | 24 static const int kTitleMessageSpacing = 15; |
25 static const int kMessageBottomMargin = 20; | 25 static const int kMessageBottomMargin = 20; |
26 static const float kMessageSize = 0.65f; | 26 static const float kMessageSize = 0.65f; |
27 static const SkColor kTitleColor = SK_ColorWHITE; | 27 static const SkColor kTitleColor = SK_ColorWHITE; |
28 static const SkColor kMessageColor = SK_ColorWHITE; | 28 static const SkColor kMessageColor = SK_ColorWHITE; |
29 static const SkColor kLinkColor = SK_ColorWHITE; | 29 static const SkColor kLinkColor = SK_ColorWHITE; |
30 static const SkColor kBackgroundColor = SkColorSetRGB(35, 48, 64); | 30 static const SkColor kBackgroundColor = SkColorSetRGB(35, 48, 64); |
31 static const SkColor kBackgroundEndColor = SkColorSetRGB(35, 48, 64); | 31 static const SkColor kBackgroundEndColor = SkColorSetRGB(35, 48, 64); |
32 | 32 |
| 33 // Font size correction. |
| 34 #if defined(CROS_FONTS_USING_BCI) |
| 35 static const int kTitleFontSizeDelta = 1; |
| 36 static const int kMessageFontSizeDelta = 0; |
| 37 #else |
| 38 static const int kTitleFontSizeDelta = 2; |
| 39 static const int kMessageFontSizeDelta = 1; |
| 40 #endif |
| 41 |
33 // static | 42 // static |
34 SkBitmap* SadTabView::sad_tab_bitmap_ = NULL; | 43 SkBitmap* SadTabView::sad_tab_bitmap_ = NULL; |
35 gfx::Font* SadTabView::title_font_ = NULL; | 44 gfx::Font* SadTabView::title_font_ = NULL; |
36 gfx::Font* SadTabView::message_font_ = NULL; | 45 gfx::Font* SadTabView::message_font_ = NULL; |
37 std::wstring SadTabView::title_; | 46 std::wstring SadTabView::title_; |
38 std::wstring SadTabView::message_; | 47 std::wstring SadTabView::message_; |
39 int SadTabView::title_width_; | 48 int SadTabView::title_width_; |
40 | 49 |
41 SadTabView::SadTabView(TabContents* tab_contents) | 50 SadTabView::SadTabView(TabContents* tab_contents) |
42 : tab_contents_(tab_contents), | 51 : tab_contents_(tab_contents), |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 tab_contents_->OpenURL(help_url, GURL(), disposition, PageTransition::LINK); | 135 tab_contents_->OpenURL(help_url, GURL(), disposition, PageTransition::LINK); |
127 } | 136 } |
128 } | 137 } |
129 | 138 |
130 // static | 139 // static |
131 void SadTabView::InitClass() { | 140 void SadTabView::InitClass() { |
132 static bool initialized = false; | 141 static bool initialized = false; |
133 if (!initialized) { | 142 if (!initialized) { |
134 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 143 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
135 title_font_ = new gfx::Font( | 144 title_font_ = new gfx::Font( |
136 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(2, gfx::Font::BOLD)); | 145 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(kTitleFontSizeDelta, |
| 146 gfx::Font::BOLD)); |
137 message_font_ = new gfx::Font( | 147 message_font_ = new gfx::Font( |
138 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(1)); | 148 rb.GetFont(ResourceBundle::BaseFont).DeriveFont(kMessageFontSizeDelta)); |
139 sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB); | 149 sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB); |
140 | 150 |
141 title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE); | 151 title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE); |
142 title_width_ = title_font_->GetStringWidth(title_); | 152 title_width_ = title_font_->GetStringWidth(title_); |
143 message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE); | 153 message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE); |
144 | 154 |
145 initialized = true; | 155 initialized = true; |
146 } | 156 } |
147 } | 157 } |
OLD | NEW |