OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/renderer/net/net_error_helper.h" | 5 #include "chrome/renderer/net/net_error_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
10 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
11 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/localized_error.h" | 18 #include "chrome/common/localized_error.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 error_html->clear(); | 193 error_html->clear(); |
193 | 194 |
194 int resource_id = IDR_NET_ERROR_HTML; | 195 int resource_id = IDR_NET_ERROR_HTML; |
195 const base::StringPiece template_html( | 196 const base::StringPiece template_html( |
196 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); | 197 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); |
197 if (template_html.empty()) { | 198 if (template_html.empty()) { |
198 NOTREACHED() << "unable to load template."; | 199 NOTREACHED() << "unable to load template."; |
199 } else { | 200 } else { |
200 base::DictionaryValue error_strings; | 201 base::DictionaryValue error_strings; |
201 LocalizedError::GetStrings( | 202 LocalizedError::GetStrings( |
202 error.reason, | 203 error.reason, error.domain.utf8(), error.unreachableURL, is_failed_post, |
203 error.domain.utf8(), | 204 error.staleCopyInCache, can_show_network_diagnostics_dialog, |
204 error.unreachableURL, | 205 offline_page_status, RenderThread::Get()->GetLocale(), |
205 is_failed_post, | |
206 error.staleCopyInCache, | |
207 can_show_network_diagnostics_dialog, | |
208 offline_page_status, | |
209 RenderThread::Get()->GetLocale(), | |
210 render_frame()->GetRenderView()->GetAcceptLanguages(), | 206 render_frame()->GetRenderView()->GetAcceptLanguages(), |
211 params.Pass(), | 207 std::move(params), &error_strings); |
212 &error_strings); | |
213 *reload_button_shown = error_strings.Get("reloadButton", nullptr); | 208 *reload_button_shown = error_strings.Get("reloadButton", nullptr); |
214 *show_saved_copy_button_shown = | 209 *show_saved_copy_button_shown = |
215 error_strings.Get("showSavedCopyButton", nullptr); | 210 error_strings.Get("showSavedCopyButton", nullptr); |
216 *show_cached_copy_button_shown = | 211 *show_cached_copy_button_shown = |
217 error_strings.Get("cacheButton", nullptr); | 212 error_strings.Get("cacheButton", nullptr); |
218 *show_offline_pages_button_shown = | 213 *show_offline_pages_button_shown = |
219 error_strings.Get("showOfflinePagesButton", nullptr); | 214 error_strings.Get("showOfflinePagesButton", nullptr); |
220 *show_offline_copy_button_shown = | 215 *show_offline_copy_button_shown = |
221 error_strings.Get("showOfflineCopyButton", nullptr); | 216 error_strings.Get("showOfflineCopyButton", nullptr); |
222 // "t" is the id of the template's root node. | 217 // "t" is the id of the template's root node. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 const std::string& data) { | 385 const std::string& data) { |
391 tracking_fetcher_.reset(); | 386 tracking_fetcher_.reset(); |
392 } | 387 } |
393 | 388 |
394 #if defined(OS_ANDROID) | 389 #if defined(OS_ANDROID) |
395 void NetErrorHelper::OnSetOfflinePageInfo( | 390 void NetErrorHelper::OnSetOfflinePageInfo( |
396 OfflinePageStatus offline_page_status) { | 391 OfflinePageStatus offline_page_status) { |
397 core_->OnSetOfflinePageInfo(offline_page_status); | 392 core_->OnSetOfflinePageInfo(offline_page_status); |
398 } | 393 } |
399 #endif // defined(OS_ANDROID) | 394 #endif // defined(OS_ANDROID) |
OLD | NEW |