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

Unified Diff: android_webview/browser/aw_cookie_access_policy.cc

Issue 2397393002: Provide child/frame IDs for WebSocket handshake request (Closed)
Patch Set: fix Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/BUILD.gn » ('j') | content/browser/websockets/websocket_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/aw_cookie_access_policy.cc
diff --git a/android_webview/browser/aw_cookie_access_policy.cc b/android_webview/browser/aw_cookie_access_policy.cc
index 1dc3ba979a8d3cc3630ba83094c3a5f5fb291ad4..0419e1d829384fc2933cf436afef3c0e0727ac9e 100644
--- a/android_webview/browser/aw_cookie_access_policy.cc
+++ b/android_webview/browser/aw_cookie_access_policy.cc
@@ -10,11 +10,13 @@
#include "base/logging.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/resource_request_info.h"
+#include "content/public/browser/websocket_handshake_request_info.h"
#include "net/base/net_errors.h"
using base::AutoLock;
using content::BrowserThread;
using content::ResourceRequestInfo;
+using content::WebSocketHandshakeRequestInfo;
using net::StaticCookiePolicy;
namespace android_webview {
@@ -57,12 +59,26 @@ bool AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies(
bool AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies(
const net::URLRequest& request) {
+ bool has_id = false;
+ int child_id = 0;
+ int frame_id = 0;
const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(&request);
- if (!info) {
- return false;
+ if (info) {
+ has_id = true;
+ child_id = info->GetChildID();
+ frame_id = info->GetRenderFrameID();
+ } else {
+ const WebSocketHandshakeRequestInfo* websocketInfo =
Adam Rice 2016/10/12 06:38:25 s/websocketInfo/websocket_info/?
yhirano 2016/10/12 10:47:15 Done.
+ WebSocketHandshakeRequestInfo::ForRequest(&request);
+ if (websocketInfo) {
Adam Rice 2016/10/12 06:38:25 Maybe instead write if (!websocket_info) return
yhirano 2016/10/12 10:47:15 Done.
+ has_id = true;
+ child_id = websocketInfo->GetChildId();
+ frame_id = websocketInfo->GetFrameId();
+ }
}
- return GetShouldAcceptThirdPartyCookies(info->GetChildID(),
- info->GetRenderFrameID());
+ if (!has_id)
+ return false;
+ return GetShouldAcceptThirdPartyCookies(child_id, frame_id);
}
bool AwCookieAccessPolicy::OnCanGetCookies(const net::URLRequest& request,
« no previous file with comments | « no previous file | content/browser/BUILD.gn » ('j') | content/browser/websockets/websocket_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698