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

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

Issue 105493002: Use base namespace for string16 in chrome/renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/mock_printer.h ('k') | chrome/renderer/plugins/chrome_plugin_placeholder.h » ('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 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 is_failed_post_, 221 is_failed_post_,
222 RenderThread::Get()->GetLocale(), 222 RenderThread::Get()->GetLocale(),
223 render_view()->GetAcceptLanguages(), 223 render_view()->GetAcceptLanguages(),
224 &error_strings); 224 &error_strings);
225 225
226 std::string json; 226 std::string json;
227 JSONWriter::Write(&error_strings, &json); 227 JSONWriter::Write(&error_strings, &json);
228 228
229 std::string js = "if (window.updateForDnsProbe) " 229 std::string js = "if (window.updateForDnsProbe) "
230 "updateForDnsProbe(" + json + ");"; 230 "updateForDnsProbe(" + json + ");";
231 string16 js16; 231 base::string16 js16;
232 if (!UTF8ToUTF16(js.c_str(), js.length(), &js16)) { 232 if (!UTF8ToUTF16(js.c_str(), js.length(), &js16)) {
233 NOTREACHED(); 233 NOTREACHED();
234 return; 234 return;
235 } 235 }
236 236
237 DVLOG(1) << "Updating error page with status " 237 DVLOG(1) << "Updating error page with status "
238 << chrome_common_net::DnsProbeStatusToString(last_probe_status_); 238 << chrome_common_net::DnsProbeStatusToString(last_probe_status_);
239 DVLOG(2) << "New strings: " << js; 239 DVLOG(2) << "New strings: " << js;
240 240
241 string16 frame_xpath; 241 base::string16 frame_xpath;
242 render_view()->EvaluateScript(frame_xpath, js16, 0, false); 242 render_view()->EvaluateScript(frame_xpath, js16, 0, false);
243 243
244 UMA_HISTOGRAM_ENUMERATION("DnsProbe.ErrorPageUpdateStatus", 244 UMA_HISTOGRAM_ENUMERATION("DnsProbe.ErrorPageUpdateStatus",
245 last_probe_status_, 245 last_probe_status_,
246 chrome_common_net::DNS_PROBE_MAX); 246 chrome_common_net::DNS_PROBE_MAX);
247 } 247 }
248 248
249 blink::WebURLError NetErrorHelper::GetUpdatedError() const { 249 blink::WebURLError NetErrorHelper::GetUpdatedError() const {
250 // If a probe didn't run or wasn't conclusive, restore the original error. 250 // If a probe didn't run or wasn't conclusive, restore the original error.
251 if (last_probe_status_ == chrome_common_net::DNS_PROBE_NOT_RUN || 251 if (last_probe_status_ == chrome_common_net::DNS_PROBE_NOT_RUN ||
252 last_probe_status_ == 252 last_probe_status_ ==
253 chrome_common_net::DNS_PROBE_FINISHED_INCONCLUSIVE) { 253 chrome_common_net::DNS_PROBE_FINISHED_INCONCLUSIVE) {
254 return last_error_; 254 return last_error_;
255 } 255 }
256 256
257 blink::WebURLError error; 257 blink::WebURLError error;
258 error.domain = blink::WebString::fromUTF8( 258 error.domain = blink::WebString::fromUTF8(
259 chrome_common_net::kDnsProbeErrorDomain); 259 chrome_common_net::kDnsProbeErrorDomain);
260 error.reason = last_probe_status_; 260 error.reason = last_probe_status_;
261 error.unreachableURL = last_error_.unreachableURL; 261 error.unreachableURL = last_error_.unreachableURL;
262 262
263 return error; 263 return error;
264 } 264 }
OLDNEW
« no previous file with comments | « chrome/renderer/mock_printer.h ('k') | chrome/renderer/plugins/chrome_plugin_placeholder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698