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

Unified 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: Offline review comments addressed 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/devtools/adb_client_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/adb_client_socket.h
diff --git a/chrome/browser/devtools/adb_client_socket.h b/chrome/browser/devtools/adb_client_socket.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc1b4f61aefd06b3b0569a9f3f70f24caf371828
--- /dev/null
+++ b/chrome/browser/devtools/adb_client_socket.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_
+#define CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_
+
+#include "base/callback.h"
+#include "net/base/io_buffer.h"
+#include "net/socket/tcp_client_socket.h"
+
+class ADBClientSocket {
+ public:
+ typedef base::Callback<void(const std::string& error,
+ const std::string& data)> Callback;
+
+ static void Query(int port,
+ const std::string& query,
+ const Callback& callback);
+
+ private:
+ ADBClientSocket();
+ ~ADBClientSocket();
+
+ void InnerQuery(int port, const std::string& query, const Callback& callback);
+ void OnConnectComplete(scoped_refptr<net::StringIOBuffer> request_buffer,
+ int result);
+ void OnWriteComplete(int result);
+ void OnReadComplete(scoped_refptr<net::IOBuffer> response_buffer,
+ int result);
+ bool CheckNetResultOrDie(int result);
+ void ReportSuccessAndDie();
+ void ReportInvalidResponseAndDie();
+ void ReportErrorAndDie(const std::string& error);
+ void Destroy();
+
+ Callback callback_;
+ scoped_ptr<net::TCPClientSocket> socket_;
+ std::string response_;
+ int expected_response_length_;
+
+ DISALLOW_COPY_AND_ASSIGN(ADBClientSocket);
+};
+
+#endif // CHROME_BROWSER_DEVTOOLS_ADB_CLIENT_SOCKET_H_
« no previous file with comments | « no previous file | chrome/browser/devtools/adb_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698