| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/options/fonts_page_gtk.h" | 5 #include "chrome/browser/gtk/options/fonts_page_gtk.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/gtk/options/options_layout_gtk.h" | 9 #include "chrome/browser/gtk/options/options_layout_gtk.h" |
| 10 #include "chrome/common/gtk_util.h" | 10 #include "chrome/common/gtk_util.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 MakeFontName(sans_serif_name_.GetValue(), | 133 MakeFontName(sans_serif_name_.GetValue(), |
| 134 variable_width_size_.GetValue()).c_str()); | 134 variable_width_size_.GetValue()).c_str()); |
| 135 } | 135 } |
| 136 if (!pref_name || *pref_name == prefs::kWebKitFixedFontFamily || | 136 if (!pref_name || *pref_name == prefs::kWebKitFixedFontFamily || |
| 137 *pref_name == prefs::kWebKitDefaultFixedFontSize) { | 137 *pref_name == prefs::kWebKitDefaultFixedFontSize) { |
| 138 gtk_font_button_set_font_name(GTK_FONT_BUTTON(fixed_font_button_), | 138 gtk_font_button_set_font_name(GTK_FONT_BUTTON(fixed_font_button_), |
| 139 MakeFontName(fixed_width_name_.GetValue(), | 139 MakeFontName(fixed_width_name_.GetValue(), |
| 140 fixed_width_size_.GetValue()).c_str()); | 140 fixed_width_size_.GetValue()).c_str()); |
| 141 } | 141 } |
| 142 if (!pref_name || *pref_name == prefs::kDefaultCharset) { | 142 if (!pref_name || *pref_name == prefs::kDefaultCharset) { |
| 143 const std::wstring current_encoding = default_encoding_.GetValue(); | 143 const std::string current_encoding = |
| 144 WideToASCII(default_encoding_.GetValue()); |
| 144 for (size_t i = 0; i < sorted_encoding_list_.size(); i++) { | 145 for (size_t i = 0; i < sorted_encoding_list_.size(); i++) { |
| 145 if (CharacterEncoding::GetCanonicalEncodingNameByCommandId( | 146 if (CharacterEncoding::GetCanonicalEncodingNameByCommandId( |
| 146 sorted_encoding_list_[i].encoding_id) == current_encoding) { | 147 sorted_encoding_list_[i].encoding_id) == current_encoding) { |
| 147 gtk_combo_box_set_active(GTK_COMBO_BOX(default_encoding_combobox_), i); | 148 gtk_combo_box_set_active(GTK_COMBO_BOX(default_encoding_combobox_), i); |
| 148 break; | 149 break; |
| 149 } | 150 } |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 } | 153 } |
| 153 | 154 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // static | 195 // static |
| 195 void FontsPageGtk::OnDefaultEncodingChanged(GtkComboBox* combo_box, | 196 void FontsPageGtk::OnDefaultEncodingChanged(GtkComboBox* combo_box, |
| 196 FontsPageGtk* fonts_page) { | 197 FontsPageGtk* fonts_page) { |
| 197 int index = gtk_combo_box_get_active(combo_box); | 198 int index = gtk_combo_box_get_active(combo_box); |
| 198 if (index < 0 || | 199 if (index < 0 || |
| 199 static_cast<size_t>(index) >= fonts_page->sorted_encoding_list_.size()) { | 200 static_cast<size_t>(index) >= fonts_page->sorted_encoding_list_.size()) { |
| 200 NOTREACHED(); | 201 NOTREACHED(); |
| 201 return; | 202 return; |
| 202 } | 203 } |
| 203 fonts_page->default_encoding_.SetValue( | 204 fonts_page->default_encoding_.SetValue( |
| 204 CharacterEncoding::GetCanonicalEncodingNameByCommandId( | 205 ASCIIToWide(CharacterEncoding::GetCanonicalEncodingNameByCommandId( |
| 205 fonts_page->sorted_encoding_list_[index].encoding_id)); | 206 fonts_page->sorted_encoding_list_[index].encoding_id))); |
| 206 } | 207 } |
| OLD | NEW |