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 DBUS_MESSAGE_H_ | 5 #ifndef DBUS_MESSAGE_H_ |
6 #define DBUS_MESSAGE_H_ | 6 #define DBUS_MESSAGE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 // Returns a newly created Response from the given method call. The | 194 // Returns a newly created Response from the given method call. The |
195 // caller must delete the returned object. Used for implementing | 195 // caller must delete the returned object. Used for implementing |
196 // exported methods. | 196 // exported methods. |
197 static Response* FromMethodCall(MethodCall* method_call); | 197 static Response* FromMethodCall(MethodCall* method_call); |
198 | 198 |
199 // Returns a newly created Response with an empty payload. The caller | 199 // Returns a newly created Response with an empty payload. The caller |
200 // must delete the returned object. Useful for testing. | 200 // must delete the returned object. Useful for testing. |
201 static Response* CreateEmpty(); | 201 static Response* CreateEmpty(); |
202 | 202 |
203 private: | 203 protected: |
204 // Creates a Response message. The internal raw message is NULL. | 204 // Creates a Response message. The internal raw message is NULL. |
205 Response(); | 205 Response(); |
206 | 206 |
| 207 private: |
207 DISALLOW_COPY_AND_ASSIGN(Response); | 208 DISALLOW_COPY_AND_ASSIGN(Response); |
208 }; | 209 }; |
209 | 210 |
210 // ErrorResponse is a type of message used to return an error to the | 211 // ErrorResponse is a type of message used to return an error to the |
211 // caller of a method. | 212 // caller of a method. |
212 class ErrorResponse: public Message { | 213 class ErrorResponse: public Response { |
213 public: | 214 public: |
214 // Returns a newly created Response from the given raw message of the | 215 // Returns a newly created Response from the given raw message of the |
215 // type DBUS_MESSAGE_TYPE_METHOD_RETURN. The caller must delete the | 216 // type DBUS_MESSAGE_TYPE_METHOD_RETURN. The caller must delete the |
216 // returned object. Takes the ownership of |raw_message|. | 217 // returned object. Takes the ownership of |raw_message|. |
217 static ErrorResponse* FromRawMessage(DBusMessage* raw_message); | 218 static ErrorResponse* FromRawMessage(DBusMessage* raw_message); |
218 | 219 |
219 // Returns a newly created ErrorResponse from the given method call, the | 220 // Returns a newly created ErrorResponse from the given method call, the |
220 // error name, and the error message. The error name looks like | 221 // error name, and the error message. The error name looks like |
221 // "org.freedesktop.DBus.Error.Failed". Used for returning an error to a | 222 // "org.freedesktop.DBus.Error.Failed". Used for returning an error to a |
222 // failed method call. | 223 // failed method call. |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 461 |
461 Message* message_; | 462 Message* message_; |
462 DBusMessageIter raw_message_iter_; | 463 DBusMessageIter raw_message_iter_; |
463 | 464 |
464 DISALLOW_COPY_AND_ASSIGN(MessageReader); | 465 DISALLOW_COPY_AND_ASSIGN(MessageReader); |
465 }; | 466 }; |
466 | 467 |
467 } // namespace dbus | 468 } // namespace dbus |
468 | 469 |
469 #endif // DBUS_MESSAGE_H_ | 470 #endif // DBUS_MESSAGE_H_ |
OLD | NEW |