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

Unified Diff: chrome/common/localized_error.cc

Issue 23434002: DNS probes: several tweaks to error page updating (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Nits, plus indent neterror.html consistently. Created 7 years, 4 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
« no previous file with comments | « no previous file | chrome/renderer/resources/neterror.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/localized_error.cc
diff --git a/chrome/common/localized_error.cc b/chrome/common/localized_error.cc
index 149d81a5f814f3f68ee5ccc5c826537195f81556..893e3793b8d6dff5e663e2553a643329d75ce7bf 100644
--- a/chrome/common/localized_error.cc
+++ b/chrome/common/localized_error.cc
@@ -475,6 +475,18 @@ base::DictionaryValue* GetStandardMenuItemsText() {
return standard_menu_items_text;
}
+// Gets the icon class for a given |error_domain| and |error_code|.
+const char* GetIconClassForError(const std::string& error_domain,
+ int error_code) {
+ if ((error_code == net::ERR_INTERNET_DISCONNECTED &&
+ error_domain == net::kErrorDomain) ||
+ (error_code == chrome_common_net::DNS_PROBE_FINISHED_NO_INTERNET &&
+ error_domain == chrome_common_net::kDnsProbeErrorDomain))
+ return "icon-offline";
+
+ return "icon-generic";
+}
+
} // namespace
const char LocalizedError::kHttpErrorDomain[] = "http";
@@ -529,10 +541,7 @@ void LocalizedError::GetStrings(const WebKit::WebURLError& error,
error_strings->SetString("heading",
l10n_util::GetStringUTF16(options.heading_resource_id));
- std::string icon_class = (error_code == net::ERR_INTERNET_DISCONNECTED &&
- error_domain == net::kErrorDomain)
- ? "icon-offline"
- : "icon-generic";
+ std::string icon_class = GetIconClassForError(error_domain, error_code);
error_strings->SetString("iconClass", icon_class);
base::DictionaryValue* summary = new base::DictionaryValue;
« no previous file with comments | « no previous file | chrome/renderer/resources/neterror.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698