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 "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 const GURL& url, | 102 const GURL& url, |
103 const std::string& cookie_line, | 103 const std::string& cookie_line, |
104 const net::CookieOptions& options) { | 104 const net::CookieOptions& options) { |
105 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( | 105 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( |
106 url, cookie_line, base::Time::Now(), options)); | 106 url, cookie_line, base::Time::Now(), options)); |
107 if (cookie.get()) | 107 if (cookie.get()) |
108 AddCookie(frame_url, *cookie); | 108 AddCookie(frame_url, *cookie); |
109 } | 109 } |
110 | 110 |
111 void CannedBrowsingDataCookieHelper::Reset() { | 111 void CannedBrowsingDataCookieHelper::Reset() { |
112 STLDeleteContainerPairSecondPointers(origin_cookie_set_map_.begin(), | 112 base::STLDeleteContainerPairSecondPointers(origin_cookie_set_map_.begin(), |
113 origin_cookie_set_map_.end()); | 113 origin_cookie_set_map_.end()); |
114 origin_cookie_set_map_.clear(); | 114 origin_cookie_set_map_.clear(); |
115 } | 115 } |
116 | 116 |
117 bool CannedBrowsingDataCookieHelper::empty() const { | 117 bool CannedBrowsingDataCookieHelper::empty() const { |
118 for (const auto& pair : origin_cookie_set_map_) { | 118 for (const auto& pair : origin_cookie_set_map_) { |
119 if (!pair.second->empty()) | 119 if (!pair.second->empty()) |
120 return false; | 120 return false; |
121 } | 121 } |
122 return true; | 122 return true; |
123 } | 123 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // TODO(markusheintz): A) Change the GetCookiesCount method to prevent | 187 // TODO(markusheintz): A) Change the GetCookiesCount method to prevent |
188 // counting cookies multiple times if they are stored in multiple cookie | 188 // counting cookies multiple times if they are stored in multiple cookie |
189 // sets. B) Replace the GetCookieFor method call below with: | 189 // sets. B) Replace the GetCookieFor method call below with: |
190 // "GetCookiesFor(frame_url.GetOrigin());" | 190 // "GetCookiesFor(frame_url.GetOrigin());" |
191 CR_DEFINE_STATIC_LOCAL(const GURL, origin_cookie_url, (kGlobalCookieSetURL)); | 191 CR_DEFINE_STATIC_LOCAL(const GURL, origin_cookie_url, (kGlobalCookieSetURL)); |
192 canonical_cookie::CookieHashSet* cookie_set = | 192 canonical_cookie::CookieHashSet* cookie_set = |
193 GetCookiesFor(origin_cookie_url); | 193 GetCookiesFor(origin_cookie_url); |
194 DeleteMatchingCookie(cookie, cookie_set); | 194 DeleteMatchingCookie(cookie, cookie_set); |
195 cookie_set->insert(cookie); | 195 cookie_set->insert(cookie); |
196 } | 196 } |
OLD | NEW |