OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TEST_WEBDRIVER_COMMANDS_RESPONSE_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_COMMANDS_RESPONSE_H_ |
6 #define CHROME_TEST_WEBDRIVER_COMMANDS_RESPONSE_H_ | 6 #define CHROME_TEST_WEBDRIVER_COMMANDS_RESPONSE_H_ |
7 | 7 |
8 #include <sstream> | 8 #include <sstream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 public: | 21 public: |
22 // Creates a new |Response| with a default status of |kSuccess| and a | 22 // Creates a new |Response| with a default status of |kSuccess| and a |
23 // |NullValue|. | 23 // |NullValue|. |
24 Response(); | 24 Response(); |
25 ~Response(); | 25 ~Response(); |
26 | 26 |
27 ErrorCode GetStatus() const; | 27 ErrorCode GetStatus() const; |
28 void SetStatus(ErrorCode status); | 28 void SetStatus(ErrorCode status); |
29 | 29 |
30 // Ownership of the returned pointer is kept by this object. | 30 // Ownership of the returned pointer is kept by this object. |
31 Value* GetValue() const; | 31 const Value* GetValue() const; |
32 | 32 |
33 // Sets the |value| of this response, assuming ownership of the object in the | 33 // Sets the |value| of this response, assuming ownership of the object in the |
34 // process. | 34 // process. |
35 void SetValue(Value* value); | 35 void SetValue(Value* value); |
36 | 36 |
37 // Configures this response to report the given error. Ownership of the error | 37 // Configures this response to report the given error. Ownership of the error |
38 // is taken from the caller. | 38 // is taken from the caller. |
39 void SetError(Error* error); | 39 void SetError(Error* error); |
40 | 40 |
41 // Sets a JSON field in this response. The |key| may be a "." delimitted | 41 // Sets a JSON field in this response. The |key| may be a "." delimitted |
42 // string to indicate the value should be set in a nested object. Any | 42 // string to indicate the value should be set in a nested object. Any |
43 // previously set value for the |key| will be deleted. | 43 // previously set value for the |key| will be deleted. |
44 // This object assumes ownership of |value|. | 44 // This object assumes ownership of |value|. |
45 void SetField(const std::string& key, Value* value); | 45 void SetField(const std::string& key, Value* value); |
46 | 46 |
47 // Returns this response as a JSON string. | 47 // Returns this response as a JSON string. |
48 std::string ToJSON() const; | 48 std::string ToJSON() const; |
49 | 49 |
50 private: | 50 private: |
51 DictionaryValue data_; | 51 DictionaryValue data_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(Response); | 53 DISALLOW_COPY_AND_ASSIGN(Response); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace webdriver | 56 } // namespace webdriver |
57 | 57 |
58 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_RESPONSE_H_ | 58 #endif // CHROME_TEST_WEBDRIVER_COMMANDS_RESPONSE_H_ |
OLD | NEW |