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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 | 771 |
772 private: | 772 private: |
773 GURL url_; | 773 GURL url_; |
774 CookieOptions options_; | 774 CookieOptions options_; |
775 GetCookiesCallback callback_; | 775 GetCookiesCallback callback_; |
776 | 776 |
777 DISALLOW_COPY_AND_ASSIGN(GetCookiesWithOptionsTask); | 777 DISALLOW_COPY_AND_ASSIGN(GetCookiesWithOptionsTask); |
778 }; | 778 }; |
779 | 779 |
780 void CookieMonster::GetCookiesWithOptionsTask::Run() { | 780 void CookieMonster::GetCookiesWithOptionsTask::Run() { |
781 // TODO(mkwst): Remove ScopedTracker below once crbug.com/456373 is fixed. | |
782 tracked_objects::ScopedTracker tracking_profile( | |
783 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
784 "456373 CookieMonster::GetCookiesWithOptionsTask::Run")); | |
785 std::string cookie = | 781 std::string cookie = |
786 this->cookie_monster()->GetCookiesWithOptions(url_, options_); | 782 this->cookie_monster()->GetCookiesWithOptions(url_, options_); |
787 if (!callback_.is_null()) | 783 if (!callback_.is_null()) |
788 callback_.Run(cookie); | 784 callback_.Run(cookie); |
789 } | 785 } |
790 | 786 |
791 // Task class for DeleteCookie call. | 787 // Task class for DeleteCookie call. |
792 class CookieMonster::DeleteCookieTask : public DeleteTask<void> { | 788 class CookieMonster::DeleteCookieTask : public DeleteTask<void> { |
793 public: | 789 public: |
794 DeleteCookieTask(CookieMonster* cookie_monster, | 790 DeleteCookieTask(CookieMonster* cookie_monster, |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 return skipped_httponly || skipped_secure_cookie; | 1672 return skipped_httponly || skipped_secure_cookie; |
1677 } | 1673 } |
1678 | 1674 |
1679 CookieMonster::CookieMap::iterator CookieMonster::InternalInsertCookie( | 1675 CookieMonster::CookieMap::iterator CookieMonster::InternalInsertCookie( |
1680 const std::string& key, | 1676 const std::string& key, |
1681 CanonicalCookie* cc, | 1677 CanonicalCookie* cc, |
1682 const GURL& source_url, | 1678 const GURL& source_url, |
1683 bool sync_to_store) { | 1679 bool sync_to_store) { |
1684 DCHECK(thread_checker_.CalledOnValidThread()); | 1680 DCHECK(thread_checker_.CalledOnValidThread()); |
1685 | 1681 |
1686 // TODO(mkwst): Remove ScopedTracker below once crbug.com/456373 is fixed. | |
1687 tracked_objects::ScopedTracker tracking_profile( | |
1688 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
1689 "456373 CookieMonster::InternalInsertCookie")); | |
1690 | |
1691 if ((cc->IsPersistent() || persist_session_cookies_) && store_.get() && | 1682 if ((cc->IsPersistent() || persist_session_cookies_) && store_.get() && |
1692 sync_to_store) | 1683 sync_to_store) |
1693 store_->AddCookie(*cc); | 1684 store_->AddCookie(*cc); |
1694 CookieMap::iterator inserted = | 1685 CookieMap::iterator inserted = |
1695 cookies_.insert(CookieMap::value_type(key, cc)); | 1686 cookies_.insert(CookieMap::value_type(key, cc)); |
1696 if (delegate_.get()) { | 1687 if (delegate_.get()) { |
1697 delegate_->OnCookieChanged(*cc, false, | 1688 delegate_->OnCookieChanged(*cc, false, |
1698 CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT); | 1689 CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT); |
1699 } | 1690 } |
1700 | 1691 |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2399 it != hook_map_.end(); ++it) { | 2390 it != hook_map_.end(); ++it) { |
2400 std::pair<GURL, std::string> key = it->first; | 2391 std::pair<GURL, std::string> key = it->first; |
2401 if (cookie.IncludeForRequestURL(key.first, opts) && | 2392 if (cookie.IncludeForRequestURL(key.first, opts) && |
2402 cookie.Name() == key.second) { | 2393 cookie.Name() == key.second) { |
2403 it->second->Notify(cookie, removed); | 2394 it->second->Notify(cookie, removed); |
2404 } | 2395 } |
2405 } | 2396 } |
2406 } | 2397 } |
2407 | 2398 |
2408 } // namespace net | 2399 } // namespace net |
OLD | NEW |