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

Side by Side Diff: chrome/renderer/net/net_error_helper.cc

Issue 1841653003: Drop |languages| from {Format,Elide}Url* and IDNToUnicode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo in elide_url.cc Created 4 years, 8 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
« no previous file with comments | « chrome/common/net/x509_certificate_model.cc ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 const base::StringPiece template_html( 195 const base::StringPiece template_html(
196 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); 196 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id));
197 if (template_html.empty()) { 197 if (template_html.empty()) {
198 NOTREACHED() << "unable to load template."; 198 NOTREACHED() << "unable to load template.";
199 } else { 199 } else {
200 base::DictionaryValue error_strings; 200 base::DictionaryValue error_strings;
201 LocalizedError::GetStrings( 201 LocalizedError::GetStrings(
202 error.reason, error.domain.utf8(), error.unreachableURL, is_failed_post, 202 error.reason, error.domain.utf8(), error.unreachableURL, is_failed_post,
203 error.staleCopyInCache, can_show_network_diagnostics_dialog, 203 error.staleCopyInCache, can_show_network_diagnostics_dialog,
204 has_offline_pages, RenderThread::Get()->GetLocale(), 204 has_offline_pages, RenderThread::Get()->GetLocale(),
205 render_frame()->GetRenderView()->GetAcceptLanguages(),
206 std::move(params), &error_strings); 205 std::move(params), &error_strings);
207 *reload_button_shown = error_strings.Get("reloadButton", nullptr); 206 *reload_button_shown = error_strings.Get("reloadButton", nullptr);
208 *show_saved_copy_button_shown = 207 *show_saved_copy_button_shown =
209 error_strings.Get("showSavedCopyButton", nullptr); 208 error_strings.Get("showSavedCopyButton", nullptr);
210 *show_cached_copy_button_shown = 209 *show_cached_copy_button_shown =
211 error_strings.Get("cacheButton", nullptr); 210 error_strings.Get("cacheButton", nullptr);
212 *show_offline_pages_button_shown = 211 *show_offline_pages_button_shown =
213 error_strings.Get("showOfflinePagesButton", nullptr); 212 error_strings.Get("showOfflinePagesButton", nullptr);
214 // "t" is the id of the template's root node. 213 // "t" is the id of the template's root node.
215 *error_html = webui::GetTemplatesHtml(template_html, &error_strings, "t"); 214 *error_html = webui::GetTemplatesHtml(template_html, &error_strings, "t");
(...skipping 18 matching lines...) Expand all
234 base::DictionaryValue error_strings; 233 base::DictionaryValue error_strings;
235 LocalizedError::GetStrings( 234 LocalizedError::GetStrings(
236 error.reason, 235 error.reason,
237 error.domain.utf8(), 236 error.domain.utf8(),
238 error.unreachableURL, 237 error.unreachableURL,
239 is_failed_post, 238 is_failed_post,
240 error.staleCopyInCache, 239 error.staleCopyInCache,
241 can_show_network_diagnostics_dialog, 240 can_show_network_diagnostics_dialog,
242 has_offline_pages, 241 has_offline_pages,
243 RenderThread::Get()->GetLocale(), 242 RenderThread::Get()->GetLocale(),
244 render_frame()->GetRenderView()->GetAcceptLanguages(),
245 scoped_ptr<ErrorPageParams>(), 243 scoped_ptr<ErrorPageParams>(),
246 &error_strings); 244 &error_strings);
247 245
248 std::string json; 246 std::string json;
249 JSONWriter::Write(error_strings, &json); 247 JSONWriter::Write(error_strings, &json);
250 248
251 std::string js = "if (window.updateForDnsProbe) " 249 std::string js = "if (window.updateForDnsProbe) "
252 "updateForDnsProbe(" + json + ");"; 250 "updateForDnsProbe(" + json + ");";
253 base::string16 js16; 251 base::string16 js16;
254 if (!base::UTF8ToUTF16(js.c_str(), js.length(), &js16)) { 252 if (!base::UTF8ToUTF16(js.c_str(), js.length(), &js16)) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 357 }
360 358
361 void NetErrorHelper::OnNavigationCorrectionsFetched( 359 void NetErrorHelper::OnNavigationCorrectionsFetched(
362 const blink::WebURLResponse& response, 360 const blink::WebURLResponse& response,
363 const std::string& data) { 361 const std::string& data) {
364 // The fetcher may only be deleted after |data| is passed to |core_|. Move 362 // The fetcher may only be deleted after |data| is passed to |core_|. Move
365 // it to a temporary to prevent any potential re-entrancy issues. 363 // it to a temporary to prevent any potential re-entrancy issues.
366 scoped_ptr<content::ResourceFetcher> fetcher( 364 scoped_ptr<content::ResourceFetcher> fetcher(
367 correction_fetcher_.release()); 365 correction_fetcher_.release());
368 bool success = (!response.isNull() && response.httpStatusCode() == 200); 366 bool success = (!response.isNull() && response.httpStatusCode() == 200);
369 core_->OnNavigationCorrectionsFetched( 367 core_->OnNavigationCorrectionsFetched(success ? data : "",
370 success ? data : "", 368 base::i18n::IsRTL());
371 render_frame()->GetRenderView()->GetAcceptLanguages(),
372 base::i18n::IsRTL());
373 } 369 }
374 370
375 void NetErrorHelper::OnTrackingRequestComplete( 371 void NetErrorHelper::OnTrackingRequestComplete(
376 const blink::WebURLResponse& response, 372 const blink::WebURLResponse& response,
377 const std::string& data) { 373 const std::string& data) {
378 tracking_fetcher_.reset(); 374 tracking_fetcher_.reset();
379 } 375 }
380 376
381 #if defined(OS_ANDROID) 377 #if defined(OS_ANDROID)
382 void NetErrorHelper::OnSetHasOfflinePages(bool has_offline_pages) { 378 void NetErrorHelper::OnSetHasOfflinePages(bool has_offline_pages) {
383 core_->OnSetHasOfflinePages(has_offline_pages); 379 core_->OnSetHasOfflinePages(has_offline_pages);
384 } 380 }
385 #endif // defined(OS_ANDROID) 381 #endif // defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « chrome/common/net/x509_certificate_model.cc ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698