OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 class URLRequestContextGetter; | 14 class URLRequestContextGetter; |
15 } | 15 } |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class DevToolsHttpHandlerDelegate; | 19 class DevToolsHttpHandlerDelegate; |
20 class RenderViewHost; | |
20 | 21 |
21 // This class is used for managing DevTools remote debugging server. | 22 // This class is used for managing DevTools remote debugging server. |
22 // Clients can connect to the specified ip:port and start debugging | 23 // Clients can connect to the specified ip:port and start debugging |
23 // this browser. | 24 // this browser. |
24 class DevToolsHttpHandler { | 25 class DevToolsHttpHandler { |
25 public: | 26 public: |
27 // Interface responsible for mapping RenderViewHost instances to/from string | |
28 // identifiers. | |
29 class RenderViewHostBinding { | |
30 public: | |
31 virtual ~RenderViewHostBinding() {} | |
32 | |
33 // Returns the mapping of RenderViewHost to identifier. | |
34 virtual std::string GetIdentifier(RenderViewHost* rvh) = 0; | |
35 | |
36 // Return the mapping of identifier to RenderViewHost. | |
pfeldman
2012/04/25 15:27:54
Returns
Marshall
2012/04/25 15:36:19
Done.
| |
37 virtual RenderViewHost* ForIdentifier(const std::string& identifier) = 0; | |
38 }; | |
39 | |
26 // Returns frontend resource id for the given resource |name|. | 40 // Returns frontend resource id for the given resource |name|. |
27 CONTENT_EXPORT static int GetFrontendResourceId( | 41 CONTENT_EXPORT static int GetFrontendResourceId( |
28 const std::string& name); | 42 const std::string& name); |
29 | 43 |
30 // Takes ownership over |delegate|. | 44 // Takes ownership over |delegate|. |
31 CONTENT_EXPORT static DevToolsHttpHandler* Start( | 45 CONTENT_EXPORT static DevToolsHttpHandler* Start( |
32 const std::string& ip, | 46 const std::string& ip, |
33 int port, | 47 int port, |
34 const std::string& frontend_url, | 48 const std::string& frontend_url, |
35 net::URLRequestContextGetter* request_context_getter, | 49 net::URLRequestContextGetter* request_context_getter, |
36 DevToolsHttpHandlerDelegate* delegate); | 50 DevToolsHttpHandlerDelegate* delegate); |
37 | 51 |
38 // Called from the main thread in order to stop protocol handler. | 52 // Called from the main thread in order to stop protocol handler. |
39 // Automatically destroys the handler instance. | 53 // Automatically destroys the handler instance. |
40 virtual void Stop() = 0; | 54 virtual void Stop() = 0; |
41 | 55 |
56 // Set the RenderViewHostBinding instance. If no instance is provided the | |
57 // default implementation will be used. | |
58 virtual void SetRenderViewHostBinding(RenderViewHostBinding* binding) = 0; | |
59 | |
42 protected: | 60 protected: |
43 virtual ~DevToolsHttpHandler() {} | 61 virtual ~DevToolsHttpHandler() {} |
44 }; | 62 }; |
45 | 63 |
46 } // namespace content | 64 } // namespace content |
47 | 65 |
48 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ | 66 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ |
OLD | NEW |