Index: content/public/browser/android/devtools_server.h |
diff --git a/content/public/browser/android/devtools_server.h b/content/public/browser/android/devtools_server.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cadcbd7561c1bed4389fd2496478328c5eecf362 |
--- /dev/null |
+++ b/content/public/browser/android/devtools_server.h |
@@ -0,0 +1,71 @@ |
+// Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_ANDROID_DEVTOOLS_SERVER_H_ |
+#define CONTENT_PUBLIC_BROWSER_ANDROID_DEVTOOLS_SERVER_H_ |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/callback_forward.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/singleton.h" |
+ |
+namespace net { |
+class URLRequestContextGetter; |
+}; |
jochen (gone - plz use gerrit)
2012/06/18 11:32:40
no ;
Philippe
2012/06/18 13:28:59
Done.
|
+ |
+namespace content { |
+ |
+class DevToolsHttpHandler; |
+class DevToolsHttpHandlerDelegate; |
+ |
+// This class controls Chrome Developer Tools remote debugging server. |
+class DevToolsServer { |
+ public: |
+ // A callback being called each time the server restarts. |
+ // The delegate instance is deleted on server stop, so the creator must |
+ // provide the new instance on each call. |
+ typedef base::Callback<content::DevToolsHttpHandlerDelegate*(void)> |
+ DelegateCreator; |
+ |
+ // Returns the singleton instance (and initializes it if necessary). |
+ static DevToolsServer* GetInstance(); |
+ |
+ // Initializes the server. Must be called prior to the first call of |Start|. |
+ void Init(const std::string& frontend_version, |
+ net::URLRequestContextGetter* url_request_context, |
+ const DelegateCreator& delegate_creator); |
+ |
+ // Opens linux abstract socket to be ready for remote debugging. |
+ void Start(); |
+ |
+ // Closes debugging socket, stops debugging. |
+ void Stop(); |
+ |
+ bool is_initialized() const { |
+ return !frontend_url_.empty() && url_request_context_; |
+ } |
+ |
+ bool is_started() const { |
+ return protocol_handler_; |
+ } |
+ |
+ private: |
+ // Obtain an instance via GetInstance(). |
+ DevToolsServer(); |
+ friend struct DefaultSingletonTraits<DevToolsServer>; |
+ virtual ~DevToolsServer(); |
+ |
+ content::DevToolsHttpHandler* protocol_handler_; |
+ std::string frontend_url_; |
+ net::URLRequestContextGetter* url_request_context_; |
+ DelegateCreator delegate_creator_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DevToolsServer); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_PUBLIC_BROWSER_ANDROID_DEVTOOLS_SERVER_H_ |