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

Side by Side Diff: components/error_page/common/localized_error.cc

Issue 1639953002: Network error interstitial update - add suggestions list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up styling 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/error_page/common/localized_error.h" 5 #include "components/error_page/common/localized_error.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 27 matching lines...) Expand all
38 #endif 38 #endif
39 39
40 namespace error_page { 40 namespace error_page {
41 41
42 namespace { 42 namespace {
43 43
44 // Some error pages have no details. 44 // Some error pages have no details.
45 const unsigned int kErrorPagesNoDetails = 0; 45 const unsigned int kErrorPagesNoDetails = 0;
46 46
47 static const char kRedirectLoopLearnMoreUrl[] = 47 static const char kRedirectLoopLearnMoreUrl[] =
48 "https://support.google.com/chrome/answer/95626"; 48 "https://support.google.com/chrome?p=rl_error";
49 static const char kWeakDHKeyLearnMoreUrl[] = 49 static const char kWeakDHKeyLearnMoreUrl[] =
50 "https://support.google.com/chrome?p=dh_error"; 50 "https://support.google.com/chrome?p=dh_error";
51 static const int kGoogleCachedCopySuggestionType = 0; 51 static const int kGoogleCachedCopySuggestionType = 0;
52 52
53 enum NAV_SUGGESTIONS { 53 enum NAV_SUGGESTIONS {
54 SUGGEST_NONE = 0, 54 SUGGEST_NONE = 0,
55 SUGGEST_RELOAD = 1 << 0, 55 SUGGEST_RELOAD = 1 << 0,
56 SUGGEST_CHECK_CONNECTION = 1 << 1, 56 SUGGEST_CHECK_CONNECTION = 1 << 1,
57 SUGGEST_DNS_CONFIG = 1 << 2, 57 SUGGEST_DNS_CONFIG = 1 << 2,
58 SUGGEST_FIREWALL_CONFIG = 1 << 3, 58 SUGGEST_FIREWALL_CONFIG = 1 << 3,
59 SUGGEST_PROXY_CONFIG = 1 << 4, 59 SUGGEST_PROXY_CONFIG = 1 << 4,
60 SUGGEST_DISABLE_EXTENSION = 1 << 5, 60 SUGGEST_DISABLE_EXTENSION = 1 << 5,
61 SUGGEST_LEARNMORE = 1 << 6, 61 SUGGEST_LEARNMORE = 1 << 6,
62 SUGGEST_VIEW_POLICIES = 1 << 7, 62 SUGGEST_VIEW_POLICIES = 1 << 7,
63 SUGGEST_CONTACT_ADMINISTRATOR = 1 << 8, 63 SUGGEST_CONTACT_ADMINISTRATOR = 1 << 8,
64 SUGGEST_UNSUPPORTED_CIPHER = 1 << 9, 64 SUGGEST_UNSUPPORTED_CIPHER = 1 << 9,
65 SUGGEST_AV_CONFIG = 1 << 10,
66 SUGGEST_OFFLINE_CHECKS = 1 << 11,
67 SUGGEST_COMPLETE_SETUP = 1 << 12,
65 }; 68 };
66 69
67 struct LocalizedErrorMap { 70 struct LocalizedErrorMap {
68 int error_code; 71 int error_code;
69 unsigned int title_resource_id; 72 unsigned int title_resource_id;
70 unsigned int heading_resource_id; 73 unsigned int heading_resource_id;
71 // Detailed summary used when the error is in the main frame. 74 // Detailed summary used when the error is in the main frame.
72 unsigned int summary_resource_id; 75 unsigned int summary_resource_id;
73 // Short one sentence description shown on mouse over when the error is in 76 // Short one sentence description shown on mouse over when the error is in
74 // a frame. 77 // a frame.
(...skipping 17 matching lines...) Expand all
92 IDS_ERRORPAGES_SUMMARY_TIMED_OUT, 95 IDS_ERRORPAGES_SUMMARY_TIMED_OUT,
93 IDS_ERRORPAGES_DETAILS_TIMED_OUT, 96 IDS_ERRORPAGES_DETAILS_TIMED_OUT,
94 SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG | 97 SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG |
95 SUGGEST_PROXY_CONFIG, 98 SUGGEST_PROXY_CONFIG,
96 }, 99 },
97 {net::ERR_CONNECTION_CLOSED, 100 {net::ERR_CONNECTION_CLOSED,
98 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 101 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
99 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, 102 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
100 IDS_ERRORPAGES_SUMMARY_CONNECTION_CLOSED, 103 IDS_ERRORPAGES_SUMMARY_CONNECTION_CLOSED,
101 IDS_ERRORPAGES_DETAILS_CONNECTION_CLOSED, 104 IDS_ERRORPAGES_DETAILS_CONNECTION_CLOSED,
102 SUGGEST_RELOAD, 105 SUGGEST_RELOAD, SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG |
106 SUGGEST_PROXY_CONFIG,
103 }, 107 },
104 {net::ERR_CONNECTION_RESET, 108 {net::ERR_CONNECTION_RESET,
105 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 109 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
106 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, 110 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
107 IDS_ERRORPAGES_SUMMARY_CONNECTION_RESET, 111 IDS_ERRORPAGES_SUMMARY_CONNECTION_RESET,
108 IDS_ERRORPAGES_DETAILS_CONNECTION_RESET, 112 IDS_ERRORPAGES_DETAILS_CONNECTION_RESET,
109 SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG | 113 SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG |
110 SUGGEST_PROXY_CONFIG, 114 SUGGEST_PROXY_CONFIG,
111 }, 115 },
112 {net::ERR_CONNECTION_REFUSED, 116 {net::ERR_CONNECTION_REFUSED,
(...skipping 24 matching lines...) Expand all
137 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, 141 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
138 IDS_ERRORPAGES_SUMMARY_ICANN_NAME_COLLISION, 142 IDS_ERRORPAGES_SUMMARY_ICANN_NAME_COLLISION,
139 IDS_ERRORPAGES_DETAILS_ICANN_NAME_COLLISION, 143 IDS_ERRORPAGES_DETAILS_ICANN_NAME_COLLISION,
140 SUGGEST_NONE, 144 SUGGEST_NONE,
141 }, 145 },
142 {net::ERR_ADDRESS_UNREACHABLE, 146 {net::ERR_ADDRESS_UNREACHABLE,
143 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 147 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
144 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, 148 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
145 IDS_ERRORPAGES_SUMMARY_ADDRESS_UNREACHABLE, 149 IDS_ERRORPAGES_SUMMARY_ADDRESS_UNREACHABLE,
146 IDS_ERRORPAGES_DETAILS_ADDRESS_UNREACHABLE, 150 IDS_ERRORPAGES_DETAILS_ADDRESS_UNREACHABLE,
147 SUGGEST_RELOAD | SUGGEST_FIREWALL_CONFIG | SUGGEST_PROXY_CONFIG, 151 SUGGEST_RELOAD,
148 }, 152 },
149 {net::ERR_NETWORK_ACCESS_DENIED, 153 {net::ERR_NETWORK_ACCESS_DENIED,
150 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 154 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
151 IDS_ERRORPAGES_HEADING_NETWORK_ACCESS_DENIED, 155 IDS_ERRORPAGES_HEADING_NETWORK_ACCESS_DENIED,
152 IDS_ERRORPAGES_SUMMARY_NETWORK_ACCESS_DENIED, 156 IDS_ERRORPAGES_SUMMARY_NETWORK_ACCESS_DENIED,
153 IDS_ERRORPAGES_DETAILS_NETWORK_ACCESS_DENIED, 157 IDS_ERRORPAGES_DETAILS_NETWORK_ACCESS_DENIED,
154 SUGGEST_FIREWALL_CONFIG, 158 SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG | SUGGEST_AV_CONFIG,
155 }, 159 },
156 {net::ERR_PROXY_CONNECTION_FAILED, 160 {net::ERR_PROXY_CONNECTION_FAILED,
157 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 161 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
158 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED, 162 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED,
159 IDS_ERRORPAGES_SUMMARY_PROXY_CONNECTION_FAILED, 163 IDS_ERRORPAGES_SUMMARY_PROXY_CONNECTION_FAILED,
160 IDS_ERRORPAGES_DETAILS_PROXY_CONNECTION_FAILED, 164 IDS_ERRORPAGES_DETAILS_PROXY_CONNECTION_FAILED,
161 SUGGEST_PROXY_CONFIG, 165 SUGGEST_PROXY_CONFIG | SUGGEST_CONTACT_ADMINISTRATOR,
162 }, 166 },
163 {net::ERR_INTERNET_DISCONNECTED, 167 {net::ERR_INTERNET_DISCONNECTED,
164 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 168 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
165 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED, 169 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED,
166 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED, 170 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED,
167 IDS_ERRORPAGES_DETAILS_INTERNET_DISCONNECTED, 171 IDS_ERRORPAGES_DETAILS_INTERNET_DISCONNECTED,
168 SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG, 172 SUGGEST_OFFLINE_CHECKS,
169 }, 173 },
170 {net::ERR_FILE_NOT_FOUND, 174 {net::ERR_FILE_NOT_FOUND,
171 IDS_ERRORPAGES_TITLE_LOAD_FAILED, 175 IDS_ERRORPAGES_TITLE_LOAD_FAILED,
172 IDS_ERRORPAGES_HEADING_FILE_NOT_FOUND, 176 IDS_ERRORPAGES_HEADING_FILE_NOT_FOUND,
173 IDS_ERRORPAGES_SUMMARY_FILE_NOT_FOUND, 177 IDS_ERRORPAGES_SUMMARY_FILE_NOT_FOUND,
174 IDS_ERRORPAGES_DETAILS_FILE_NOT_FOUND, 178 IDS_ERRORPAGES_DETAILS_FILE_NOT_FOUND,
175 SUGGEST_RELOAD, 179 SUGGEST_RELOAD,
176 }, 180 },
177 {net::ERR_CACHE_MISS, 181 {net::ERR_CACHE_MISS,
178 IDS_ERRORPAGES_TITLE_LOAD_FAILED, 182 IDS_ERRORPAGES_TITLE_LOAD_FAILED,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 IDS_ERRORPAGES_HEADING_PAGE_NOT_WORKING, 246 IDS_ERRORPAGES_HEADING_PAGE_NOT_WORKING,
243 IDS_ERRORPAGES_SUMMARY_CONNECTION_CLOSED, 247 IDS_ERRORPAGES_SUMMARY_CONNECTION_CLOSED,
244 IDS_ERRORPAGES_DETAILS_CONNECTION_CLOSED, 248 IDS_ERRORPAGES_DETAILS_CONNECTION_CLOSED,
245 SUGGEST_RELOAD, 249 SUGGEST_RELOAD,
246 }, 250 },
247 {net::ERR_SSL_PROTOCOL_ERROR, 251 {net::ERR_SSL_PROTOCOL_ERROR,
248 IDS_ERRORPAGES_TITLE_LOAD_FAILED, 252 IDS_ERRORPAGES_TITLE_LOAD_FAILED,
249 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, 253 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION,
250 IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE, 254 IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE,
251 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR, 255 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR,
252 SUGGEST_NONE, 256 SUGGEST_RELOAD,
253 }, 257 },
254 {net::ERR_BAD_SSL_CLIENT_AUTH_CERT, 258 {net::ERR_BAD_SSL_CLIENT_AUTH_CERT,
255 IDS_ERRORPAGES_TITLE_LOAD_FAILED, 259 IDS_ERRORPAGES_TITLE_LOAD_FAILED,
256 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, 260 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION,
257 IDS_ERRORPAGES_SUMMARY_BAD_SSL_CLIENT_AUTH_CERT, 261 IDS_ERRORPAGES_SUMMARY_BAD_SSL_CLIENT_AUTH_CERT,
258 IDS_ERRORPAGES_DETAILS_BAD_SSL_CLIENT_AUTH_CERT, 262 IDS_ERRORPAGES_DETAILS_BAD_SSL_CLIENT_AUTH_CERT,
259 SUGGEST_NONE, 263 SUGGEST_CONTACT_ADMINISTRATOR,
260 }, 264 },
261 {net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY, 265 {net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY,
262 IDS_ERRORPAGES_TITLE_LOAD_FAILED, 266 IDS_ERRORPAGES_TITLE_LOAD_FAILED,
263 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, 267 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION,
264 IDS_ERRORPAGES_SUMMARY_SSL_SECURITY_ERROR, 268 IDS_ERRORPAGES_SUMMARY_SSL_SECURITY_ERROR,
265 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR, 269 IDS_ERRORPAGES_DETAILS_SSL_PROTOCOL_ERROR,
266 SUGGEST_LEARNMORE, 270 SUGGEST_LEARNMORE,
267 }, 271 },
268 {net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN, 272 {net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN,
269 IDS_ERRORPAGES_TITLE_LOAD_FAILED, 273 IDS_ERRORPAGES_TITLE_LOAD_FAILED,
270 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, 274 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION,
271 IDS_CERT_ERROR_SUMMARY_PINNING_FAILURE_DETAILS, 275 IDS_CERT_ERROR_SUMMARY_PINNING_FAILURE_DETAILS,
272 IDS_CERT_ERROR_SUMMARY_PINNING_FAILURE_DESCRIPTION, 276 IDS_CERT_ERROR_SUMMARY_PINNING_FAILURE_DESCRIPTION,
273 SUGGEST_NONE, 277 SUGGEST_NONE,
274 }, 278 },
275 {net::ERR_TEMPORARILY_THROTTLED, 279 {net::ERR_TEMPORARILY_THROTTLED,
276 IDS_ERRORPAGES_TITLE_ACCESS_DENIED, 280 IDS_ERRORPAGES_TITLE_ACCESS_DENIED,
277 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, 281 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
278 IDS_ERRORPAGES_SUMMARY_NOT_AVAILABLE, 282 IDS_ERRORPAGES_SUMMARY_NOT_AVAILABLE,
279 IDS_ERRORPAGES_DETAILS_TEMPORARILY_THROTTLED, 283 IDS_ERRORPAGES_DETAILS_TEMPORARILY_THROTTLED,
280 SUGGEST_NONE, 284 SUGGEST_DISABLE_EXTENSION,
281 }, 285 },
282 {net::ERR_BLOCKED_BY_CLIENT, 286 {net::ERR_BLOCKED_BY_CLIENT,
283 IDS_ERRORPAGES_TITLE_BLOCKED, 287 IDS_ERRORPAGES_TITLE_BLOCKED,
284 IDS_ERRORPAGES_HEADING_BLOCKED, 288 IDS_ERRORPAGES_HEADING_BLOCKED,
285 IDS_ERRORPAGES_SUMMARY_BLOCKED_BY_EXTENSION, 289 IDS_ERRORPAGES_SUMMARY_BLOCKED_BY_EXTENSION,
286 IDS_ERRORPAGES_DETAILS_BLOCKED_BY_EXTENSION, 290 IDS_ERRORPAGES_DETAILS_BLOCKED_BY_EXTENSION,
287 SUGGEST_RELOAD | SUGGEST_DISABLE_EXTENSION, 291 SUGGEST_RELOAD | SUGGEST_DISABLE_EXTENSION,
288 }, 292 },
289 {net::ERR_NETWORK_CHANGED, 293 {net::ERR_NETWORK_CHANGED,
290 IDS_ERRORPAGES_TITLE_LOAD_FAILED, 294 IDS_ERRORPAGES_TITLE_LOAD_FAILED,
291 IDS_ERRORPAGES_HEADING_CONNECTION_INTERRUPTED, 295 IDS_ERRORPAGES_HEADING_CONNECTION_INTERRUPTED,
292 IDS_ERRORPAGES_SUMMARY_NETWORK_CHANGED, 296 IDS_ERRORPAGES_SUMMARY_NETWORK_CHANGED,
293 IDS_ERRORPAGES_DETAILS_NETWORK_CHANGED, 297 IDS_ERRORPAGES_DETAILS_NETWORK_CHANGED,
294 SUGGEST_RELOAD | SUGGEST_CHECK_CONNECTION, 298 SUGGEST_RELOAD,
295 }, 299 },
296 {net::ERR_BLOCKED_BY_ADMINISTRATOR, 300 {net::ERR_BLOCKED_BY_ADMINISTRATOR,
297 IDS_ERRORPAGES_TITLE_BLOCKED, 301 IDS_ERRORPAGES_TITLE_BLOCKED,
298 IDS_ERRORPAGES_HEADING_BLOCKED, 302 IDS_ERRORPAGES_HEADING_BLOCKED,
299 IDS_ERRORPAGES_SUMMARY_BLOCKED_BY_ADMINISTRATOR, 303 IDS_ERRORPAGES_SUMMARY_BLOCKED_BY_ADMINISTRATOR,
300 IDS_ERRORPAGES_DETAILS_BLOCKED_BY_ADMINISTRATOR, 304 IDS_ERRORPAGES_DETAILS_BLOCKED_BY_ADMINISTRATOR,
301 SUGGEST_VIEW_POLICIES | SUGGEST_CONTACT_ADMINISTRATOR, 305 SUGGEST_VIEW_POLICIES | SUGGEST_CONTACT_ADMINISTRATOR,
302 }, 306 },
303 {net::ERR_BLOCKED_ENROLLMENT_CHECK_PENDING, 307 {net::ERR_BLOCKED_ENROLLMENT_CHECK_PENDING,
304 IDS_ERRORPAGES_TITLE_BLOCKED, 308 IDS_ERRORPAGES_TITLE_BLOCKED,
305 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED, 309 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED,
306 IDS_ERRORPAGES_SUMMARY_BLOCKED_ENROLLMENT_CHECK_PENDING, 310 IDS_ERRORPAGES_SUMMARY_BLOCKED_ENROLLMENT_CHECK_PENDING,
307 IDS_ERRORPAGES_DETAILS_BLOCKED_ENROLLMENT_CHECK_PENDING, 311 IDS_ERRORPAGES_DETAILS_BLOCKED_ENROLLMENT_CHECK_PENDING,
308 SUGGEST_CHECK_CONNECTION, 312 SUGGEST_COMPLETE_SETUP,
309 }, 313 },
310 {net::ERR_SSL_FALLBACK_BEYOND_MINIMUM_VERSION, 314 {net::ERR_SSL_FALLBACK_BEYOND_MINIMUM_VERSION,
311 IDS_ERRORPAGES_TITLE_LOAD_FAILED, 315 IDS_ERRORPAGES_TITLE_LOAD_FAILED,
312 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, 316 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION,
313 IDS_ERRORPAGES_SUMMARY_SSL_SECURITY_ERROR, 317 IDS_ERRORPAGES_SUMMARY_INVALID_RESPONSE,
314 IDS_ERRORPAGES_DETAILS_SSL_FALLBACK_BEYOND_MINIMUM_VERSION, 318 IDS_ERRORPAGES_DETAILS_SSL_FALLBACK_BEYOND_MINIMUM_VERSION,
315 SUGGEST_NONE, 319 SUGGEST_NONE,
316 }, 320 },
317 {net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH, 321 {net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH,
318 IDS_ERRORPAGES_TITLE_LOAD_FAILED, 322 IDS_ERRORPAGES_TITLE_LOAD_FAILED,
319 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION, 323 IDS_ERRORPAGES_HEADING_INSECURE_CONNECTION,
320 IDS_ERRORPAGES_SUMMARY_SSL_VERSION_OR_CIPHER_MISMATCH, 324 IDS_ERRORPAGES_SUMMARY_SSL_VERSION_OR_CIPHER_MISMATCH,
321 IDS_ERRORPAGES_DETAILS_SSL_VERSION_OR_CIPHER_MISMATCH, 325 IDS_ERRORPAGES_DETAILS_SSL_VERSION_OR_CIPHER_MISMATCH,
322 SUGGEST_UNSUPPORTED_CIPHER, 326 SUGGEST_UNSUPPORTED_CIPHER,
323 }, 327 },
(...skipping 24 matching lines...) Expand all
348 IDS_ERRORPAGES_DETAILS_CACHE_READ_FAILURE, 352 IDS_ERRORPAGES_DETAILS_CACHE_READ_FAILURE,
349 SUGGEST_RELOAD, 353 SUGGEST_RELOAD,
350 }; 354 };
351 355
352 const LocalizedErrorMap http_error_options[] = { 356 const LocalizedErrorMap http_error_options[] = {
353 {403, 357 {403,
354 IDS_ERRORPAGES_TITLE_ACCESS_DENIED, 358 IDS_ERRORPAGES_TITLE_ACCESS_DENIED,
355 IDS_ERRORPAGES_HEADING_ACCESS_DENIED, 359 IDS_ERRORPAGES_HEADING_ACCESS_DENIED,
356 IDS_ERRORPAGES_SUMMARY_FORBIDDEN, 360 IDS_ERRORPAGES_SUMMARY_FORBIDDEN,
357 IDS_ERRORPAGES_DETAILS_FORBIDDEN, 361 IDS_ERRORPAGES_DETAILS_FORBIDDEN,
358 SUGGEST_NONE, 362 SUGGEST_RELOAD,
359 }, 363 },
360 {410, 364 {410,
361 IDS_ERRORPAGES_TITLE_NOT_FOUND, 365 IDS_ERRORPAGES_TITLE_NOT_FOUND,
362 IDS_ERRORPAGES_HEADING_NOT_FOUND, 366 IDS_ERRORPAGES_HEADING_NOT_FOUND,
363 IDS_ERRORPAGES_SUMMARY_GONE, 367 IDS_ERRORPAGES_SUMMARY_GONE,
364 IDS_ERRORPAGES_DETAILS_GONE, 368 IDS_ERRORPAGES_DETAILS_GONE,
365 SUGGEST_NONE, 369 SUGGEST_NONE,
366 }, 370 },
367 371
368 {500, 372 {500,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 }, 428 },
425 429
426 // DNS_PROBE_FINISHED_UNKNOWN is not here; NetErrorHelper will restore the 430 // DNS_PROBE_FINISHED_UNKNOWN is not here; NetErrorHelper will restore the
427 // original error, which might be one of several DNS-related errors. 431 // original error, which might be one of several DNS-related errors.
428 432
429 {error_page::DNS_PROBE_FINISHED_NO_INTERNET, 433 {error_page::DNS_PROBE_FINISHED_NO_INTERNET,
430 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 434 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
431 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED, 435 IDS_ERRORPAGES_HEADING_INTERNET_DISCONNECTED,
432 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED, 436 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED,
433 IDS_ERRORPAGES_DETAILS_INTERNET_DISCONNECTED, 437 IDS_ERRORPAGES_DETAILS_INTERNET_DISCONNECTED,
434 SUGGEST_CHECK_CONNECTION | SUGGEST_FIREWALL_CONFIG, 438 SUGGEST_OFFLINE_CHECKS,
435 }, 439 },
436 {error_page::DNS_PROBE_FINISHED_BAD_CONFIG, 440 {error_page::DNS_PROBE_FINISHED_BAD_CONFIG,
437 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 441 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
438 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE, 442 IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
439 IDS_ERRORPAGES_SUMMARY_NAME_NOT_RESOLVED, 443 IDS_ERRORPAGES_SUMMARY_NAME_NOT_RESOLVED,
440 IDS_ERRORPAGES_DETAILS_NAME_NOT_RESOLVED, 444 IDS_ERRORPAGES_DETAILS_NAME_NOT_RESOLVED,
441 SUGGEST_RELOAD | SUGGEST_DNS_CONFIG | SUGGEST_FIREWALL_CONFIG, 445 SUGGEST_RELOAD | SUGGEST_DNS_CONFIG | SUGGEST_FIREWALL_CONFIG,
442 }, 446 },
443 {error_page::DNS_PROBE_FINISHED_NXDOMAIN, 447 {error_page::DNS_PROBE_FINISHED_NXDOMAIN,
444 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 448 IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 cache_button->SetInteger("trackingId", cache_tracking_id); 536 cache_button->SetInteger("trackingId", cache_tracking_id);
533 error_strings->Set("cacheButton", cache_button.release()); 537 error_strings->Set("cacheButton", cache_button.release());
534 538
535 // Remove the item from suggestions dictionary so that it does not get 539 // Remove the item from suggestions dictionary so that it does not get
536 // displayed by the template in the details section. 540 // displayed by the template in the details section.
537 suggestions->Remove(0, nullptr); 541 suggestions->Remove(0, nullptr);
538 } 542 }
539 } 543 }
540 } 544 }
541 545
546 // Creates a list of suggestions that a user my try to resolve a particular
547 // network error.
548 void GetSummarySuggestionsList(int error_code,
549 base::DictionaryValue* error_strings,
550 int suggestions,
551 const std::string& locale) {
552 base::ListValue* suggestions_list = new base::ListValue();
553 error_strings->Set("suggestionsList", suggestions_list);
554
555 if (suggestions & SUGGEST_CHECK_CONNECTION) {
556 base::DictionaryValue* suggestion_list_item = new base::DictionaryValue;
557 suggestion_list_item->SetString("summary",
558 l10n_util::GetStringUTF16(
559 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_SUMMARY));
560 suggestions_list->Append(suggestion_list_item);
561 suggestions_list->AppendString(l10n_util::GetStringUTF16(
562 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_SUMMARY));
563 }
564
565
566 if (suggestions & SUGGEST_DNS_CONFIG &&
567 suggestions & SUGGEST_FIREWALL_CONFIG) {
568 base::DictionaryValue* suggestion_list_item = new base::DictionaryValue;
569 suggestion_list_item->SetString("summary",
570 l10n_util::GetStringUTF16(
571 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_FIREWALL_DNS_SUMMARY));
572 suggestions_list->Append(suggestion_list_item);
573 } else if (suggestions & SUGGEST_FIREWALL_CONFIG &&
574 suggestions & SUGGEST_AV_CONFIG) {
575 base::DictionaryValue* suggestion_list_item = new base::DictionaryValue;
576 suggestion_list_item->SetString("summary",
577 l10n_util::GetStringUTF16(
578 IDS_ERRORPAGES_SUGGESTION_CHECK_FIREWALL_ANTIVIRUS_SUMMARY));
579 suggestions_list->Append(suggestion_list_item);
580 } else if (suggestions & SUGGEST_PROXY_CONFIG &&
581 suggestions & SUGGEST_FIREWALL_CONFIG) {
582 base::DictionaryValue* suggestion_list_item = new base::DictionaryValue;
583 suggestion_list_item->SetString("summary",
584 l10n_util::GetStringUTF16(
585 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_FIREWALL_SUMMARY));
586 suggestions_list->Append(suggestion_list_item);
587 } else if (suggestions & SUGGEST_PROXY_CONFIG) {
588 base::DictionaryValue* suggestion_list_item = new base::DictionaryValue;
589 suggestion_list_item->SetString("summary",
590 l10n_util::GetStringUTF16(
591 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_ADDRESS_SUMMARY));
592 suggestions_list->Append(suggestion_list_item);
593 }
594
595 if (suggestions & SUGGEST_CONTACT_ADMINISTRATOR) {
596 base::DictionaryValue* suggestion_list_item = new base::DictionaryValue;
597 if (error_code == net::ERR_PROXY_CONNECTION_FAILED) {
598 // Unprefixed suggestion which occurs in a list.
599 suggestion_list_item->SetString("summary",
600 l10n_util::GetStringUTF16(
601 IDS_ERRORPAGES_SUGGESTION_CONTACT_ADMIN_SUMMARY));
602 } else {
603 // Standalone suggestion which includes 'Try' prefix to the sentence.
604 suggestion_list_item->SetString("summary",
605 l10n_util::GetStringUTF16(
606 IDS_ERRORPAGES_SUGGESTION_CONTACT_ADMIN_SUMMARY_WITH_PREFIX));
607 }
608 suggestions_list->Append(suggestion_list_item);
609 }
610
611 if (suggestions & SUGGEST_LEARNMORE) {
612 GURL learn_more_url;
613 base::string16 suggestion_string;
614 switch (error_code) {
615 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY:
616 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl);
617 suggestion_string = l10n_util::GetStringUTF16(
618 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY);
619 break;
620 case net::ERR_TOO_MANY_REDIRECTS:
621 learn_more_url = GURL(kRedirectLoopLearnMoreUrl);
622 suggestion_string = l10n_util::GetStringUTF16(
623 IDS_ERRORPAGES_SUGGESTION_CLEAR_COOKIES_SUMMARY);
624 break;
625 default:
626 break;
627 }
628
629 if (learn_more_url.is_valid()) {
630 // Add the language parameter to the URL.
631 std::string query = learn_more_url.query() + "&hl=" + locale;
632 GURL::Replacements repl;
633 repl.SetQueryStr(query);
634 learn_more_url = learn_more_url.ReplaceComponents(repl);
635
636 base::DictionaryValue* suggestion_list_item = new base::DictionaryValue;
637 suggestion_list_item->SetString("summary", suggestion_string);
638 suggestion_list_item->SetString("learnMoreUrl", learn_more_url.spec());
639 suggestions_list->Append(suggestion_list_item);
640 }
641 }
642
643 if (suggestions & SUGGEST_OFFLINE_CHECKS) {
644 #if defined(OS_ANDROID) or defined(OS_IOS)
645 base::DictionaryValue* suggestion_list_item_airplane =
646 new base::DictionaryValue;
647 suggestion_list_item_airplane->SetString("summary",
648 l10n_util::GetStringUTF16(
649 IDS_ERRORPAGES_SUGGESTION_TURN_OFF_AIRPLANE));
650 suggestions_list->Append(suggestion_list_item_airplane);
651
652 base::DictionaryValue* suggestion_list_item_data =
653 new base::DictionaryValue;
654 suggestion_list_item_data->SetString("summary",
655 l10n_util::GetStringUTF16(
656 IDS_ERRORPAGES_SUGGESTION_TURN_ON_DATA));
657 suggestions_list->Append(suggestion_list_item_data);
658
659 base::DictionaryValue* suggestion_list_item_signal =
660 new base::DictionaryValue;
661 suggestion_list_item_signal->SetString("summary",
662 l10n_util::GetStringUTF16(
663 IDS_ERRORPAGES_SUGGESTION_CHECKING_SIGNAL));
664 suggestions_list->Append(suggestion_list_item_signal);
665 #else
666 base::DictionaryValue* suggestion_list_item_cables =
667 new base::DictionaryValue;
668 suggestion_list_item_cables->SetString("summary",
669 l10n_util::GetStringUTF16(
670 IDS_ERRORPAGES_SUGGESTION_CHECK_CABLES_SUMMARY));
671 suggestions_list->Append(suggestion_list_item_cables);
672
673 base::DictionaryValue* suggestion_list_item_hardware =
674 new base::DictionaryValue;
675 suggestion_list_item_hardware->SetString("summary",
676 l10n_util::GetStringUTF16(
677 IDS_ERRORPAGES_SUGGESTION_RESET_HARDWARE_SUMMARY));
678 suggestions_list->Append(suggestion_list_item_hardware);
679
680 base::DictionaryValue* suggestion_list_item_wifi =
681 new base::DictionaryValue;
682 suggestion_list_item_wifi->SetString("summary",
683 l10n_util::GetStringUTF16(
684 IDS_ERRORPAGES_SUGGESTION_CHECK_WIFI_SUMMARY));
685 suggestions_list->Append(suggestion_list_item_wifi);
686 #endif
687 }
688
689 if (suggestions & SUGGEST_COMPLETE_SETUP) {
690 base::DictionaryValue* suggestion_diagnose = new base::DictionaryValue;
691 suggestion_diagnose->SetString("summary",
692 l10n_util::GetStringUTF16(
693 IDS_ERRORPAGES_SUGGESTION_DIAGNOSE_CONNECTION_SUMMARY));
694 suggestions_list->Append(suggestion_diagnose);
695
696 base::DictionaryValue* suggestion_complete_setup =
697 new base::DictionaryValue;
698 suggestion_complete_setup->SetString("summary",
699 l10n_util::GetStringUTF16(
700 IDS_ERRORPAGES_SUGGESTION_COMPLETE_SETUP_SUMMARY));
701 suggestions_list->Append(suggestion_complete_setup);
702 }
703
704 if (suggestions & SUGGEST_DISABLE_EXTENSION) {
705 base::DictionaryValue* suggest_disable_extension =
706 new base::DictionaryValue;
707 suggest_disable_extension->SetString("summary",
708 l10n_util::GetStringUTF16(
709 IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION_SUMMARY));
710 suggestions_list->Append(suggest_disable_extension);
711 }
712
713 // Only add a explicit reload suggestion if there are other suggestions.
714 // Otherwise we rely on the reload button being used.
715 if (suggestions_list->GetSize() > 0 && suggestions & SUGGEST_RELOAD) {
716 base::DictionaryValue* suggestion_list_item = new base::DictionaryValue;
717 suggestion_list_item->SetString("summary",
718 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_RELOAD_SUMMARY));
719 // Add as first item.
720 suggestions_list->Insert(0, suggestion_list_item);
721 }
722
723 // Add list prefix header if there are suggestions except
724 // for the 'Incomplete enrollment setup'.
725 if (suggestions_list->GetSize() > 1 &&
726 !(suggestions & SUGGEST_COMPLETE_SETUP)) {
727 error_strings->SetString("suggestionListHeader",
728 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LIST_HEADER));
729 }
730 }
731
542 } // namespace 732 } // namespace
543 733
544 const char LocalizedError::kHttpErrorDomain[] = "http"; 734 const char LocalizedError::kHttpErrorDomain[] = "http";
545 735
546 void LocalizedError::GetStrings(int error_code, 736 void LocalizedError::GetStrings(int error_code,
547 const std::string& error_domain, 737 const std::string& error_domain,
548 const GURL& failed_url, 738 const GURL& failed_url,
549 bool is_post, 739 bool is_post,
550 bool stale_copy_in_cache, 740 bool stale_copy_in_cache,
551 bool can_show_network_diagnostics_dialog, 741 bool can_show_network_diagnostics_dialog,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 base::string16 error_string; 834 base::string16 error_string;
645 if (error_domain == net::kErrorDomain) { 835 if (error_domain == net::kErrorDomain) {
646 // Non-internationalized error string, for debugging Chrome itself. 836 // Non-internationalized error string, for debugging Chrome itself.
647 error_string = base::ASCIIToUTF16(net::ErrorToShortString(error_code)); 837 error_string = base::ASCIIToUTF16(net::ErrorToShortString(error_code));
648 } else if (error_domain == error_page::kDnsProbeErrorDomain) { 838 } else if (error_domain == error_page::kDnsProbeErrorDomain) {
649 std::string ascii_error_string = 839 std::string ascii_error_string =
650 error_page::DnsProbeStatusToString(error_code); 840 error_page::DnsProbeStatusToString(error_code);
651 error_string = base::ASCIIToUTF16(ascii_error_string); 841 error_string = base::ASCIIToUTF16(ascii_error_string);
652 } else { 842 } else {
653 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain); 843 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain);
654 error_string = base::IntToString16(error_code); 844 error_string = base::ASCIIToUTF16(net::HttpErrorCodeToString(error_code));
655 } 845 }
656 error_strings->SetString("errorCode", error_string); 846 error_strings->SetString("errorCode", error_string);
657 847
658 // Platform specific information for diagnosing network issues on OSX and 848 // Platform specific information for diagnosing network issues on OSX and
659 // Windows. 849 // Windows.
660 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) 850 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN)
661 if (error_domain == net::kErrorDomain && 851 if (error_domain == net::kErrorDomain &&
662 error_code == net::ERR_INTERNET_DISCONNECTED) { 852 error_code == net::ERR_INTERNET_DISCONNECTED) {
663 int platform_string_id = 853 int platform_string_id =
664 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM; 854 IDS_ERRORPAGES_SUMMARY_INTERNET_DISCONNECTED_PLATFORM;
(...skipping 21 matching lines...) Expand all
686 // If no parameters were provided, use the defaults. 876 // If no parameters were provided, use the defaults.
687 if (!params) { 877 if (!params) {
688 params.reset(new error_page::ErrorPageParams()); 878 params.reset(new error_page::ErrorPageParams());
689 params->suggest_reload = !!(options.suggestions & SUGGEST_RELOAD); 879 params->suggest_reload = !!(options.suggestions & SUGGEST_RELOAD);
690 } 880 }
691 881
692 base::ListValue* suggestions = NULL; 882 base::ListValue* suggestions = NULL;
693 bool use_default_suggestions = true; 883 bool use_default_suggestions = true;
694 if (!params->override_suggestions) { 884 if (!params->override_suggestions) {
695 suggestions = new base::ListValue(); 885 suggestions = new base::ListValue();
886 // Detailed suggestion information.
887 error_strings->Set("suggestions", suggestions);
mmenke 2016/02/12 17:25:54 Erm...Using "suggestions" in some cases and "sugge
edwardjung 2016/02/15 15:53:49 Not quite, override suggestions appear above the f
696 } else { 888 } else {
697 suggestions = params->override_suggestions.release(); 889 suggestions = params->override_suggestions.release();
698 use_default_suggestions = false; 890 use_default_suggestions = false;
699 AddGoogleCachedCopyButton(suggestions, error_strings); 891 AddGoogleCachedCopyButton(suggestions, error_strings);
892 error_strings->Set("suggestionsList", suggestions);
700 } 893 }
701 error_strings->Set("suggestions", suggestions);
702 894
703 if (params->search_url.is_valid()) { 895 if (params->search_url.is_valid()) {
704 error_strings->SetString("searchHeader", 896 base::DictionaryValue* suggestion_search = new base::DictionaryValue;
mmenke 2016/02/12 17:25:54 search_suggestion?
edwardjung 2016/02/15 15:53:49 Done.
705 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_GOOGLE_SEARCH)); 897 suggestion_search->SetString("summary",
706 error_strings->SetString("searchUrl", params->search_url.spec()); 898 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_GOOGLE_SEARCH));
707 error_strings->SetString("searchTerms", params->search_terms); 899 suggestion_search->SetString("searchUrl", params->search_url.spec() +
708 error_strings->SetInteger("searchTrackingId", params->search_tracking_id); 900 params->search_terms);
901 suggestion_search->SetString("searchTerms", params->search_terms);
902 suggestion_search->SetInteger("trackingId",
903 params->search_tracking_id);
904 suggestions->Append(suggestion_search);
709 } 905 }
710 906
711 // Add the reload suggestion, if needed. 907 // Add the reload suggestion, if needed.
712 if (params->suggest_reload) { 908 if (params->suggest_reload) {
713 if (!is_post) { 909 if (!is_post) {
714 base::DictionaryValue* reload_button = new base::DictionaryValue; 910 base::DictionaryValue* reload_button = new base::DictionaryValue;
715 reload_button->SetString( 911 reload_button->SetString(
716 "msg", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD)); 912 "msg", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD));
717 reload_button->SetString("reloadUrl", failed_url.spec()); 913 reload_button->SetString("reloadUrl", failed_url.spec());
718 error_strings->Set("reloadButton", reload_button); 914 error_strings->Set("reloadButton", reload_button);
(...skipping 12 matching lines...) Expand all
731 IDS_ERRORPAGES_SUGGESTION_RELOAD_REPOST_BODY)); 927 IDS_ERRORPAGES_SUGGESTION_RELOAD_REPOST_BODY));
732 // Add at the front, so it appears before other suggestions, in the case 928 // Add at the front, so it appears before other suggestions, in the case
733 // suggestions are being overridden by |params|. 929 // suggestions are being overridden by |params|.
734 suggestions->Insert(0, suggest_reload_repost); 930 suggestions->Insert(0, suggest_reload_repost);
735 } 931 }
736 } 932 }
737 933
738 // If not using the default suggestions, nothing else to do. 934 // If not using the default suggestions, nothing else to do.
739 if (!use_default_suggestions) 935 if (!use_default_suggestions)
740 return; 936 return;
937 else
938 GetSummarySuggestionsList(error_code, error_strings,
939 options.suggestions, locale);
mmenke 2016/02/12 17:25:54 This code is just too confusing. I'm really havin
mmenke 2016/02/12 17:25:54 Use braces
edwardjung 2016/02/15 15:53:49 Done.
edwardjung 2016/02/15 15:53:49 Valid point. I've moved the suggestions details in
741 940
742 const std::string& show_saved_copy_value = 941 const std::string& show_saved_copy_value =
743 command_line->GetSwitchValueASCII(error_page::switches::kShowSavedCopy); 942 command_line->GetSwitchValueASCII(error_page::switches::kShowSavedCopy);
744 bool show_saved_copy_primary = 943 bool show_saved_copy_primary =
745 (show_saved_copy_value == 944 (show_saved_copy_value ==
746 error_page::switches::kEnableShowSavedCopyPrimary); 945 error_page::switches::kEnableShowSavedCopyPrimary);
747 bool show_saved_copy_secondary = 946 bool show_saved_copy_secondary =
748 (show_saved_copy_value == 947 (show_saved_copy_value ==
749 error_page::switches::kEnableShowSavedCopySecondary); 948 error_page::switches::kEnableShowSavedCopySecondary);
750 bool show_saved_copy_visible = 949 bool show_saved_copy_visible =
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 suggest_proxy_config->SetString("body", 1055 suggest_proxy_config->SetString("body",
857 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_BODY, 1056 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_BODY,
858 l10n_util::GetStringUTF16( 1057 l10n_util::GetStringUTF16(
859 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM))); 1058 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM)));
860 suggest_proxy_config->SetString("proxyTitle", 1059 suggest_proxy_config->SetString("proxyTitle",
861 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); 1060 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON));
862 1061
863 suggestions->Append(suggest_proxy_config); 1062 suggestions->Append(suggest_proxy_config);
864 } 1063 }
865 1064
866 if (options.suggestions & SUGGEST_DISABLE_EXTENSION) {
867 base::DictionaryValue* suggest_disable_extension =
868 new base::DictionaryValue;
869 // There's only a header for this suggestion.
870 suggest_disable_extension->SetString("header",
871 l10n_util::GetStringUTF16(
872 IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION_HEADER));
873 suggestions->Append(suggest_disable_extension);
874 }
875
876 if (options.suggestions & SUGGEST_VIEW_POLICIES) { 1065 if (options.suggestions & SUGGEST_VIEW_POLICIES) {
877 base::DictionaryValue* suggest_view_policies = new base::DictionaryValue; 1066 base::DictionaryValue* suggest_view_policies = new base::DictionaryValue;
878 suggest_view_policies->SetString( 1067 suggest_view_policies->SetString(
879 "header", 1068 "header",
880 l10n_util::GetStringUTF16( 1069 l10n_util::GetStringUTF16(
881 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_HEADER)); 1070 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_HEADER));
882 suggest_view_policies->SetString( 1071 suggest_view_policies->SetString(
883 "body", 1072 "body",
884 l10n_util::GetStringUTF16( 1073 l10n_util::GetStringUTF16(
885 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_BODY)); 1074 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_BODY));
886 suggestions->Append(suggest_view_policies); 1075 suggestions->Append(suggest_view_policies);
887 } 1076 }
888 1077
889 if (options.suggestions & SUGGEST_CONTACT_ADMINISTRATOR) {
890 base::DictionaryValue* suggest_contant_administrator =
891 new base::DictionaryValue;
892 suggest_contant_administrator->SetString(
893 "body",
894 l10n_util::GetStringUTF16(
895 IDS_ERRORPAGES_SUGGESTION_CONTACT_ADMINISTRATOR_BODY));
896 suggestions->Append(suggest_contant_administrator);
897 }
898
899 if (options.suggestions & SUGGEST_LEARNMORE) {
900 GURL learn_more_url;
901 switch (options.error_code) {
902 case net::ERR_TOO_MANY_REDIRECTS:
903 learn_more_url = GURL(kRedirectLoopLearnMoreUrl);
904 break;
905 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY:
906 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl);
907 break;
908 default:
909 break;
910 }
911
912 if (learn_more_url.is_valid()) {
913 // Add the language parameter to the URL.
914 std::string query = learn_more_url.query() + "&hl=" + locale;
915 GURL::Replacements repl;
916 repl.SetQueryStr(query);
917 learn_more_url = learn_more_url.ReplaceComponents(repl);
918
919 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue;
920 // There's only a body for this suggestion.
921 suggest_learn_more->SetString("body",
922 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY));
923 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec());
924 suggestions->Append(suggest_learn_more);
925 }
926 }
927
928 if (options.suggestions & SUGGEST_UNSUPPORTED_CIPHER) { 1078 if (options.suggestions & SUGGEST_UNSUPPORTED_CIPHER) {
929 base::DictionaryValue* suggest_unsupported_cipher = 1079 base::DictionaryValue* suggest_unsupported_cipher =
930 new base::DictionaryValue; 1080 new base::DictionaryValue;
931 suggest_unsupported_cipher->SetString( 1081 suggest_unsupported_cipher->SetString(
932 "body", 1082 "body",
933 l10n_util::GetStringUTF16( 1083 l10n_util::GetStringUTF16(
934 IDS_ERRORPAGES_SUGGESTION_UNSUPPORTED_CIPHER)); 1084 IDS_ERRORPAGES_SUGGESTION_UNSUPPORTED_CIPHER));
935 suggestions->Append(suggest_unsupported_cipher); 1085 suggestions->Append(suggest_unsupported_cipher);
936 } 1086 }
937 } 1087 }
(...skipping 11 matching lines...) Expand all
949 1099
950 bool LocalizedError::HasStrings(const std::string& error_domain, 1100 bool LocalizedError::HasStrings(const std::string& error_domain,
951 int error_code) { 1101 int error_code) {
952 // Whether or not the there are strings for an error does not depend on 1102 // Whether or not the there are strings for an error does not depend on
953 // whether or not the page was be generated by a POST, so just claim it was 1103 // whether or not the page was be generated by a POST, so just claim it was
954 // not. 1104 // not.
955 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != NULL; 1105 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != NULL;
956 } 1106 }
957 1107
958 } // namespace error_page 1108 } // namespace error_page
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698