| 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 #ifndef CONTENT_BROWSER_HISTOGRAM_INTERNALS_REQUEST_JOB_H_ | 5 #ifndef CONTENT_BROWSER_HISTOGRAM_INTERNALS_REQUEST_JOB_H_ |
| 6 #define CONTENT_BROWSER_HISTOGRAM_INTERNALS_REQUEST_JOB_H_ | 6 #define CONTENT_BROWSER_HISTOGRAM_INTERNALS_REQUEST_JOB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "net/url_request/url_request_simple_job.h" | 12 #include "net/url_request/url_request_simple_job.h" |
| 13 #include "url/gurl.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 class HistogramInternalsRequestJob : public net::URLRequestSimpleJob { | 17 class HistogramInternalsRequestJob : public net::URLRequestSimpleJob { |
| 17 public: | 18 public: |
| 18 HistogramInternalsRequestJob(net::URLRequest* request, | 19 HistogramInternalsRequestJob(net::URLRequest* request, |
| 19 net::NetworkDelegate* network_delegate); | 20 net::NetworkDelegate* network_delegate); |
| 20 | 21 |
| 21 // net::URLRequestSimpleJob: | 22 // net::URLRequestSimpleJob: |
| 22 void Start() override; | 23 void Start() override; |
| 23 int GetData(std::string* mime_type, | 24 int GetData(std::string* mime_type, |
| 24 std::string* charset, | 25 std::string* charset, |
| 25 std::string* data, | 26 std::string* data, |
| 26 const net::CompletionCallback& callback) const override; | 27 const net::CompletionCallback& callback) const override; |
| 27 | 28 |
| 29 // Generates the HTML for chrome://histograms. If |url| has a path, it's used |
| 30 // to display a single histogram. |
| 31 // base::StatisticsRecorder::ImportProvidedHistograms must have been called |
| 32 // on the UI thread first. |
| 33 static std::string GenerateHTML(const GURL& url); |
| 34 |
| 28 private: | 35 private: |
| 29 ~HistogramInternalsRequestJob() override; | 36 ~HistogramInternalsRequestJob() override; |
| 30 | 37 |
| 31 // Starts the real URL request. | 38 // Starts the real URL request. |
| 32 void StartUrlRequest(); | 39 void StartUrlRequest(); |
| 33 | 40 |
| 34 // The string to select histograms which have |path_| as a substring. | 41 // The URL that was requested, which might have a path component to a specific |
| 35 std::string path_; | 42 // histogram. |
| 43 GURL url_; |
| 36 | 44 |
| 37 base::WeakPtrFactory<HistogramInternalsRequestJob> weak_factory_; | 45 base::WeakPtrFactory<HistogramInternalsRequestJob> weak_factory_; |
| 38 | 46 |
| 39 DISALLOW_IMPLICIT_CONSTRUCTORS(HistogramInternalsRequestJob); | 47 DISALLOW_IMPLICIT_CONSTRUCTORS(HistogramInternalsRequestJob); |
| 40 }; | 48 }; |
| 41 | 49 |
| 42 } // namespace content | 50 } // namespace content |
| 43 | 51 |
| 44 #endif // CONTENT_BROWSER_HISTOGRAM_INTERNALS_REQUEST_JOB_H_ | 52 #endif // CONTENT_BROWSER_HISTOGRAM_INTERNALS_REQUEST_JOB_H_ |
| OLD | NEW |