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

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

Issue 12559008: DevTools: add backend for discovering connected ADB devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Same with Fetch for fetching discovery pages. 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_ADB_CLIENT_SOCKET_H_
6 #define CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_
7
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "net/base/io_buffer.h"
11 #include "net/socket/tcp_client_socket.h"
12
13 class ADBClientSocket : public base::RefCountedThreadSafe<ADBClientSocket> {
14 public:
15 typedef base::Callback<void(const std::string& error,
16 const std::string& data)> Callback;
17
18 static void Query(int port,
19 const std::string& query,
20 const Callback& callback);
21
22 private:
23 friend class base::RefCountedThreadSafe<ADBClientSocket>;
24
25 ADBClientSocket();
26 ~ADBClientSocket();
27
28 void InnerQuery(int port, const std::string& query, const Callback& callback);
29 void OnConnectComplete(scoped_refptr<net::StringIOBuffer> request_buffer,
30 int result);
31 void OnWriteComplete(int result);
32 void OnReadComplete(scoped_refptr<net::IOBuffer> response_buffer,
33 int result);
34 bool CheckNetResultOrDie(int result);
35 void ReportSuccessAndDie();
36 void ReportInvalidResponseAndDie();
37 void ReportErrorAndDie(const std::string& error);
38 Callback callback_;
39 scoped_ptr<net::TCPClientSocket> socket_;
40 std::string response_;
41 int expected_response_length_;
42
43 DISALLOW_COPY_AND_ASSIGN(ADBClientSocket);
44 };
45
46 #endif // CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/devtools/adb_client_socket.cc » ('j') | chrome/browser/devtools/adb_client_socket.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698