| OLD | NEW |
| 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 "content/browser/histogram_internals_request_job.h" | 5 #include "content/browser/histogram_internals_request_job.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/metrics/statistics_recorder.h" | 8 #include "base/metrics/statistics_recorder.h" |
| 9 #include "content/browser/histogram_synchronizer.h" | 9 #include "content/browser/histogram_synchronizer.h" |
| 10 #include "net/base/escape.h" | 10 #include "net/base/escape.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/url_request/url_request.h" | 12 #include "net/url_request/url_request.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 HistogramInternalsRequestJob::HistogramInternalsRequestJob( | 17 HistogramInternalsRequestJob::HistogramInternalsRequestJob( |
| 18 net::URLRequest* request, net::NetworkDelegate* network_delegate) | 18 net::URLRequest* request, net::NetworkDelegate* network_delegate) |
| 19 : net::URLRequestSimpleJob(request, network_delegate) { | 19 : net::URLRequestSimpleJob(request, network_delegate) { |
| 20 const std::string& spec = request->url().possibly_invalid_spec(); | 20 const std::string& spec = request->url().possibly_invalid_spec(); |
| 21 const url_parse::Parsed& parsed = | 21 const url::Parsed& parsed = request->url().parsed_for_possibly_invalid_spec(); |
| 22 request->url().parsed_for_possibly_invalid_spec(); | |
| 23 // + 1 to skip the slash at the beginning of the path. | 22 // + 1 to skip the slash at the beginning of the path. |
| 24 int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false) + 1; | 23 int offset = parsed.CountCharactersBefore(url::Parsed::PATH, false) + 1; |
| 25 | 24 |
| 26 if (offset < static_cast<int>(spec.size())) | 25 if (offset < static_cast<int>(spec.size())) |
| 27 path_.assign(spec.substr(offset)); | 26 path_.assign(spec.substr(offset)); |
| 28 } | 27 } |
| 29 | 28 |
| 30 void AboutHistogram(std::string* data, const std::string& path) { | 29 void AboutHistogram(std::string* data, const std::string& path) { |
| 31 HistogramSynchronizer::FetchHistograms(); | 30 HistogramSynchronizer::FetchHistograms(); |
| 32 | 31 |
| 33 std::string unescaped_query; | 32 std::string unescaped_query; |
| 34 std::string unescaped_title("About Histograms"); | 33 std::string unescaped_title("About Histograms"); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 62 const net::CompletionCallback& callback) const { | 61 const net::CompletionCallback& callback) const { |
| 63 mime_type->assign("text/html"); | 62 mime_type->assign("text/html"); |
| 64 charset->assign("UTF8"); | 63 charset->assign("UTF8"); |
| 65 | 64 |
| 66 data->clear(); | 65 data->clear(); |
| 67 AboutHistogram(data, path_); | 66 AboutHistogram(data, path_); |
| 68 return net::OK; | 67 return net::OK; |
| 69 } | 68 } |
| 70 | 69 |
| 71 } // namespace content | 70 } // namespace content |
| OLD | NEW |