| 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 | |
| 119 // static | 114 // static |
| 120 EvictedDomainCookieCounter::EvictedCookieKey | 115 EvictedDomainCookieCounter::EvictedCookieKey |
| 121 EvictedDomainCookieCounter::GetKey(const net::CanonicalCookie& cookie) { | 116 EvictedDomainCookieCounter::GetKey(const net::CanonicalCookie& cookie) { |
| 122 return cookie.Domain() + ";" + cookie.Path() + ";" + cookie.Name(); | 117 return cookie.Domain() + ";" + cookie.Path() + ";" + cookie.Name(); |
| 123 } | 118 } |
| 124 | 119 |
| 125 // static | 120 // static |
| 126 bool EvictedDomainCookieCounter::CompareEvictedCookie( | 121 bool EvictedDomainCookieCounter::CompareEvictedCookie( |
| 127 const EvictedCookieMap::iterator evicted_cookie1, | 122 const EvictedCookieMap::iterator evicted_cookie1, |
| 128 const EvictedCookieMap::iterator evicted_cookie2) { | 123 const EvictedCookieMap::iterator evicted_cookie2) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 EvictedCookieMap::iterator it = evicted_cookies_.find(key); | 193 EvictedCookieMap::iterator it = evicted_cookies_.find(key); |
| 199 if (it != evicted_cookies_.end()) { | 194 if (it != evicted_cookies_.end()) { |
| 200 if (!it->second->is_expired(current_time)) // Reinstatement. | 195 if (!it->second->is_expired(current_time)) // Reinstatement. |
| 201 cookie_counter_delegate_->Report(*it->second, current_time); | 196 cookie_counter_delegate_->Report(*it->second, current_time); |
| 202 delete it->second; | 197 delete it->second; |
| 203 evicted_cookies_.erase(it); | 198 evicted_cookies_.erase(it); |
| 204 } | 199 } |
| 205 } | 200 } |
| 206 | 201 |
| 207 } // namespace chrome_browser_net | 202 } // namespace chrome_browser_net |
| OLD | NEW |