| 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 // Implements common functionality for the Chrome Extensions Cookies API. | 5 // Implements common functionality for the Chrome Extensions Cookies API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_cookies_helpers.h" | 7 #include "chrome/browser/extensions/extension_cookies_helpers.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 result->SetString(keys::kNameKey, cookie.Name()); | 53 result->SetString(keys::kNameKey, cookie.Name()); |
| 54 result->SetString(keys::kValueKey, cookie.Value()); | 54 result->SetString(keys::kValueKey, cookie.Value()); |
| 55 result->SetString(keys::kDomainKey, cookie.Domain()); | 55 result->SetString(keys::kDomainKey, cookie.Domain()); |
| 56 result->SetBoolean(keys::kHostOnlyKey, | 56 result->SetBoolean(keys::kHostOnlyKey, |
| 57 net::CookieMonster::DomainIsHostOnly(cookie.Domain())); | 57 net::CookieMonster::DomainIsHostOnly(cookie.Domain())); |
| 58 result->SetString(keys::kPathKey, cookie.Path()); | 58 result->SetString(keys::kPathKey, cookie.Path()); |
| 59 result->SetBoolean(keys::kSecureKey, cookie.IsSecure()); | 59 result->SetBoolean(keys::kSecureKey, cookie.IsSecure()); |
| 60 result->SetBoolean(keys::kHttpOnlyKey, cookie.IsHttpOnly()); | 60 result->SetBoolean(keys::kHttpOnlyKey, cookie.IsHttpOnly()); |
| 61 result->SetBoolean(keys::kSessionKey, !cookie.DoesExpire()); | 61 result->SetBoolean(keys::kSessionKey, !cookie.DoesExpire()); |
| 62 if (cookie.DoesExpire()) | 62 if (cookie.DoesExpire()) { |
| 63 result->SetReal(keys::kExpirationDateKey, cookie.ExpiryDate().ToDoubleT()); | 63 result->SetDouble(keys::kExpirationDateKey, |
| 64 cookie.ExpiryDate().ToDoubleT()); |
| 65 } |
| 64 result->SetString(keys::kStoreIdKey, store_id); | 66 result->SetString(keys::kStoreIdKey, store_id); |
| 65 | 67 |
| 66 return result; | 68 return result; |
| 67 } | 69 } |
| 68 | 70 |
| 69 DictionaryValue* CreateCookieStoreValue(Profile* profile, | 71 DictionaryValue* CreateCookieStoreValue(Profile* profile, |
| 70 ListValue* tab_ids) { | 72 ListValue* tab_ids) { |
| 71 DCHECK(profile); | 73 DCHECK(profile); |
| 72 DCHECK(tab_ids); | 74 DCHECK(tab_ids); |
| 73 DictionaryValue* result = new DictionaryValue(); | 75 DictionaryValue* result = new DictionaryValue(); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 sub_domain.length() >= filter_value.length();) { | 181 sub_domain.length() >= filter_value.length();) { |
| 180 if (sub_domain == filter_value) | 182 if (sub_domain == filter_value) |
| 181 return true; | 183 return true; |
| 182 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. | 184 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. |
| 183 sub_domain.erase(0, next_dot); | 185 sub_domain.erase(0, next_dot); |
| 184 } | 186 } |
| 185 return false; | 187 return false; |
| 186 } | 188 } |
| 187 | 189 |
| 188 } // namespace extension_cookies_helpers | 190 } // namespace extension_cookies_helpers |
| OLD | NEW |