Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: net/cookies/cookie_monster.cc

Issue 1413623002: Convert 'CookieOptions::first_party_url' to a 'url::Origin'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
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"
66 #include "net/cookies/cookie_util.h" 66 #include "net/cookies/cookie_util.h"
67 #include "net/cookies/parsed_cookie.h" 67 #include "net/cookies/parsed_cookie.h"
68 #include "url/origin.h"
68 69
69 using base::Time; 70 using base::Time;
70 using base::TimeDelta; 71 using base::TimeDelta;
71 using base::TimeTicks; 72 using base::TimeTicks;
72 73
73 // In steady state, most cookie requests can be satisfied by the in memory 74 // In steady state, most cookie requests can be satisfied by the in memory
74 // cookie monster store. If the cookie request cannot be satisfied by the in 75 // cookie monster store. If the cookie request cannot be satisfied by the in
75 // memory store, the relevant cookies must be fetched from the persistent 76 // memory store, the relevant cookies must be fetched from the persistent
76 // store. The task is queued in CookieMonster::tasks_pending_ if it requires 77 // store. The task is queued in CookieMonster::tasks_pending_ if it requires
77 // all cookies to be loaded from the backend, or tasks_pending_for_key_ if it 78 // all cookies to be loaded from the backend, or tasks_pending_for_key_ if it
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 for (std::vector<CanonicalCookie*>::const_iterator it = cookie_ptrs.begin(); 1198 for (std::vector<CanonicalCookie*>::const_iterator it = cookie_ptrs.begin();
1198 it != cookie_ptrs.end(); it++) 1199 it != cookie_ptrs.end(); it++)
1199 cookies.push_back(**it); 1200 cookies.push_back(**it);
1200 1201
1201 return cookies; 1202 return cookies;
1202 } 1203 }
1203 1204
1204 CookieList CookieMonster::GetAllCookiesForURL(const GURL& url) { 1205 CookieList CookieMonster::GetAllCookiesForURL(const GURL& url) {
1205 CookieOptions options; 1206 CookieOptions options;
1206 options.set_include_httponly(); 1207 options.set_include_httponly();
1207 options.set_first_party_url(url); 1208 options.set_first_party(url::Origin(url));
1208 1209
1209 return GetAllCookiesForURLWithOptions(url, options); 1210 return GetAllCookiesForURLWithOptions(url, options);
1210 } 1211 }
1211 1212
1212 int CookieMonster::DeleteAll(bool sync_to_store) { 1213 int CookieMonster::DeleteAll(bool sync_to_store) {
1213 base::AutoLock autolock(lock_); 1214 base::AutoLock autolock(lock_);
1214 1215
1215 int num_deleted = 0; 1216 int num_deleted = 0;
1216 for (CookieMap::iterator it = cookies_.begin(); it != cookies_.end();) { 1217 for (CookieMap::iterator it = cookies_.begin(); it != cookies_.end();) {
1217 CookieMap::iterator curit = it; 1218 CookieMap::iterator curit = it;
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 it != hook_map_.end(); ++it) { 2356 it != hook_map_.end(); ++it) {
2356 std::pair<GURL, std::string> key = it->first; 2357 std::pair<GURL, std::string> key = it->first;
2357 if (cookie.IncludeForRequestURL(key.first, opts) && 2358 if (cookie.IncludeForRequestURL(key.first, opts) &&
2358 cookie.Name() == key.second) { 2359 cookie.Name() == key.second) {
2359 it->second->Notify(cookie, removed); 2360 it->second->Notify(cookie, removed);
2360 } 2361 }
2361 } 2362 }
2362 } 2363 }
2363 2364
2364 } // namespace net 2365 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698