Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: chrome/browser/devtools/protocol_http_request.h

Issue 12559008: DevTools: add backend for discovering connected ADB devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extracted protocol http request helper. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 void Start();
30
31 // net::URLRequest::Delegate implementation.
32 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
33 virtual void OnReadCompleted(net::URLRequest* request,
34 int bytes_read) OVERRIDE;
35
36 void RespondOnUIThread();
37
38 net::URLRequestContextGetter* request_context_;
39 GURL url_;
40 Callback callback_;
41
42 std::string error_;
43 std::string data_;
44 scoped_refptr<net::IOBuffer> io_buffer_;
45 net::URLRequest* request_;
46
47 DISALLOW_COPY_AND_ASSIGN(ProtocolHttpRequest);
48 };
49
50 #endif // CHROME_BROWSER_DEVTOOLS_PROTOCOL_HTTP_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698