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

Unified Diff: chrome/browser/ui/webui/options/font_settings_handler.cc

Issue 7044012: Support getting the font list in Pepper. This currently only works out of (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/font_settings_handler.cc
===================================================================
--- chrome/browser/ui/webui/options/font_settings_handler.cc (revision 85766)
+++ chrome/browser/ui/webui/options/font_settings_handler.cc (working copy)
@@ -7,6 +7,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/bind.h"
#include "base/i18n/rtl.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
@@ -24,12 +25,9 @@
#include "ui/base/l10n/l10n_util.h"
FontSettingsHandler::FontSettingsHandler() {
- fonts_list_loader_ = new FontSettingsFontsListLoader(this);
}
FontSettingsHandler::~FontSettingsHandler() {
- if (fonts_list_loader_)
- fonts_list_loader_->SetObserver(NULL);
}
void FontSettingsHandler::GetLocalizedValues(
@@ -104,12 +102,12 @@
}
void FontSettingsHandler::HandleFetchFontsData(const ListValue* args) {
- fonts_list_loader_->StartLoadFontsList();
+ content::GetFontListAsync(
+ base::Bind(&FontSettingsHandler::FontsListHasLoaded, AsWeakPtr()));
}
-void FontSettingsHandler::FontsListHasLoaded() {
- ListValue* fonts_list = fonts_list_loader_->GetFontsList();
-
+void FontSettingsHandler::FontsListHasLoaded(
+ scoped_refptr<content::FontListResult> list) {
ListValue encoding_list;
const std::vector<CharacterEncoding::EncodingInfo>* encodings;
PrefService* pref_service = web_ui_->GetProfile()->GetPrefs();
@@ -147,7 +145,8 @@
selected_values.Append(Value::CreateStringValue(font_encoding_.GetValue()));
web_ui_->CallJavascriptFunction("FontSettings.setFontsData",
- *fonts_list, encoding_list, selected_values);
+ *list->list.get(), encoding_list,
+ selected_values);
}
void FontSettingsHandler::Observe(NotificationType type,
« no previous file with comments | « chrome/browser/ui/webui/options/font_settings_handler.h ('k') | chrome/browser/ui/webui/options/font_settings_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698