OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/net/evicted_domain_cookie_counter.h" | 5 #include "chrome/browser/net/evicted_domain_cookie_counter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 if (cause == net::CookieMonster::Delegate::CHANGE_COOKIE_EVICTED) | 104 if (cause == net::CookieMonster::Delegate::CHANGE_COOKIE_EVICTED) |
105 StoreEvictedCookie(key, cookie, current_time); | 105 StoreEvictedCookie(key, cookie, current_time); |
106 } else { // Includes adds or updates. | 106 } else { // Includes adds or updates. |
107 ProcessNewCookie(key, cookie, current_time); | 107 ProcessNewCookie(key, cookie, current_time); |
108 } | 108 } |
109 | 109 |
110 if (next_cookie_monster_delegate_.get()) | 110 if (next_cookie_monster_delegate_.get()) |
111 next_cookie_monster_delegate_->OnCookieChanged(cookie, removed, cause); | 111 next_cookie_monster_delegate_->OnCookieChanged(cookie, removed, cause); |
112 } | 112 } |
113 | 113 |
| 114 void EvictedDomainCookieCounter::OnLoaded() { |
| 115 if (next_cookie_monster_delegate_.get()) |
| 116 next_cookie_monster_delegate_->OnLoaded(); |
| 117 } |
| 118 |
114 // static | 119 // static |
115 EvictedDomainCookieCounter::EvictedCookieKey | 120 EvictedDomainCookieCounter::EvictedCookieKey |
116 EvictedDomainCookieCounter::GetKey(const net::CanonicalCookie& cookie) { | 121 EvictedDomainCookieCounter::GetKey(const net::CanonicalCookie& cookie) { |
117 return cookie.Domain() + ";" + cookie.Path() + ";" + cookie.Name(); | 122 return cookie.Domain() + ";" + cookie.Path() + ";" + cookie.Name(); |
118 } | 123 } |
119 | 124 |
120 // static | 125 // static |
121 bool EvictedDomainCookieCounter::CompareEvictedCookie( | 126 bool EvictedDomainCookieCounter::CompareEvictedCookie( |
122 const EvictedCookieMap::iterator evicted_cookie1, | 127 const EvictedCookieMap::iterator evicted_cookie1, |
123 const EvictedCookieMap::iterator evicted_cookie2) { | 128 const EvictedCookieMap::iterator evicted_cookie2) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 EvictedCookieMap::iterator it = evicted_cookies_.find(key); | 198 EvictedCookieMap::iterator it = evicted_cookies_.find(key); |
194 if (it != evicted_cookies_.end()) { | 199 if (it != evicted_cookies_.end()) { |
195 if (!it->second->is_expired(current_time)) // Reinstatement. | 200 if (!it->second->is_expired(current_time)) // Reinstatement. |
196 cookie_counter_delegate_->Report(*it->second, current_time); | 201 cookie_counter_delegate_->Report(*it->second, current_time); |
197 delete it->second; | 202 delete it->second; |
198 evicted_cookies_.erase(it); | 203 evicted_cookies_.erase(it); |
199 } | 204 } |
200 } | 205 } |
201 | 206 |
202 } // namespace chrome_browser_net | 207 } // namespace chrome_browser_net |
OLD | NEW |