Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_ANDROID_DEVTOOLS_SERVER_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_DEVTOOLS_SERVER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/callback_forward.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/memory/singleton.h" | |
| 14 | |
| 15 namespace net { | |
| 16 class URLRequestContextGetter; | |
| 17 }; | |
|
jochen (gone - plz use gerrit)
2012/06/18 11:32:40
no ;
Philippe
2012/06/18 13:28:59
Done.
| |
| 18 | |
| 19 namespace content { | |
| 20 | |
| 21 class DevToolsHttpHandler; | |
| 22 class DevToolsHttpHandlerDelegate; | |
| 23 | |
| 24 // This class controls Chrome Developer Tools remote debugging server. | |
| 25 class DevToolsServer { | |
| 26 public: | |
| 27 // A callback being called each time the server restarts. | |
| 28 // The delegate instance is deleted on server stop, so the creator must | |
| 29 // provide the new instance on each call. | |
| 30 typedef base::Callback<content::DevToolsHttpHandlerDelegate*(void)> | |
| 31 DelegateCreator; | |
| 32 | |
| 33 // Returns the singleton instance (and initializes it if necessary). | |
| 34 static DevToolsServer* GetInstance(); | |
| 35 | |
| 36 // Initializes the server. Must be called prior to the first call of |Start|. | |
| 37 void Init(const std::string& frontend_version, | |
| 38 net::URLRequestContextGetter* url_request_context, | |
| 39 const DelegateCreator& delegate_creator); | |
| 40 | |
| 41 // Opens linux abstract socket to be ready for remote debugging. | |
| 42 void Start(); | |
| 43 | |
| 44 // Closes debugging socket, stops debugging. | |
| 45 void Stop(); | |
| 46 | |
| 47 bool is_initialized() const { | |
| 48 return !frontend_url_.empty() && url_request_context_; | |
| 49 } | |
| 50 | |
| 51 bool is_started() const { | |
| 52 return protocol_handler_; | |
| 53 } | |
| 54 | |
| 55 private: | |
| 56 // Obtain an instance via GetInstance(). | |
| 57 DevToolsServer(); | |
| 58 friend struct DefaultSingletonTraits<DevToolsServer>; | |
| 59 virtual ~DevToolsServer(); | |
| 60 | |
| 61 content::DevToolsHttpHandler* protocol_handler_; | |
| 62 std::string frontend_url_; | |
| 63 net::URLRequestContextGetter* url_request_context_; | |
| 64 DelegateCreator delegate_creator_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(DevToolsServer); | |
| 67 }; | |
| 68 | |
| 69 } // namespace content | |
| 70 | |
| 71 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_DEVTOOLS_SERVER_H_ | |
| OLD | NEW |