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

Unified Diff: chrome/browser/ui/webui/history_ui.cc

Issue 22862006: "domain" item added to HistoryEntry to allow showing IDN in chrome://history/ (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 3 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/history_ui.cc
===================================================================
--- chrome/browser/ui/webui/history_ui.cc (revision 216076)
+++ chrome/browser/ui/webui/history_ui.cc (working copy)
@@ -51,6 +51,7 @@
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "net/base/escape.h"
+#include "net/base/net_util.h"
#include "sync/protocol/history_delete_directive_specifics.pb.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -276,7 +277,8 @@
BrowsingHistoryHandler::HistoryEntry::EntryType entry_type,
const GURL& url, const string16& title, base::Time time,
const std::string& client_id, bool is_search_result,
- const string16& snippet, bool blocked_visit) {
+ const string16& snippet, bool blocked_visit,
+ const std::string& accept_languages) {
this->entry_type = entry_type;
this->url = url;
this->title = title;
@@ -286,6 +288,7 @@
this->is_search_result = is_search_result;
this->snippet = snippet;
this->blocked_visit = blocked_visit;
+ this->accept_languages = accept_languages;
}
BrowsingHistoryHandler::HistoryEntry::HistoryEntry()
@@ -325,6 +328,8 @@
const ProfileSyncService* sync_service) const {
scoped_ptr<DictionaryValue> result(new DictionaryValue());
SetUrlAndTitle(result.get());
+ result->SetString("domain",
+ net::IDNToUnicode(url.host(), accept_languages));
result->SetDouble("time", time.ToJsTime());
// Pass the timestamps in a list.
@@ -741,6 +746,7 @@
history::QueryResults* results) {
DCHECK_EQ(0U, query_results_.size());
query_results_.reserve(results->size());
+ const std::string accept_languages = GetAcceptLanguages();
for (size_t i = 0; i < results->size(); ++i) {
history::URLResult const &page = (*results)[i];
@@ -754,7 +760,8 @@
std::string(),
!search_text.empty(),
page.snippet().text(),
- page.blocked_visit()));
+ page.blocked_visit(),
+ accept_languages));
}
results_info_value_.SetString("term", search_text);
@@ -784,6 +791,7 @@
const DictionaryValue* results_value) {
base::TimeDelta delta = base::TimeTicks::Now() - start_time;
UMA_HISTOGRAM_TIMES("WebHistory.ResponseTime", delta);
+ const std::string accept_languages = GetAcceptLanguages();
// If the response came in too late, do nothing.
// TODO(dubroy): Maybe show a banner, and prompt the user to reload?
@@ -851,7 +859,8 @@
client_id,
!search_text.empty(),
string16(),
- /* blocked_visit */ false));
+ /* blocked_visit */ false,
+ accept_languages));
}
}
} else if (results_value) {
@@ -954,6 +963,13 @@
web_ui()->CallJavascriptFunction("historyDeleted");
}
+std::string BrowsingHistoryHandler::GetAcceptLanguages() const {
+ Profile* profile = Profile::FromWebUI(web_ui());
+ if (!profile)
brettw 2013/09/03 20:44:31 I don't think having a null profile is possible he
yuusuke 2013/09/04 08:31:12 Done.
+ return "";
+ return profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
+}
+
////////////////////////////////////////////////////////////////////////////////
//
// HistoryUI

Powered by Google App Engine
This is Rietveld 408576698