| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/options/fonts_page_view.h" | 5 #include "chrome/browser/views/options/fonts_page_view.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 #include <vsstyle.h> | 9 #include <vsstyle.h> |
| 10 #include <vssym32.h> | 10 #include <vssym32.h> |
| 11 | 11 |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "app/l10n_util.h" | 14 #include "app/l10n_util.h" |
| 15 #include "app/l10n_util_collator.h" | 15 #include "app/l10n_util_collator.h" |
| 16 #include "app/resource_bundle.h" | 16 #include "app/resource_bundle.h" |
| 17 #include "base/file_util.h" | 17 #include "base/file_util.h" |
| 18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "chrome/browser/default_encoding_combo_model.h" | 19 #include "chrome/browser/default_encoding_combo_model.h" |
| 20 #include "chrome/browser/pref_service.h" | 20 #include "chrome/browser/pref_service.h" |
| 21 #include "chrome/browser/profile.h" | 21 #include "chrome/browser/profile.h" |
| 22 #include "chrome/browser/shell_dialogs.h" | 22 #include "chrome/browser/shell_dialogs.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "gfx/canvas_skia.h" | 24 #include "gfx/canvas.h" |
| 25 #include "gfx/font.h" | 25 #include "gfx/font.h" |
| 26 #include "gfx/native_theme_win.h" | 26 #include "gfx/native_theme_win.h" |
| 27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 28 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
| 29 #include "grit/locale_settings.h" | 29 #include "grit/locale_settings.h" |
| 30 #include "third_party/skia/include/core/SkBitmap.h" | 30 #include "third_party/skia/include/core/SkBitmap.h" |
| 31 #include "views/controls/button/native_button.h" | 31 #include "views/controls/button/native_button.h" |
| 32 #include "views/grid_layout.h" | 32 #include "views/grid_layout.h" |
| 33 #include "views/standard_layout.h" | 33 #include "views/standard_layout.h" |
| 34 #include "views/widget/widget.h" | 34 #include "views/widget/widget.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 displayed_text += L", "; | 89 displayed_text += L", "; |
| 90 displayed_text += UTF8ToWide(::StringPrintf("%d", font_size_)); | 90 displayed_text += UTF8ToWide(::StringPrintf("%d", font_size_)); |
| 91 HDC hdc = GetDC(NULL); | 91 HDC hdc = GetDC(NULL); |
| 92 int font_size_point = MulDiv(font_size, 72, GetDeviceCaps(hdc, LOGPIXELSY)); | 92 int font_size_point = MulDiv(font_size, 72, GetDeviceCaps(hdc, LOGPIXELSY)); |
| 93 gfx::Font font = gfx::Font::CreateFont(font_name, font_size_point); | 93 gfx::Font font = gfx::Font::CreateFont(font_name, font_size_point); |
| 94 font_text_label_->SetFont(font); | 94 font_text_label_->SetFont(font); |
| 95 font_text_label_->SetText(displayed_text); | 95 font_text_label_->SetText(displayed_text); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void FontDisplayView::Paint(gfx::Canvas* canvas) { | 98 void FontDisplayView::Paint(gfx::Canvas* canvas) { |
| 99 HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint(); | 99 HDC dc = canvas->beginPlatformPaint(); |
| 100 RECT rect = { 0, 0, width(), height() }; | 100 RECT rect = { 0, 0, width(), height() }; |
| 101 gfx::NativeTheme::instance()->PaintTextField( | 101 gfx::NativeTheme::instance()->PaintTextField( |
| 102 dc, EP_BACKGROUND, EBS_NORMAL, 0, &rect, ::GetSysColor(COLOR_3DFACE), | 102 dc, EP_BACKGROUND, EBS_NORMAL, 0, &rect, ::GetSysColor(COLOR_3DFACE), |
| 103 true, true); | 103 true, true); |
| 104 canvas->AsCanvasSkia()->endPlatformPaint(); | 104 canvas->endPlatformPaint(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void FontDisplayView::Layout() { | 107 void FontDisplayView::Layout() { |
| 108 font_text_label_->SetBounds(0, 0, width(), height()); | 108 font_text_label_->SetBounds(0, 0, width(), height()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 gfx::Size FontDisplayView::GetPreferredSize() { | 111 gfx::Size FontDisplayView::GetPreferredSize() { |
| 112 gfx::Size size = font_text_label_->GetPreferredSize(); | 112 gfx::Size size = font_text_label_->GetPreferredSize(); |
| 113 size.set_width(size.width() + 2 * kFontDisplayLabelPadding); | 113 size.set_width(size.width() + 2 * kFontDisplayLabelPadding); |
| 114 size.set_height(size.height() + 2 * kFontDisplayLabelPadding); | 114 size.set_height(size.height() + 2 * kFontDisplayLabelPadding); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 425 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
| 426 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 426 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
| 427 GridLayout::USE_PREF, 0, 0); | 427 GridLayout::USE_PREF, 0, 0); |
| 428 | 428 |
| 429 // Add Encoding Combobox. | 429 // Add Encoding Combobox. |
| 430 layout->StartRow(0, double_column_view_set_id); | 430 layout->StartRow(0, double_column_view_set_id); |
| 431 layout->AddView(default_encoding_combobox_label_); | 431 layout->AddView(default_encoding_combobox_label_); |
| 432 layout->AddView(default_encoding_combobox_, 1, 1, GridLayout::FILL, | 432 layout->AddView(default_encoding_combobox_, 1, 1, GridLayout::FILL, |
| 433 GridLayout::CENTER); | 433 GridLayout::CENTER); |
| 434 } | 434 } |
| OLD | NEW |