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

Unified Diff: components/error_page/renderer/net_error_helper_core.cc

Issue 1639953002: Network error interstitial update - add suggestions list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments + Fix generic icon Created 4 years, 10 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: components/error_page/renderer/net_error_helper_core.cc
diff --git a/components/error_page/renderer/net_error_helper_core.cc b/components/error_page/renderer/net_error_helper_core.cc
index 847ff0d22ddeb258bc2755f9fc17f0e0720e3150..fb9626c2d8cb9454617d421d8edf9ff4d928c678 100644
--- a/components/error_page/renderer/net_error_helper_core.cc
+++ b/components/error_page/renderer/net_error_helper_core.cc
@@ -46,6 +46,9 @@ namespace {
// Other correction types uses the |kCorrectionResourceTable| array order.
const int kWebSearchQueryUMAId = 100;
+// Number of URL correction suggestions to display.
+const int kMaxUrlCorrectionsToDisplay = 1;
+
struct CorrectionTypeToResourceTable {
int resource_id;
const char* correction_type;
@@ -330,8 +333,11 @@ scoped_ptr<ErrorPageParams> CreateErrorPageParams(
// Allow reload page and web search query to be empty strings, but not
// links.
- if ((*it)->url_correction.empty())
+ if ((*it)->url_correction.empty() ||
+ (params->override_suggestions->GetSize() >=
+ kMaxUrlCorrectionsToDisplay))
continue;
mmenke 2016/02/19 20:04:33 nit: Use braces when the condition takes multiple
+
size_t correction_index;
for (correction_index = 0;
correction_index < arraysize(kCorrectionResourceTable);
@@ -341,7 +347,7 @@ scoped_ptr<ErrorPageParams> CreateErrorPageParams(
continue;
}
base::DictionaryValue* suggest = new base::DictionaryValue();
- suggest->SetString("header",
+ suggest->SetString("summary",
l10n_util::GetStringUTF16(
kCorrectionResourceTable[correction_index].resource_id));
suggest->SetString("urlCorrection", (*it)->url_correction);

Powered by Google App Engine
This is Rietveld 408576698