| 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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 private: | 759 private: |
| 760 GURL url_; | 760 GURL url_; |
| 761 std::string cookie_line_; | 761 std::string cookie_line_; |
| 762 CookieOptions options_; | 762 CookieOptions options_; |
| 763 SetCookiesCallback callback_; | 763 SetCookiesCallback callback_; |
| 764 | 764 |
| 765 DISALLOW_COPY_AND_ASSIGN(SetCookieWithOptionsTask); | 765 DISALLOW_COPY_AND_ASSIGN(SetCookieWithOptionsTask); |
| 766 }; | 766 }; |
| 767 | 767 |
| 768 void CookieMonster::SetCookieWithOptionsTask::Run() { | 768 void CookieMonster::SetCookieWithOptionsTask::Run() { |
| 769 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456373 is fixed. | |
| 770 tracked_objects::ScopedTracker tracking_profile( | |
| 771 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 772 "456373 CookieMonster::SetCookieWithOptionsTask::Run")); | |
| 773 bool result = this->cookie_monster()->SetCookieWithOptions(url_, cookie_line_, | 769 bool result = this->cookie_monster()->SetCookieWithOptions(url_, cookie_line_, |
| 774 options_); | 770 options_); |
| 775 if (!callback_.is_null()) { | 771 if (!callback_.is_null()) { |
| 776 this->InvokeCallback(base::Bind(&SetCookiesCallback::Run, | 772 this->InvokeCallback(base::Bind(&SetCookiesCallback::Run, |
| 777 base::Unretained(&callback_), result)); | 773 base::Unretained(&callback_), result)); |
| 778 } | 774 } |
| 779 } | 775 } |
| 780 | 776 |
| 781 // Task class for SetAllCookies call. | 777 // Task class for SetAllCookies call. |
| 782 class CookieMonster::SetAllCookiesTask : public CookieMonsterTask { | 778 class CookieMonster::SetAllCookiesTask : public CookieMonsterTask { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 | 837 |
| 842 private: | 838 private: |
| 843 GURL url_; | 839 GURL url_; |
| 844 CookieOptions options_; | 840 CookieOptions options_; |
| 845 GetCookiesCallback callback_; | 841 GetCookiesCallback callback_; |
| 846 | 842 |
| 847 DISALLOW_COPY_AND_ASSIGN(GetCookiesWithOptionsTask); | 843 DISALLOW_COPY_AND_ASSIGN(GetCookiesWithOptionsTask); |
| 848 }; | 844 }; |
| 849 | 845 |
| 850 void CookieMonster::GetCookiesWithOptionsTask::Run() { | 846 void CookieMonster::GetCookiesWithOptionsTask::Run() { |
| 851 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456373 is fixed. | 847 // TODO(mkwst): Remove ScopedTracker below once crbug.com/456373 is fixed. |
| 852 tracked_objects::ScopedTracker tracking_profile( | 848 tracked_objects::ScopedTracker tracking_profile( |
| 853 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 849 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 854 "456373 CookieMonster::GetCookiesWithOptionsTask::Run")); | 850 "456373 CookieMonster::GetCookiesWithOptionsTask::Run")); |
| 855 std::string cookie = | 851 std::string cookie = |
| 856 this->cookie_monster()->GetCookiesWithOptions(url_, options_); | 852 this->cookie_monster()->GetCookiesWithOptions(url_, options_); |
| 857 if (!callback_.is_null()) { | 853 if (!callback_.is_null()) { |
| 858 this->InvokeCallback(base::Bind(&GetCookiesCallback::Run, | 854 this->InvokeCallback(base::Bind(&GetCookiesCallback::Run, |
| 859 base::Unretained(&callback_), cookie)); | 855 base::Unretained(&callback_), cookie)); |
| 860 } | 856 } |
| 861 } | 857 } |
| (...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 found_equivalent_cookie = true; | 1801 found_equivalent_cookie = true; |
| 1806 } | 1802 } |
| 1807 } | 1803 } |
| 1808 return skipped_httponly; | 1804 return skipped_httponly; |
| 1809 } | 1805 } |
| 1810 | 1806 |
| 1811 CookieMonster::CookieMap::iterator CookieMonster::InternalInsertCookie( | 1807 CookieMonster::CookieMap::iterator CookieMonster::InternalInsertCookie( |
| 1812 const std::string& key, | 1808 const std::string& key, |
| 1813 CanonicalCookie* cc, | 1809 CanonicalCookie* cc, |
| 1814 bool sync_to_store) { | 1810 bool sync_to_store) { |
| 1815 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456373 is fixed. | 1811 // TODO(mkwst): Remove ScopedTracker below once crbug.com/456373 is fixed. |
| 1816 tracked_objects::ScopedTracker tracking_profile( | 1812 tracked_objects::ScopedTracker tracking_profile( |
| 1817 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 1813 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1818 "456373 CookieMonster::InternalInsertCookie")); | 1814 "456373 CookieMonster::InternalInsertCookie")); |
| 1819 lock_.AssertAcquired(); | 1815 lock_.AssertAcquired(); |
| 1820 | 1816 |
| 1821 if ((cc->IsPersistent() || persist_session_cookies_) && store_.get() && | 1817 if ((cc->IsPersistent() || persist_session_cookies_) && store_.get() && |
| 1822 sync_to_store) | 1818 sync_to_store) |
| 1823 store_->AddCookie(*cc); | 1819 store_->AddCookie(*cc); |
| 1824 CookieMap::iterator inserted = | 1820 CookieMap::iterator inserted = |
| 1825 cookies_.insert(CookieMap::value_type(key, cc)); | 1821 cookies_.insert(CookieMap::value_type(key, cc)); |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2383 it != hook_map_.end(); ++it) { | 2379 it != hook_map_.end(); ++it) { |
| 2384 std::pair<GURL, std::string> key = it->first; | 2380 std::pair<GURL, std::string> key = it->first; |
| 2385 if (cookie.IncludeForRequestURL(key.first, opts) && | 2381 if (cookie.IncludeForRequestURL(key.first, opts) && |
| 2386 cookie.Name() == key.second) { | 2382 cookie.Name() == key.second) { |
| 2387 it->second->Notify(cookie, removed); | 2383 it->second->Notify(cookie, removed); |
| 2388 } | 2384 } |
| 2389 } | 2385 } |
| 2390 } | 2386 } |
| 2391 | 2387 |
| 2392 } // namespace net | 2388 } // namespace net |
| OLD | NEW |