Index: content/browser/android/devtools_server.h |
diff --git a/content/browser/android/devtools_server.h b/content/browser/android/devtools_server.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3ad90641d47c39af99316ac4c6af2dd9d3811b85 |
--- /dev/null |
+++ b/content/browser/android/devtools_server.h |
@@ -0,0 +1,69 @@ |
+// 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_BROWSER_ANDROID_DEVTOOLS_SERVER_H_ |
+#define CONTENT_BROWSER_ANDROID_DEVTOOLS_SERVER_H_ |
John Grabowski
2012/06/11 20:17:02
Does ContentShell support the devtools?
mnaganov (inactive)
2012/06/11 21:32:44
Chromium's content_shell supports it. I haven't lo
John Grabowski
2012/06/11 23:17:14
Thanks for the note.
In our internal repo, it loo
Philippe
2012/06/13 15:21:12
Is that reasonable if externally we move it to con
John Grabowski
2012/06/13 19:54:10
Reasonable? Perhaps, but I still think we should
mnaganov (inactive)
2012/06/18 10:18:54
I think, the TODO doesn't imply that the target wi
|
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/callback_forward.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/singleton.h" |
+ |
+namespace content { |
+class DevToolsHttpHandler; |
+class DevToolsHttpHandlerDelegate; |
+} |
+ |
+namespace net { |
+class URLRequestContextGetter; |
+}; |
+ |
+// This class controls Chrome Developer Tools remote debugging server. |
John Grabowski
2012/06/11 20:17:02
namespace content {
Philippe
2012/06/13 15:21:12
Done.
|
+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); |
+}; |
+ |
+#endif // CONTENT_BROWSER_ANDROID_DEVTOOLS_SERVER_H_ |