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

Unified Diff: content/browser/frame_host/render_frame_message_filter.cc

Issue 1714013002: Load cookies once per 'document.cookie' read (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@reallyonce
Patch Set: FILE_PATH_LITERAL Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_message_filter_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_message_filter.cc
diff --git a/content/browser/frame_host/render_frame_message_filter.cc b/content/browser/frame_host/render_frame_message_filter.cc
index 0c60f979128b74471f5e6007ecd1b93c308bf2be..803ce426f4fd58617fe21657165e315d13ca83b6 100644
--- a/content/browser/frame_host/render_frame_message_filter.cc
+++ b/content/browser/frame_host/render_frame_message_filter.cc
@@ -21,6 +21,7 @@
#include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h"
#include "gpu/GLES2/gl2extchromium.h"
+#include "net/cookies/cookie_options.h"
#include "net/cookies/cookie_store.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
@@ -391,10 +392,13 @@ void RenderFrameMessageFilter::OnGetCookies(int render_frame_id,
base::debug::Alias(url_buf);
net::URLRequestContext* context = GetRequestContextForURL(url);
- context->cookie_store()->GetAllCookiesForURLAsync(
- url, base::Bind(&RenderFrameMessageFilter::CheckPolicyForCookies, this,
- render_frame_id, url, first_party_for_cookies,
- reply_msg));
+
+ net::CookieOptions options;
+ options.set_include_same_site();
+ context->cookie_store()->GetCookieListWithOptionsAsync(
+ url, options,
+ base::Bind(&RenderFrameMessageFilter::CheckPolicyForCookies, this,
+ render_frame_id, url, first_party_for_cookies, reply_msg));
}
void RenderFrameMessageFilter::OnCookiesEnabled(
@@ -423,11 +427,8 @@ void RenderFrameMessageFilter::CheckPolicyForCookies(
GetContentClient()->browser()->AllowGetCookie(
url, first_party_for_cookies, cookie_list, resource_context_,
render_process_id_, render_frame_id)) {
- // Gets the cookies from cookie store if allowed.
- context->cookie_store()->GetCookiesWithOptionsAsync(
- url, net::CookieOptions(),
- base::Bind(&RenderFrameMessageFilter::SendGetCookiesResponse,
- this, reply_msg));
+ SendGetCookiesResponse(reply_msg,
+ net::CookieStore::BuildCookieLine(cookie_list));
} else {
SendGetCookiesResponse(reply_msg, std::string());
}
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_message_filter_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698