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 "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "net/base/escape.h" | 11 #include "net/base/escape.h" |
| 12 #include "net/base/net_errors.h" |
12 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 HistogramInternalsRequestJob::HistogramInternalsRequestJob( | 17 HistogramInternalsRequestJob::HistogramInternalsRequestJob( |
17 net::URLRequest* request) : net::URLRequestSimpleJob(request) { | 18 net::URLRequest* request) : net::URLRequestSimpleJob(request) { |
18 const std::string& spec = request->url().possibly_invalid_spec(); | 19 const std::string& spec = request->url().possibly_invalid_spec(); |
19 const url_parse::Parsed& parsed = | 20 const url_parse::Parsed& parsed = |
20 request->url().parsed_for_possibly_invalid_spec(); | 21 request->url().parsed_for_possibly_invalid_spec(); |
21 // + 1 to skip the slash at the beginning of the path. | 22 // + 1 to skip the slash at the beginning of the path. |
(...skipping 30 matching lines...) Expand all Loading... |
52 data->append("</head><body>"); | 53 data->append("</head><body>"); |
53 | 54 |
54 // Display any stats for which we sent off requests the last time. | 55 // Display any stats for which we sent off requests the last time. |
55 data->append("<p>Stats as of last page load;"); | 56 data->append("<p>Stats as of last page load;"); |
56 data->append("reload to get stats as of this page load.</p>\n"); | 57 data->append("reload to get stats as of this page load.</p>\n"); |
57 data->append("<table width=\"100%\">\n"); | 58 data->append("<table width=\"100%\">\n"); |
58 | 59 |
59 base::StatisticsRecorder::WriteHTMLGraph(unescaped_query, data); | 60 base::StatisticsRecorder::WriteHTMLGraph(unescaped_query, data); |
60 } | 61 } |
61 | 62 |
62 bool HistogramInternalsRequestJob::GetData(std::string* mime_type, | 63 int HistogramInternalsRequestJob::GetData( |
63 std::string* charset, | 64 std::string* mime_type, |
64 std::string* data) const { | 65 std::string* charset, |
| 66 std::string* data, |
| 67 const net::CompletionCallback& callback) const { |
65 mime_type->assign("text/html"); | 68 mime_type->assign("text/html"); |
66 charset->assign("UTF8"); | 69 charset->assign("UTF8"); |
67 | 70 |
68 data->clear(); | 71 data->clear(); |
69 AboutHistogram(data, path_); | 72 AboutHistogram(data, path_); |
70 return true; | 73 return net::OK; |
71 } | 74 } |
72 | 75 |
73 } // namespace content | 76 } // namespace content |
OLD | NEW |