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 #include "net/cookies/cookie_store.h" | 5 #include "net/cookies/cookie_store.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "net/cookies/cookie_options.h" | 9 #include "net/cookies/cookie_options.h" |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 if (!cookie.Name().empty()) | 24 if (!cookie.Name().empty()) |
25 cookie_line += cookie.Name() + "="; | 25 cookie_line += cookie.Name() + "="; |
26 cookie_line += cookie.Value(); | 26 cookie_line += cookie.Value(); |
27 } | 27 } |
28 return cookie_line; | 28 return cookie_line; |
29 } | 29 } |
30 | 30 |
31 std::string CookieStore::BuildCookieLine( | 31 std::string CookieStore::BuildCookieLine( |
32 const std::vector<CanonicalCookie*>& cookies) { | 32 const std::vector<CanonicalCookie*>& cookies) { |
33 std::string cookie_line; | 33 std::string cookie_line; |
34 for (const auto& cookie : cookies) { | 34 for (auto* cookie : cookies) { |
35 if (!cookie_line.empty()) | 35 if (!cookie_line.empty()) |
36 cookie_line += "; "; | 36 cookie_line += "; "; |
37 // In Mozilla, if you set a cookie like "AAA", it will have an empty token | 37 // In Mozilla, if you set a cookie like "AAA", it will have an empty token |
38 // and a value of "AAA". When it sends the cookie back, it will send "AAA", | 38 // and a value of "AAA". When it sends the cookie back, it will send "AAA", |
39 // so we need to avoid sending "=AAA" for a blank token value. | 39 // so we need to avoid sending "=AAA" for a blank token value. |
40 if (!cookie->Name().empty()) | 40 if (!cookie->Name().empty()) |
41 cookie_line += cookie->Name() + "="; | 41 cookie_line += cookie->Name() + "="; |
42 cookie_line += cookie->Value(); | 42 cookie_line += cookie->Value(); |
43 } | 43 } |
44 return cookie_line; | 44 return cookie_line; |
(...skipping 23 matching lines...) Expand all Loading... |
68 channel_id_service_id_ = id; | 68 channel_id_service_id_ = id; |
69 } | 69 } |
70 | 70 |
71 int CookieStore::GetChannelIDServiceID() { | 71 int CookieStore::GetChannelIDServiceID() { |
72 return channel_id_service_id_; | 72 return channel_id_service_id_; |
73 } | 73 } |
74 | 74 |
75 CookieStore::CookieStore() : channel_id_service_id_(-1) {} | 75 CookieStore::CookieStore() : channel_id_service_id_(-1) {} |
76 | 76 |
77 } // namespace net | 77 } // namespace net |
OLD | NEW |