OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_DEVTOOLS_PROTOCOL_HTTP_REQUEST_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_PROTOCOL_HTTP_REQUEST_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "net/base/io_buffer.h" |
| 11 #include "net/url_request/url_request.h" |
| 12 |
| 13 namespace net { |
| 14 class URLRequestContextGetter; |
| 15 } |
| 16 |
| 17 class Profile; |
| 18 |
| 19 class ProtocolHttpRequest : public net::URLRequest::Delegate { |
| 20 public: |
| 21 typedef base::Callback<void(const std::string& error, |
| 22 const std::string& data)> Callback; |
| 23 |
| 24 ProtocolHttpRequest(Profile* profile, |
| 25 const std::string& url, |
| 26 const Callback& callback); |
| 27 |
| 28 private: |
| 29 virtual ~ProtocolHttpRequest(); |
| 30 |
| 31 void Start(); |
| 32 |
| 33 // net::URLRequest::Delegate implementation. |
| 34 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; |
| 35 virtual void OnReadCompleted(net::URLRequest* request, |
| 36 int bytes_read) OVERRIDE; |
| 37 |
| 38 void RespondOnUIThread(); |
| 39 |
| 40 net::URLRequestContextGetter* request_context_; |
| 41 GURL url_; |
| 42 Callback callback_; |
| 43 |
| 44 std::string error_; |
| 45 std::string data_; |
| 46 scoped_refptr<net::IOBuffer> io_buffer_; |
| 47 net::URLRequest* request_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(ProtocolHttpRequest); |
| 50 }; |
| 51 |
| 52 #endif // CHROME_BROWSER_DEVTOOLS_PROTOCOL_HTTP_REQUEST_H_ |
OLD | NEW |