OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 NotifyAdvancedFontSettingsAvailability(); | 191 NotifyAdvancedFontSettingsAvailability(); |
192 } | 192 } |
193 | 193 |
194 void FontSettingsHandler::HandleFetchFontsData(const base::ListValue* args) { | 194 void FontSettingsHandler::HandleFetchFontsData(const base::ListValue* args) { |
195 content::GetFontListAsync( | 195 content::GetFontListAsync( |
196 base::Bind(&FontSettingsHandler::FontsListHasLoaded, | 196 base::Bind(&FontSettingsHandler::FontsListHasLoaded, |
197 weak_ptr_factory_.GetWeakPtr())); | 197 weak_ptr_factory_.GetWeakPtr())); |
198 } | 198 } |
199 | 199 |
200 void FontSettingsHandler::FontsListHasLoaded( | 200 void FontSettingsHandler::FontsListHasLoaded( |
201 scoped_ptr<base::ListValue> list) { | 201 std::unique_ptr<base::ListValue> list) { |
202 // Selects the directionality for the fonts in the given list. | 202 // Selects the directionality for the fonts in the given list. |
203 for (size_t i = 0; i < list->GetSize(); i++) { | 203 for (size_t i = 0; i < list->GetSize(); i++) { |
204 base::ListValue* font; | 204 base::ListValue* font; |
205 bool has_font = list->GetList(i, &font); | 205 bool has_font = list->GetList(i, &font); |
206 DCHECK(has_font); | 206 DCHECK(has_font); |
207 base::string16 value; | 207 base::string16 value; |
208 bool has_value = font->GetString(1, &value); | 208 bool has_value = font->GetString(1, &value); |
209 DCHECK(has_value); | 209 DCHECK(has_value); |
210 bool has_rtl_chars = base::i18n::StringContainsStrongRTLChars(value); | 210 bool has_rtl_chars = base::i18n::StringContainsStrongRTLChars(value); |
211 font->Append(new base::StringValue(has_rtl_chars ? "rtl" : "ltr")); | 211 font->Append(new base::StringValue(has_rtl_chars ? "rtl" : "ltr")); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); | 316 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); |
317 } | 317 } |
318 | 318 |
319 void FontSettingsHandler::OnWebKitDefaultFontSizeChanged() { | 319 void FontSettingsHandler::OnWebKitDefaultFontSizeChanged() { |
320 SetUpStandardFontSample(); | 320 SetUpStandardFontSample(); |
321 SetUpSerifFontSample(); | 321 SetUpSerifFontSample(); |
322 SetUpSansSerifFontSample(); | 322 SetUpSansSerifFontSample(); |
323 } | 323 } |
324 | 324 |
325 } // namespace options | 325 } // namespace options |
OLD | NEW |