Chromium Code Reviews| 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 |