| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 NET_URL_REQUEST_URL_REQUEST_VIEW_NET_INTERNALS_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_VIEW_NET_INTERNALS_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_VIEW_NET_INTERNALS_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_VIEW_NET_INTERNALS_JOB_H_ |
| 7 | 7 |
| 8 #include "net/url_request/url_request.h" | 8 #include "net/url_request/url_request.h" |
| 9 #include "net/url_request/url_request_simple_job.h" | 9 #include "net/url_request/url_request_simple_job.h" |
| 10 | 10 |
| 11 // A job subclass that implements a protocol to inspect the internal | 11 // A job subclass that implements a protocol to inspect the internal |
| 12 // state of the network stack. The exact format of the URLs is left up to | 12 // state of the network stack. The exact format of the URLs is left up to |
| 13 // the caller, and is described by a URLFormat instance passed into | 13 // the caller, and is described by a URLFormat instance passed into |
| 14 // the constructor. | 14 // the constructor. |
| 15 class URLRequestViewNetInternalsJob : public URLRequestSimpleJob { | 15 class URLRequestViewNetInternalsJob : public URLRequestSimpleJob { |
| 16 public: | 16 public: |
| 17 class URLFormat; | 17 class URLFormat; |
| 18 | 18 |
| 19 // |url_format| must remain valid for the duration |this|'s lifespan. | 19 // |url_format| must remain valid for the duration |this|'s lifespan. |
| 20 URLRequestViewNetInternalsJob(URLRequest* request, | 20 URLRequestViewNetInternalsJob(URLRequest* request, |
| 21 URLFormat* url_format) | 21 URLFormat* url_format) |
| 22 : URLRequestSimpleJob(request), url_format_(url_format) {} | 22 : URLRequestSimpleJob(request), url_format_(url_format) {} |
| 23 | 23 |
| 24 // override from URLRequestSimpleJob | 24 // override from URLRequestSimpleJob |
| 25 virtual bool GetData(std::string* mime_type, | 25 virtual bool GetData(std::string* mime_type, |
| 26 std::string* charset, | 26 std::string* charset, |
| 27 std::string* data) const; | 27 std::string* data) const; |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 ~URLRequestViewNetInternalsJob() {} |
| 31 |
| 30 URLFormat* url_format_; | 32 URLFormat* url_format_; |
| 31 }; | 33 }; |
| 32 | 34 |
| 33 // Describes how to pack/unpack the filter string (details) | 35 // Describes how to pack/unpack the filter string (details) |
| 34 // from a URL. | 36 // from a URL. |
| 35 class URLRequestViewNetInternalsJob::URLFormat { | 37 class URLRequestViewNetInternalsJob::URLFormat { |
| 36 public: | 38 public: |
| 37 virtual ~URLFormat() {} | 39 virtual ~URLFormat() {} |
| 38 virtual std::string GetDetails(const GURL& url) = 0; | 40 virtual std::string GetDetails(const GURL& url) = 0; |
| 39 virtual GURL MakeURL(const std::string& details) = 0; | 41 virtual GURL MakeURL(const std::string& details) = 0; |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 #endif // NET_URL_REQUEST_URL_REQUEST_VIEW_NET_INTERNALS_JOB_H_ | 44 #endif // NET_URL_REQUEST_URL_REQUEST_VIEW_NET_INTERNALS_JOB_H_ |
| OLD | NEW |