| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_COOKIE_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_COOKIE_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_COOKIE_H_ | 6 #define CHROME_TEST_WEBDRIVER_COOKIE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 | 12 |
| 13 namespace webdriver { | 13 namespace webdriver { |
| 14 | 14 |
| 15 // Class used to convert cookies to various formats. | 15 // Class used to convert cookies to various formats. |
| 16 class Cookie { | 16 class Cookie { |
| 17 public: | 17 public: |
| 18 explicit Cookie(const std::string& cookie); | 18 explicit Cookie(const std::string& cookie); |
| 19 explicit Cookie(const DictionaryValue& dict); | 19 explicit Cookie(const DictionaryValue& dict); |
| 20 ~Cookie(); |
| 20 | 21 |
| 21 DictionaryValue* ToDictionary(); | 22 DictionaryValue* ToDictionary(); |
| 22 // ToJSONString() returns a string form of a JSON object with the required | 23 // ToJSONString() returns a string form of a JSON object with the required |
| 23 // WebDriver tags. Note that this format cannot be used to set a cookie in | 24 // WebDriver tags. Note that this format cannot be used to set a cookie in |
| 24 // the chrome browser. Example { "name"="foo", "value"="bar"} | 25 // the chrome browser. Example { "name"="foo", "value"="bar"} |
| 25 std::string ToJSONString(); | 26 std::string ToJSONString(); |
| 26 // ToString() returns a string format expected by chrome to for a cookie. | 27 // ToString() returns a string format expected by chrome to for a cookie. |
| 27 // Example: "foo=bar" | 28 // Example: "foo=bar" |
| 28 std::string ToString(); | 29 std::string ToString(); |
| 29 | 30 |
| 30 bool valid() const { return valid_; } | 31 bool valid() const { return valid_; } |
| 31 const std::string& name() const { return name_; } | 32 const std::string& name() const { return name_; } |
| 32 | 33 |
| 33 private: | 34 private: |
| 34 std::string name_; | 35 std::string name_; |
| 35 std::string value_; | 36 std::string value_; |
| 36 std::string path_; | 37 std::string path_; |
| 37 std::string domain_; | 38 std::string domain_; |
| 38 std::string expires_; | 39 std::string expires_; |
| 39 bool secure_; | 40 bool secure_; |
| 40 bool http_; | 41 bool http_; |
| 41 bool valid_; | 42 bool valid_; |
| 42 | 43 |
| 43 DISALLOW_COPY_AND_ASSIGN(Cookie); | 44 DISALLOW_COPY_AND_ASSIGN(Cookie); |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 } // namespace webdriver | 47 } // namespace webdriver |
| 47 | 48 |
| 48 #endif // CHROME_TEST_WEBDRIVER_COOKIE_H_ | 49 #endif // CHROME_TEST_WEBDRIVER_COOKIE_H_ |
| OLD | NEW |