OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 std::string method_; | 31 std::string method_; |
32 scoped_ptr<base::DictionaryValue> params_; | 32 scoped_ptr<base::DictionaryValue> params_; |
33 | 33 |
34 private: | 34 private: |
35 DISALLOW_COPY_AND_ASSIGN(Message); | 35 DISALLOW_COPY_AND_ASSIGN(Message); |
36 }; | 36 }; |
37 | 37 |
38 class Command : public Message { | 38 class Command : public Message { |
39 public: | 39 public: |
40 Command(int id, const std::string& method, base::DictionaryValue* params); | 40 Command(int id, const std::string& method, base::DictionaryValue* params); |
41 virtual ~Command(); | 41 ~Command() override; |
42 | 42 |
43 int id() { return id_; } | 43 int id() { return id_; } |
44 std::string Serialize(); | 44 std::string Serialize(); |
45 | 45 |
46 // Creates success response. Takes ownership of |result|. | 46 // Creates success response. Takes ownership of |result|. |
47 scoped_ptr<Response> SuccessResponse(base::DictionaryValue* result); | 47 scoped_ptr<Response> SuccessResponse(base::DictionaryValue* result); |
48 | 48 |
49 // Creates error response. | 49 // Creates error response. |
50 scoped_ptr<Response> InvalidParamResponse(const std::string& param); | 50 scoped_ptr<Response> InvalidParamResponse(const std::string& param); |
51 | 51 |
(...skipping 21 matching lines...) Expand all Loading... |
73 int id_; | 73 int id_; |
74 int error_code_; | 74 int error_code_; |
75 std::string error_message_; | 75 std::string error_message_; |
76 scoped_ptr<base::DictionaryValue> result_; | 76 scoped_ptr<base::DictionaryValue> result_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(Response); | 78 DISALLOW_COPY_AND_ASSIGN(Response); |
79 }; | 79 }; |
80 | 80 |
81 class Notification : public Message { | 81 class Notification : public Message { |
82 public: | 82 public: |
83 virtual ~Notification(); | 83 ~Notification() override; |
84 | 84 |
85 private: | 85 private: |
86 friend class DevToolsProtocol; | 86 friend class DevToolsProtocol; |
87 | 87 |
88 // Takes ownership of |params|. | 88 // Takes ownership of |params|. |
89 Notification(const std::string& method, | 89 Notification(const std::string& method, |
90 base::DictionaryValue* params); | 90 base::DictionaryValue* params); |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(Notification); | 92 DISALLOW_COPY_AND_ASSIGN(Notification); |
93 }; | 93 }; |
94 | 94 |
95 // Result ownership is passed to the caller. | 95 // Result ownership is passed to the caller. |
96 static Command* ParseCommand(base::DictionaryValue* command_dict); | 96 static Command* ParseCommand(base::DictionaryValue* command_dict); |
97 | 97 |
98 // Result ownership is passed to the caller. | 98 // Result ownership is passed to the caller. |
99 static Notification* ParseNotification(const std::string& json); | 99 static Notification* ParseNotification(const std::string& json); |
100 | 100 |
101 // Result ownership is passed to the caller. | 101 // Result ownership is passed to the caller. |
102 static Response* ParseResponse(const std::string& json); | 102 static Response* ParseResponse(const std::string& json); |
103 | 103 |
104 private: | 104 private: |
105 | 105 |
106 DevToolsProtocol() {} | 106 DevToolsProtocol() {} |
107 ~DevToolsProtocol() {} | 107 ~DevToolsProtocol() {} |
108 }; | 108 }; |
109 | 109 |
110 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_ | 110 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_ |
OLD | NEW |