diff options
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r-- | chrome/browser/dom_ui/chrome_url_data_manager.cc | 16 | ||||
-rw-r--r-- | chrome/browser/dom_ui/chrome_url_data_manager.h | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/downloads_ui.cc | 4 | ||||
-rw-r--r-- | chrome/browser/dom_ui/history_ui.cc | 7 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 8 |
5 files changed, 26 insertions, 12 deletions
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index 113580a..3a189b4 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -9,8 +9,10 @@ #include "base/path_service.h" #include "base/string_util.h" #include "base/thread.h" +#include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/l10n_util.h" #include "chrome/common/ref_counted_util.h" #include "chrome/common/url_constants.h" #include "googleurl/src/url_util.h" @@ -24,6 +26,8 @@ #include "chrome/personalization/personalization.h" #endif +#include "grit/locale_settings.h" + // The URL scheme used for internal chrome resources. // TODO(glen): Choose a better location for this. static const char kChromeURLScheme[] = "chrome-ui"; @@ -259,6 +263,18 @@ void ChromeURLDataManager::DataSource::SendResponse( } // static +void ChromeURLDataManager::DataSource::SetFontAndTextDirection( + DictionaryValue* localized_strings) { + localized_strings->SetString(L"fontfamily", + l10n_util::GetString(IDS_WEB_FONT_FAMILY)); + localized_strings->SetString(L"fontsize", + l10n_util::GetString(IDS_WEB_FONT_SIZE)); + + localized_strings->SetString(L"textdirection", + (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? + L"rtl" : L"ltr"); +} + URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request, const std::string& scheme) { // Try first with a file handler diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.h b/chrome/browser/dom_ui/chrome_url_data_manager.h index c3f5688..f11045c 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.h +++ b/chrome/browser/dom_ui/chrome_url_data_manager.h @@ -11,6 +11,7 @@ #include "base/task.h" #include "chrome/common/ref_counted_util.h" +class DictionaryValue; class GURL; class MessageLoop; class URLRequest; @@ -61,6 +62,8 @@ class ChromeURLDataManager { MessageLoop* message_loop() const { return message_loop_; } const std::string& source_name() const { return source_name_; } + static void SetFontAndTextDirection(DictionaryValue* localized_strings); + private: // The name of this source. // E.g., for favicons, this could be "favicon", which results in paths for diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc index 81684bc..009d65b 100644 --- a/chrome/browser/dom_ui/downloads_ui.cc +++ b/chrome/browser/dom_ui/downloads_ui.cc @@ -94,9 +94,7 @@ void DownloadsUIHTMLSource::StartDataRequest(const std::string& path, localized_strings.SetString(L"control_resume", l10n_util::GetString(IDS_DOWNLOAD_LINK_RESUME)); - localized_strings.SetString(L"textdirection", - (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? - L"rtl" : L"ltr"); + SetFontAndTextDirection(&localized_strings); static const StringPiece downloads_html( ResourceBundle::GetSharedInstance().GetRawDataResource( diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc index 9309732..5e299b6 100644 --- a/chrome/browser/dom_ui/history_ui.cc +++ b/chrome/browser/dom_ui/history_ui.cc @@ -27,6 +27,7 @@ #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" +#include "grit/locale_settings.h" // Maximum number of search results to return in a given search. We should // eventually remove this. @@ -45,6 +46,8 @@ HistoryUIHTMLSource::HistoryUIHTMLSource() void HistoryUIHTMLSource::StartDataRequest(const std::string& path, int request_id) { DictionaryValue localized_strings; + localized_strings.SetString(L"loading", + l10n_util::GetString(IDS_HISTORY_LOADING)); localized_strings.SetString(L"title", l10n_util::GetString(IDS_HISTORY_TITLE)); localized_strings.SetString(L"loading", @@ -72,9 +75,7 @@ void HistoryUIHTMLSource::StartDataRequest(const std::string& path, localized_strings.SetString(L"deletedaywarning", l10n_util::GetString(IDS_HISTORY_DELETE_PRIOR_VISITS_WARNING)); - localized_strings.SetString(L"textdirection", - (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? - L"rtl" : L"ltr"); + SetFontAndTextDirection(&localized_strings); static const StringPiece history_html( ResourceBundle::GetSharedInstance().GetRawDataResource( diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 6250f10..15bbaa6 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -255,9 +255,7 @@ void NewTabHTMLSource::StartDataRequest(const std::string& path, localized_strings.SetString(L"closedwindow", l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW)); - localized_strings.SetString(L"textdirection", - (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? - kRTLHtmlTextDirection : kDefaultHtmlTextDirection); + SetFontAndTextDirection(&localized_strings); // Let the tab know whether it's the first tab being viewed. localized_strings.SetString(L"firstview", @@ -316,9 +314,7 @@ void IncognitoTabHTMLSource::StartDataRequest(const std::string& path, l10n_util::GetStringF(IDS_NEW_TAB_OTR_MESSAGE, l10n_util::GetString(IDS_LEARN_MORE_INCOGNITO_URL))); - localized_strings.SetString(L"textdirection", - (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? - kRTLHtmlTextDirection : kDefaultHtmlTextDirection); + SetFontAndTextDirection(&localized_strings); static const StringPiece incognito_tab_html( ResourceBundle::GetSharedInstance().GetRawDataResource( |