| Index: chrome/browser/devtools/devtools_adb_bridge.h
|
| diff --git a/chrome/browser/devtools/devtools_adb_bridge.h b/chrome/browser/devtools/devtools_adb_bridge.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9f169d7fcf4abf3e3ef1f1b1981ec1f3f579a457
|
| --- /dev/null
|
| +++ b/chrome/browser/devtools/devtools_adb_bridge.h
|
| @@ -0,0 +1,69 @@
|
| +// 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_DEVTOOLS_ADB_BRIDGE_H_
|
| +#define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| +#include "net/url_request/url_request.h"
|
| +
|
| +namespace base {
|
| +class Thread;
|
| +}
|
| +
|
| +class DevToolsAdbBridge
|
| + : public base::RefCountedThreadSafe<DevToolsAdbBridge>,
|
| + public net::URLRequest::Delegate {
|
| + public:
|
| + typedef base::Callback<void(const std::string& error,
|
| + const std::string& data)> Callback;
|
| +
|
| + static DevToolsAdbBridge* Start(Profile* profile);
|
| + void Query(const std::string query, const Callback& callback);
|
| + void Fetch(const std::string url, const Callback& callback);
|
| + void Stop();
|
| +
|
| + private:
|
| + friend class base::RefCountedThreadSafe<DevToolsAdbBridge>;
|
| + struct RequestInfo;
|
| +
|
| + explicit DevToolsAdbBridge(Profile* profile);
|
| + virtual ~DevToolsAdbBridge();
|
| +
|
| + void StartHandlerOnFileThread();
|
| + void StopHandlerOnFileThread();
|
| +
|
| + void ResetHandlerAndReleaseOnUIThread();
|
| + void ResetHandlerOnUIThread();
|
| +
|
| + void InitOnHandlerThread();
|
| + void QueryOnHandlerThread(const std::string query, const Callback& callback);
|
| + void FetchOnHandlerThread(const std::string query, const Callback& callback);
|
| + void QueryResponseOnHandlerThread(const Callback& callback,
|
| + const std::string& error,
|
| + const std::string& response);
|
| + void TeardownOnHandlerThread();
|
| +
|
| + void RespondOnUIThread(const Callback& callback,
|
| + const std::string& error,
|
| + const std::string& response);
|
| +
|
| + // net::URLRequest::Delegate implementation.
|
| + virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
|
| + virtual void OnReadCompleted(net::URLRequest* request,
|
| + int bytes_read) OVERRIDE;
|
| +
|
| + // The thread used by the devtools to run client socket.
|
| + scoped_ptr<base::Thread> thread_;
|
| +
|
| + std::map<net::URLRequest*, RequestInfo> request_info_;
|
| + Profile* profile_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_
|
|
|