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

Side by Side Diff: content/browser/devtools/protocol/network_handler.cc

Issue 1827743002: SameSite: Teach devtools about the new 'samesite' syntax. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback+Rebase Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/browser/devtools/protocol/network_handler.h" 5 #include "content/browser/devtools/protocol/network_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 command_id)); 226 command_id));
227 return Response::OK(); 227 return Response::OK();
228 } 228 }
229 229
230 void NetworkHandler::SendGetCookiesResponse( 230 void NetworkHandler::SendGetCookiesResponse(
231 DevToolsCommandId command_id, 231 DevToolsCommandId command_id,
232 const net::CookieList& cookie_list) { 232 const net::CookieList& cookie_list) {
233 std::vector<scoped_refptr<Cookie>> cookies; 233 std::vector<scoped_refptr<Cookie>> cookies;
234 for (size_t i = 0; i < cookie_list.size(); ++i) { 234 for (size_t i = 0; i < cookie_list.size(); ++i) {
235 const net::CanonicalCookie& cookie = cookie_list[i]; 235 const net::CanonicalCookie& cookie = cookie_list[i];
236 std::string same_site;
237 switch (cookie.SameSite()) {
238 case net::CookieSameSite::NO_RESTRICTION:
239 same_site = "NoRestriction";
240 break;
241 case net::CookieSameSite::STRICT_MODE:
242 same_site = "Strict";
243 break;
244 case net::CookieSameSite::LAX_MODE:
245 same_site = "Lax";
246 break;
247 }
236 cookies.push_back(Cookie::Create() 248 cookies.push_back(Cookie::Create()
237 ->set_name(cookie.Name()) 249 ->set_name(cookie.Name())
238 ->set_value(cookie.Value()) 250 ->set_value(cookie.Value())
239 ->set_domain(cookie.Domain()) 251 ->set_domain(cookie.Domain())
240 ->set_path(cookie.Path()) 252 ->set_path(cookie.Path())
241 ->set_expires(cookie.ExpiryDate().ToDoubleT() * 1000) 253 ->set_expires(cookie.ExpiryDate().ToDoubleT() * 1000)
242 ->set_size(cookie.Name().length() + cookie.Value().length()) 254 ->set_size(cookie.Name().length() + cookie.Value().length())
243 ->set_http_only(cookie.IsHttpOnly()) 255 ->set_http_only(cookie.IsHttpOnly())
244 ->set_secure(cookie.IsSecure()) 256 ->set_secure(cookie.IsSecure())
245 ->set_session(!cookie.IsPersistent())); 257 ->set_session(!cookie.IsPersistent())
258 ->set_same_site(same_site));
pfeldman 2016/04/01 22:04:08 What is the value in case SameSite is not specifie
Mike West 2016/04/05 08:07:08 Done.
246 } 259 }
247 client_->SendGetCookiesResponse(command_id, 260 client_->SendGetCookiesResponse(command_id,
248 GetCookiesResponse::Create()->set_cookies(cookies)); 261 GetCookiesResponse::Create()->set_cookies(cookies));
249 } 262 }
250 263
251 Response NetworkHandler::DeleteCookie( 264 Response NetworkHandler::DeleteCookie(
252 DevToolsCommandId command_id, 265 DevToolsCommandId command_id,
253 const std::string& cookie_name, 266 const std::string& cookie_name,
254 const std::string& url) { 267 const std::string& url) {
255 if (!host_) 268 if (!host_)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return Response::InternalError("Could not connect to view"); 333 return Response::InternalError("Could not connect to view");
321 WebContents* web_contents = WebContents::FromRenderFrameHost(host_); 334 WebContents* web_contents = WebContents::FromRenderFrameHost(host_);
322 web_contents->GetDelegate()->ShowCertificateViewerInDevTools( 335 web_contents->GetDelegate()->ShowCertificateViewerInDevTools(
323 web_contents, certificate_id); 336 web_contents, certificate_id);
324 return Response::OK(); 337 return Response::OK();
325 } 338 }
326 339
327 } // namespace network 340 } // namespace network
328 } // namespace devtools 341 } // namespace devtools
329 } // namespace content 342 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698