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_BROWSER_DEBUGGER_DEVTOOLS_BROWSER_TARGET_H_ | |
6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_BROWSER_TARGET_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | |
11 #include "base/basictypes.h" | |
12 | |
13 namespace base { | |
14 | |
15 class DictionaryValue; | |
16 class Value; | |
17 | |
18 } // namespace base | |
19 | |
20 namespace content { | |
21 | |
22 // This class handles the "Browser" target for remote debugging. | |
23 class DevToolsBrowserTarget { | |
24 public: | |
25 class Handler { | |
26 public: | |
27 virtual ~Handler() {} | |
28 | |
29 // |return_value| ownership is transferred to the caller. | |
30 virtual base::Value* OnProtocolCommand( | |
31 const std::string& method, | |
32 const base::DictionaryValue* params) = 0; | |
33 | |
pfeldman
2012/12/14 18:35:05
nit: blank line
bulach
2012/12/14 19:53:39
Done.
| |
34 }; | |
35 | |
36 explicit DevToolsBrowserTarget(int connection_id); | |
37 ~DevToolsBrowserTarget(); | |
38 | |
39 int connection_id() const { return connection_id_; } | |
40 | |
41 // Takes ownership of |handler|. | |
42 void RegisterHandler(const std::string& domain, Handler* handler); | |
43 | |
44 std::string HandleMessage(const std::string& data); | |
45 | |
46 private: | |
47 const int connection_id_; | |
48 | |
49 typedef std::map<std::string, Handler*> HandlersMap; | |
50 HandlersMap handlers_; | |
51 | |
52 std::string CreateErrorResponse(int request_id, const std::string& message); | |
53 std::string CreateResponse(int request_id, base::Value* response); | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(DevToolsBrowserTarget); | |
56 }; | |
57 | |
58 } // namespace content | |
59 | |
60 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_BROWSER_TARGET_H_ | |
OLD | NEW |