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

Unified Diff: chrome/browser/history/url_database.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/history/url_database.cc
===================================================================
--- chrome/browser/history/url_database.cc (revision 216076)
+++ chrome/browser/history/url_database.cc (working copy)
@@ -12,6 +12,7 @@
#include "base/i18n/case_conversion.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/url_constants.h"
+#include "net/base/net_util.h"
#include "sql/statement.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
@@ -371,6 +372,16 @@
std::vector<QueryWord> query_words;
string16 url = base::i18n::ToLower(statement.ColumnString16(1));
query_parser_.ExtractQueryWords(url, &query_words);
+ GURL gurl(url);
+ if (gurl.is_valid()) {
+ // Decode punycode to match IDN.
+ // |query_words| won't be shown to user - therefore we can use empty
+ // |languages| to reduce dependency (no need to call PrefService).
+ string16 ascii = base::i18n::ToLower(base::ASCIIToUTF16(gurl.host()));
brettw 2013/09/03 20:44:31 You don't need this stuff. A GURL's host is guaran
yuusuke 2013/09/04 08:31:12 Done.
+ string16 utf = base::i18n::ToLower(net::IDNToUnicode(gurl.host(), ""));
brettw 2013/09/03 20:44:31 I don't think you need to ToLower call here. I bel
yuusuke 2013/09/04 08:31:12 Done.
+ if (ascii != utf)
+ query_parser_.ExtractQueryWords(utf, &query_words);
+ }
string16 title = base::i18n::ToLower(statement.ColumnString16(2));
query_parser_.ExtractQueryWords(title, &query_words);

Powered by Google App Engine
This is Rietveld 408576698