summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authornsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-03 20:46:40 +0000
committernsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-03 20:46:40 +0000
commit6470ee8f59dba5eecfce4a64d7ff3930ae716095 (patch)
tree86e020619f32c56f5796a0ea20975c71607ac91f /chrome/browser/dom_ui
parent409993dec55a874e0659acf421a87070d450a262 (diff)
downloadchromium_src-6470ee8f59dba5eecfce4a64d7ff3930ae716095.zip
chromium_src-6470ee8f59dba5eecfce4a64d7ff3930ae716095.tar.gz
chromium_src-6470ee8f59dba5eecfce4a64d7ff3930ae716095.tar.bz2
Revert dsh's change 10818
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10821 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/dom_ui.cc4
-rw-r--r--chrome/browser/dom_ui/history_ui.cc70
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc103
3 files changed, 80 insertions, 97 deletions
diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc
index 9a52bdd..b0efcad 100644
--- a/chrome/browser/dom_ui/dom_ui.cc
+++ b/chrome/browser/dom_ui/dom_ui.cc
@@ -111,7 +111,7 @@ void DOMMessageHandler::SetURLAndTitle(DictionaryValue* dictionary,
std::wstring title,
const GURL& gurl) {
std::wstring wstring_url = UTF8ToWide(gurl.spec());
- dictionary->SetString(LIT16("url"), WideToUTF16Hack(wstring_url));
+ dictionary->SetString(L"url", wstring_url);
bool using_url_as_the_title = false;
if (title.empty()) {
@@ -133,7 +133,7 @@ void DOMMessageHandler::SetURLAndTitle(DictionaryValue* dictionary,
DCHECK(success ? (title != title_to_set) : (title == title_to_set));
}
}
- dictionary->SetString(LIT16("title"), WideToUTF16Hack(title_to_set));
+ dictionary->SetString(L"title", title_to_set);
}
bool DOMMessageHandler::ExtractIntegerValue(const Value* value, int* out_int) {
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc
index bbc1602..9bc5d61 100644
--- a/chrome/browser/dom_ui/history_ui.cc
+++ b/chrome/browser/dom_ui/history_ui.cc
@@ -49,32 +49,32 @@ HistoryUIHTMLSource::HistoryUIHTMLSource()
void HistoryUIHTMLSource::StartDataRequest(const std::string& path,
int request_id) {
DictionaryValue localized_strings;
- localized_strings.SetString(LIT16("title"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_TITLE)));
- localized_strings.SetString(LIT16("loading"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_LOADING)));
- localized_strings.SetString(LIT16("newest"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_NEWEST)));
- localized_strings.SetString(LIT16("newer"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_NEWER)));
- localized_strings.SetString(LIT16("older"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_OLDER)));
- localized_strings.SetString(LIT16("searchresultsfor"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_SEARCHRESULTSFOR)));
- localized_strings.SetString(LIT16("history"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_BROWSERESULTS)));
- localized_strings.SetString(LIT16("cont"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_CONTINUED)));
- localized_strings.SetString(LIT16("searchbutton"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_SEARCH_BUTTON)));
- localized_strings.SetString(LIT16("noresults"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_NO_RESULTS)));
- localized_strings.SetString(LIT16("noitems"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_NO_ITEMS)));
- localized_strings.SetString(LIT16("deleteday"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_DELETE_PRIOR_VISITS_LINK)));
- localized_strings.SetString(LIT16("deletedaywarning"),
- WideToUTF16Hack(l10n_util::GetString(IDS_HISTORY_DELETE_PRIOR_VISITS_WARNING)));
+ localized_strings.SetString(L"title",
+ l10n_util::GetString(IDS_HISTORY_TITLE));
+ localized_strings.SetString(L"loading",
+ l10n_util::GetString(IDS_HISTORY_LOADING));
+ localized_strings.SetString(L"newest",
+ l10n_util::GetString(IDS_HISTORY_NEWEST));
+ localized_strings.SetString(L"newer",
+ l10n_util::GetString(IDS_HISTORY_NEWER));
+ localized_strings.SetString(L"older",
+ l10n_util::GetString(IDS_HISTORY_OLDER));
+ localized_strings.SetString(L"searchresultsfor",
+ l10n_util::GetString(IDS_HISTORY_SEARCHRESULTSFOR));
+ localized_strings.SetString(L"history",
+ l10n_util::GetString(IDS_HISTORY_BROWSERESULTS));
+ localized_strings.SetString(L"cont",
+ l10n_util::GetString(IDS_HISTORY_CONTINUED));
+ localized_strings.SetString(L"searchbutton",
+ l10n_util::GetString(IDS_HISTORY_SEARCH_BUTTON));
+ localized_strings.SetString(L"noresults",
+ l10n_util::GetString(IDS_HISTORY_NO_RESULTS));
+ localized_strings.SetString(L"noitems",
+ l10n_util::GetString(IDS_HISTORY_NO_ITEMS));
+ localized_strings.SetString(L"deleteday",
+ l10n_util::GetString(IDS_HISTORY_DELETE_PRIOR_VISITS_LINK));
+ localized_strings.SetString(L"deletedaywarning",
+ l10n_util::GetString(IDS_HISTORY_DELETE_PRIOR_VISITS_WARNING));
static const StringPiece history_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
@@ -226,7 +226,7 @@ void BrowsingHistoryHandler::QueryComplete(
SetURLAndTitle(page_value, page.title(), page.url());
// Need to pass the time in epoch time (fastest JS conversion).
- page_value->SetInteger(LIT16("time"),
+ page_value->SetInteger(L"time",
static_cast<int>(page.visit_time().ToTimeT()));
// Until we get some JS i18n infrastructure, we also need to
@@ -246,17 +246,13 @@ void BrowsingHistoryHandler::QueryComplete(
IDS_HISTORY_DATE_WITH_RELATIVE_TIME,
date_str, base::TimeFormatFriendlyDate(page.visit_time()));
}
- page_value->SetString(LIT16("dateRelativeDay"),
- WideToUTF16Hack(date_str));
- page_value->SetString(
- LIT16("dateTimeOfDay"),
- WideToUTF16Hack(base::TimeFormatTimeOfDay(page.visit_time())));
+ page_value->SetString(L"dateRelativeDay", date_str);
+ page_value->SetString(L"dateTimeOfDay",
+ base::TimeFormatTimeOfDay(page.visit_time()));
} else {
- page_value->SetString(
- LIT16("dateShort"),
- WideToUTF16Hack(base::TimeFormatShortDate(page.visit_time())));
- page_value->SetString(
- LIT16("snippet"), WideToUTF16Hack(page.snippet().text()));
+ page_value->SetString(L"dateShort",
+ base::TimeFormatShortDate(page.visit_time()));
+ page_value->SetString(L"snippet", page.snippet().text());
}
page_value->SetBoolean(L"starred",
dom_ui_->get_profile()->GetBookmarkModel()->IsBookmarked(page.url()));
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 26366f7..afb7baa 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -125,14 +125,14 @@ class PaintTimer : public RenderWidgetHost::PaintObserver {
void SetURLTitleAndDirection(DictionaryValue* dictionary,
const std::wstring& title,
const GURL& gurl) {
- string16 string_url = UTF8ToUTF16(gurl.spec());
- dictionary->SetString(LIT16("url"), string_url);
+ std::wstring wstring_url = UTF8ToWide(gurl.spec());
+ dictionary->SetString(L"url", wstring_url);
bool using_url_as_the_title = false;
std::wstring title_to_set(title);
if (title_to_set.empty()) {
using_url_as_the_title = true;
- title_to_set = UTF16ToWideHack(string_url);
+ title_to_set = wstring_url;
}
// We set the "dir" attribute of the title, so that in RTL locales, a LTR
@@ -168,8 +168,8 @@ void SetURLTitleAndDirection(DictionaryValue* dictionary,
}
}
}
- dictionary->SetString(LIT16("title"), WideToUTF16Hack(title_to_set));
- dictionary->SetString(LIT16("direction"), WideToUTF16Hack(direction));
+ dictionary->SetString(L"title", title_to_set);
+ dictionary->SetString(L"direction", direction);
}
} // end anonymous namespace
@@ -208,42 +208,35 @@ void NewTabHTMLSource::StartDataRequest(const std::string& path,
profile_name);
}
DictionaryValue localized_strings;
- localized_strings.SetString(LIT16("title"), WideToUTF16Hack(title));
- localized_strings.SetString(LIT16("mostvisited"),
- WideToUTF16Hack(most_visited));
- localized_strings.SetString(LIT16("searches"),
- WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_SEARCHES)));
- localized_strings.SetString(LIT16("bookmarks"),
- WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_BOOKMARKS)));
- localized_strings.SetString(LIT16("showhistory"),
- WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_HISTORY_SHOW)));
- localized_strings.SetString(LIT16("searchhistory"),
- WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_HISTORY_SEARCH)));
- localized_strings.SetString(LIT16("recentlyclosed"),
- WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED)));
- localized_strings.SetString(
- LIT16("mostvisitedintro"),
- WideToUTF16Hack(l10n_util::GetStringF(
- IDS_NEW_TAB_MOST_VISITED_INTRO,
- l10n_util::GetString(IDS_WELCOME_PAGE_URL))));
- localized_strings.SetString(
- LIT16("closedwindow"),
- WideToUTF16Hack(
- l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW)));
-
- localized_strings.SetString(
- LIT16("textdirection"),
- WideToUTF16Hack(
- (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
- kRTLHtmlTextDirection : kDefaultHtmlTextDirection));
+ localized_strings.SetString(L"title", title);
+ localized_strings.SetString(L"mostvisited", most_visited);
+ localized_strings.SetString(L"searches",
+ l10n_util::GetString(IDS_NEW_TAB_SEARCHES));
+ localized_strings.SetString(L"bookmarks",
+ l10n_util::GetString(IDS_NEW_TAB_BOOKMARKS));
+ localized_strings.SetString(L"showhistory",
+ l10n_util::GetString(IDS_NEW_TAB_HISTORY_SHOW));
+ localized_strings.SetString(L"searchhistory",
+ l10n_util::GetString(IDS_NEW_TAB_HISTORY_SEARCH));
+ localized_strings.SetString(L"recentlyclosed",
+ l10n_util::GetString(IDS_NEW_TAB_RECENTLY_CLOSED));
+ localized_strings.SetString(L"mostvisitedintro",
+ l10n_util::GetStringF(IDS_NEW_TAB_MOST_VISITED_INTRO,
+ l10n_util::GetString(IDS_WELCOME_PAGE_URL)));
+ 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);
// Let the tab know whether it's the first tab being viewed.
- localized_strings.SetString(LIT16("firstview"),
- first_view_ ? LIT16("true") : string16());
+ localized_strings.SetString(L"firstview",
+ first_view_ ? L"true" : std::wstring());
first_view_ = false;
#ifdef CHROME_PERSONALIZATION
- localized_strings.SetString(LIT16("p13nsrc"), Personalization::GetNewTabSource());
+ localized_strings.SetString(L"p13nsrc", Personalization::GetNewTabSource());
#endif
static const StringPiece new_tab_html(
@@ -270,19 +263,15 @@ IncognitoTabHTMLSource::IncognitoTabHTMLSource()
void IncognitoTabHTMLSource::StartDataRequest(const std::string& path,
int request_id) {
DictionaryValue localized_strings;
- localized_strings.SetString(LIT16("title"),
- WideToUTF16Hack(l10n_util::GetString(IDS_NEW_TAB_TITLE)));
- localized_strings.SetString(
- LIT16("content"),
- WideToUTF16Hack(l10n_util::GetStringF(
- IDS_NEW_TAB_OTR_MESSAGE,
- l10n_util::GetString(IDS_LEARN_MORE_INCOGNITO_URL))));
-
- localized_strings.SetString(
- LIT16("textdirection"),
- WideToUTF16Hack(
- (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
- kRTLHtmlTextDirection : kDefaultHtmlTextDirection));
+ localized_strings.SetString(L"title",
+ l10n_util::GetString(IDS_NEW_TAB_TITLE));
+ localized_strings.SetString(L"content",
+ 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);
static const StringPiece incognito_tab_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
@@ -492,14 +481,12 @@ void TemplateURLHandler::OnTemplateURLModelChanged() {
if (!urlref)
continue;
DictionaryValue* entry_value = new DictionaryValue;
- entry_value->SetString(LIT16("short_name"),
- WideToUTF16Hack(urls[i]->short_name()));
- entry_value->SetString(LIT16("keyword"),
- WideToUTF16Hack(urls[i]->keyword()));
+ entry_value->SetString(L"short_name", urls[i]->short_name());
+ entry_value->SetString(L"keyword", urls[i]->keyword());
const GURL& url = urls[i]->GetFavIconURL();
if (url.is_valid())
- entry_value->SetString(LIT16("favIconURL"), UTF8ToUTF16(url.spec()));
+ entry_value->SetString(L"favIconURL", UTF8ToWide(url.spec()));
urls_value.Append(entry_value);
}
@@ -658,7 +645,7 @@ void RecentlyClosedTabsHandler::TabRestoreServiceChanged(
(entry->type == TabRestoreService::WINDOW &&
WindowToValue(*static_cast<TabRestoreService::Window*>(entry),
value))) {
- value->SetInteger(LIT16("sessionId"), entry->id);
+ value->SetInteger(L"sessionId", entry->id);
list_value.Append(value);
added_count++;
} else {
@@ -686,7 +673,7 @@ bool RecentlyClosedTabsHandler::TabToValue(
SetURLTitleAndDirection(dictionary, current_navigation.title(),
current_navigation.url());
- dictionary->SetString(LIT16("type"), LIT16("tab"));
+ dictionary->SetString(L"type", L"tab");
return true;
}
@@ -711,8 +698,8 @@ bool RecentlyClosedTabsHandler::WindowToValue(
return false;
}
- dictionary->SetString(LIT16("type"), LIT16("window"));
- dictionary->Set(LIT16("tabs"), tab_values);
+ dictionary->SetString(L"type", L"window");
+ dictionary->Set(L"tabs", tab_values);
return true;
}