| 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 // Portions of this code based on Mozilla: | 5 // Portions of this code based on Mozilla: |
| 6 // (netwerk/cookie/src/nsCookieService.cpp) | 6 // (netwerk/cookie/src/nsCookieService.cpp) |
| 7 /* ***** BEGIN LICENSE BLOCK ***** | 7 /* ***** BEGIN LICENSE BLOCK ***** |
| 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 9 * | 9 * |
| 10 * The contents of this file are subject to the Mozilla Public License Version | 10 * The contents of this file are subject to the Mozilla Public License Version |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 * the terms of any one of the MPL, the GPL or the LGPL. | 41 * the terms of any one of the MPL, the GPL or the LGPL. |
| 42 * | 42 * |
| 43 * ***** END LICENSE BLOCK ***** */ | 43 * ***** END LICENSE BLOCK ***** */ |
| 44 | 44 |
| 45 #include "net/cookies/cookie_monster.h" | 45 #include "net/cookies/cookie_monster.h" |
| 46 | 46 |
| 47 #include <algorithm> | 47 #include <algorithm> |
| 48 #include <functional> | 48 #include <functional> |
| 49 #include <set> | 49 #include <set> |
| 50 | 50 |
| 51 #include "base/basictypes.h" | |
| 52 #include "base/bind.h" | 51 #include "base/bind.h" |
| 53 #include "base/callback.h" | 52 #include "base/callback.h" |
| 54 #include "base/location.h" | 53 #include "base/location.h" |
| 55 #include "base/logging.h" | 54 #include "base/logging.h" |
| 55 #include "base/macros.h" |
| 56 #include "base/memory/scoped_ptr.h" | 56 #include "base/memory/scoped_ptr.h" |
| 57 #include "base/metrics/field_trial.h" | 57 #include "base/metrics/field_trial.h" |
| 58 #include "base/metrics/histogram.h" | 58 #include "base/metrics/histogram.h" |
| 59 #include "base/profiler/scoped_tracker.h" | 59 #include "base/profiler/scoped_tracker.h" |
| 60 #include "base/single_thread_task_runner.h" | 60 #include "base/single_thread_task_runner.h" |
| 61 #include "base/strings/string_util.h" | 61 #include "base/strings/string_util.h" |
| 62 #include "base/strings/stringprintf.h" | 62 #include "base/strings/stringprintf.h" |
| 63 #include "base/thread_task_runner_handle.h" | 63 #include "base/thread_task_runner_handle.h" |
| 64 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 64 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 65 #include "net/cookies/canonical_cookie.h" | 65 #include "net/cookies/canonical_cookie.h" |
| (...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 | 1566 |
| 1567 // Initialize the store and sync in any saved persistent cookies. We don't | 1567 // Initialize the store and sync in any saved persistent cookies. We don't |
| 1568 // care if it's expired, insert it so it can be garbage collected, removed, | 1568 // care if it's expired, insert it so it can be garbage collected, removed, |
| 1569 // and sync'd. | 1569 // and sync'd. |
| 1570 base::AutoLock autolock(lock_); | 1570 base::AutoLock autolock(lock_); |
| 1571 | 1571 |
| 1572 CookieItVector cookies_with_control_chars; | 1572 CookieItVector cookies_with_control_chars; |
| 1573 | 1573 |
| 1574 for (std::vector<CanonicalCookie*>::const_iterator it = cookies.begin(); | 1574 for (std::vector<CanonicalCookie*>::const_iterator it = cookies.begin(); |
| 1575 it != cookies.end(); ++it) { | 1575 it != cookies.end(); ++it) { |
| 1576 int64 cookie_creation_time = (*it)->CreationDate().ToInternalValue(); | 1576 int64_t cookie_creation_time = (*it)->CreationDate().ToInternalValue(); |
| 1577 | 1577 |
| 1578 if (creation_times_.insert(cookie_creation_time).second) { | 1578 if (creation_times_.insert(cookie_creation_time).second) { |
| 1579 CookieMap::iterator inserted = | 1579 CookieMap::iterator inserted = |
| 1580 InternalInsertCookie(GetKey((*it)->Domain()), *it, false); | 1580 InternalInsertCookie(GetKey((*it)->Domain()), *it, false); |
| 1581 const Time cookie_access_time((*it)->LastAccessDate()); | 1581 const Time cookie_access_time((*it)->LastAccessDate()); |
| 1582 if (earliest_access_time_.is_null() || | 1582 if (earliest_access_time_.is_null() || |
| 1583 cookie_access_time < earliest_access_time_) | 1583 cookie_access_time < earliest_access_time_) |
| 1584 earliest_access_time_ = cookie_access_time; | 1584 earliest_access_time_ = cookie_access_time; |
| 1585 | 1585 |
| 1586 if (ContainsControlCharacter((*it)->Name()) || | 1586 if (ContainsControlCharacter((*it)->Name()) || |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2494 it != hook_map_.end(); ++it) { | 2494 it != hook_map_.end(); ++it) { |
| 2495 std::pair<GURL, std::string> key = it->first; | 2495 std::pair<GURL, std::string> key = it->first; |
| 2496 if (cookie.IncludeForRequestURL(key.first, opts) && | 2496 if (cookie.IncludeForRequestURL(key.first, opts) && |
| 2497 cookie.Name() == key.second) { | 2497 cookie.Name() == key.second) { |
| 2498 it->second->Notify(cookie, removed); | 2498 it->second->Notify(cookie, removed); |
| 2499 } | 2499 } |
| 2500 } | 2500 } |
| 2501 } | 2501 } |
| 2502 | 2502 |
| 2503 } // namespace net | 2503 } // namespace net |
| OLD | NEW |