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

Side by Side Diff: chrome/browser/ui/webui/options/font_settings_handler.cc

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/options/font_settings_handler.h" 5 #include "chrome/browser/ui/webui/options/font_settings_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 std::vector<CharacterEncoding::EncodingInfo>::const_iterator it; 121 std::vector<CharacterEncoding::EncodingInfo>::const_iterator it;
122 for (it = encodings->begin(); it != encodings->end(); ++it) { 122 for (it = encodings->begin(); it != encodings->end(); ++it) {
123 ListValue* option = new ListValue(); 123 ListValue* option = new ListValue();
124 if (it->encoding_id) { 124 if (it->encoding_id) {
125 int cmd_id = it->encoding_id; 125 int cmd_id = it->encoding_id;
126 std::string encoding = 126 std::string encoding =
127 CharacterEncoding::GetCanonicalEncodingNameByCommandId(cmd_id); 127 CharacterEncoding::GetCanonicalEncodingNameByCommandId(cmd_id);
128 string16 name = it->encoding_display_name; 128 string16 name = it->encoding_display_name;
129 base::i18n::AdjustStringForLocaleDirection(&name); 129 base::i18n::AdjustStringForLocaleDirection(&name);
130 option->Append(Value::CreateStringValue(encoding)); 130 option->Append(base::StringValue::New(encoding));
131 option->Append(Value::CreateStringValue(name)); 131 option->Append(base::StringValue::New(name));
132 } else { 132 } else {
133 // Add empty name/value to indicate a separator item. 133 // Add empty name/value to indicate a separator item.
134 option->Append(Value::CreateStringValue("")); 134 option->Append(base::StringValue::New(""));
135 option->Append(Value::CreateStringValue("")); 135 option->Append(base::StringValue::New(""));
136 } 136 }
137 encoding_list.Append(option); 137 encoding_list.Append(option);
138 } 138 }
139 139
140 ListValue selected_values; 140 ListValue selected_values;
141 selected_values.Append(Value::CreateStringValue(standard_font_.GetValue())); 141 selected_values.Append(base::StringValue::New(standard_font_.GetValue()));
142 selected_values.Append(Value::CreateStringValue(serif_font_.GetValue())); 142 selected_values.Append(base::StringValue::New(serif_font_.GetValue()));
143 selected_values.Append(Value::CreateStringValue(sans_serif_font_.GetValue())); 143 selected_values.Append(base::StringValue::New(sans_serif_font_.GetValue()));
144 selected_values.Append(Value::CreateStringValue(fixed_font_.GetValue())); 144 selected_values.Append(base::StringValue::New(fixed_font_.GetValue()));
145 selected_values.Append(Value::CreateStringValue(font_encoding_.GetValue())); 145 selected_values.Append(base::StringValue::New(font_encoding_.GetValue()));
146 146
147 web_ui_->CallJavascriptFunction("FontSettings.setFontsData", 147 web_ui_->CallJavascriptFunction("FontSettings.setFontsData",
148 *list->list.get(), encoding_list, 148 *list->list.get(), encoding_list,
149 selected_values); 149 selected_values);
150 } 150 }
151 151
152 void FontSettingsHandler::Observe(int type, 152 void FontSettingsHandler::Observe(int type,
153 const NotificationSource& source, 153 const NotificationSource& source,
154 const NotificationDetails& details) { 154 const NotificationDetails& details) {
155 if (type == chrome::NOTIFICATION_PREF_CHANGED) { 155 if (type == chrome::NOTIFICATION_PREF_CHANGED) {
(...skipping 12 matching lines...) Expand all
168 SetUpSerifFontSample(); 168 SetUpSerifFontSample();
169 SetUpSansSerifFontSample(); 169 SetUpSansSerifFontSample();
170 } else if (*pref_name == prefs::kWebKitMinimumFontSize) { 170 } else if (*pref_name == prefs::kWebKitMinimumFontSize) {
171 SetUpMinimumFontSample(); 171 SetUpMinimumFontSample();
172 } 172 }
173 } 173 }
174 } 174 }
175 175
176 void FontSettingsHandler::SetUpStandardFontSample() { 176 void FontSettingsHandler::SetUpStandardFontSample() {
177 base::StringValue font_value(standard_font_.GetValue()); 177 base::StringValue font_value(standard_font_.GetValue());
178 base::FundamentalValue size_value(default_font_size_.GetValue()); 178 base::NumberValue size_value(default_font_size_.GetValue());
179 web_ui_->CallJavascriptFunction( 179 web_ui_->CallJavascriptFunction(
180 "FontSettings.setUpStandardFontSample", font_value, size_value); 180 "FontSettings.setUpStandardFontSample", font_value, size_value);
181 } 181 }
182 182
183 void FontSettingsHandler::SetUpSerifFontSample() { 183 void FontSettingsHandler::SetUpSerifFontSample() {
184 base::StringValue font_value(serif_font_.GetValue()); 184 base::StringValue font_value(serif_font_.GetValue());
185 base::FundamentalValue size_value(default_font_size_.GetValue()); 185 base::NumberValue size_value(default_font_size_.GetValue());
186 web_ui_->CallJavascriptFunction( 186 web_ui_->CallJavascriptFunction(
187 "FontSettings.setUpSerifFontSample", font_value, size_value); 187 "FontSettings.setUpSerifFontSample", font_value, size_value);
188 } 188 }
189 189
190 void FontSettingsHandler::SetUpSansSerifFontSample() { 190 void FontSettingsHandler::SetUpSansSerifFontSample() {
191 base::StringValue font_value(sans_serif_font_.GetValue()); 191 base::StringValue font_value(sans_serif_font_.GetValue());
192 base::FundamentalValue size_value(default_font_size_.GetValue()); 192 base::NumberValue size_value(default_font_size_.GetValue());
193 web_ui_->CallJavascriptFunction( 193 web_ui_->CallJavascriptFunction(
194 "FontSettings.setUpSansSerifFontSample", font_value, size_value); 194 "FontSettings.setUpSansSerifFontSample", font_value, size_value);
195 } 195 }
196 196
197 void FontSettingsHandler::SetUpFixedFontSample() { 197 void FontSettingsHandler::SetUpFixedFontSample() {
198 base::StringValue font_value(fixed_font_.GetValue()); 198 base::StringValue font_value(fixed_font_.GetValue());
199 base::FundamentalValue size_value(default_fixed_font_size_.GetValue()); 199 base::NumberValue size_value(default_fixed_font_size_.GetValue());
200 web_ui_->CallJavascriptFunction( 200 web_ui_->CallJavascriptFunction(
201 "FontSettings.setUpFixedFontSample", font_value, size_value); 201 "FontSettings.setUpFixedFontSample", font_value, size_value);
202 } 202 }
203 203
204 void FontSettingsHandler::SetUpMinimumFontSample() { 204 void FontSettingsHandler::SetUpMinimumFontSample() {
205 base::FundamentalValue size_value(minimum_font_size_.GetValue()); 205 base::NumberValue size_value(minimum_font_size_.GetValue());
206 web_ui_->CallJavascriptFunction("FontSettings.setUpMinimumFontSample", 206 web_ui_->CallJavascriptFunction("FontSettings.setUpMinimumFontSample",
207 size_value); 207 size_value);
208 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698