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

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 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-conversion.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 command_id)); 227 command_id));
228 return Response::OK(); 228 return Response::OK();
229 } 229 }
230 230
231 void NetworkHandler::SendGetCookiesResponse( 231 void NetworkHandler::SendGetCookiesResponse(
232 DevToolsCommandId command_id, 232 DevToolsCommandId command_id,
233 const net::CookieList& cookie_list) { 233 const net::CookieList& cookie_list) {
234 std::vector<scoped_refptr<Cookie>> cookies; 234 std::vector<scoped_refptr<Cookie>> cookies;
235 for (size_t i = 0; i < cookie_list.size(); ++i) { 235 for (size_t i = 0; i < cookie_list.size(); ++i) {
236 const net::CanonicalCookie& cookie = cookie_list[i]; 236 const net::CanonicalCookie& cookie = cookie_list[i];
237 cookies.push_back(Cookie::Create() 237 scoped_refptr<Cookie> devtools_cookie = Cookie::Create()
238 ->set_name(cookie.Name()) 238 ->set_name(cookie.Name())
239 ->set_value(cookie.Value()) 239 ->set_value(cookie.Value())
240 ->set_domain(cookie.Domain()) 240 ->set_domain(cookie.Domain())
241 ->set_path(cookie.Path()) 241 ->set_path(cookie.Path())
242 ->set_expires(cookie.ExpiryDate().ToDoubleT() * 1000) 242 ->set_expires(cookie.ExpiryDate().ToDoubleT() * 1000)
243 ->set_size(cookie.Name().length() + cookie.Value().length()) 243 ->set_size(cookie.Name().length() + cookie.Value().length())
244 ->set_http_only(cookie.IsHttpOnly()) 244 ->set_http_only(cookie.IsHttpOnly())
245 ->set_secure(cookie.IsSecure()) 245 ->set_secure(cookie.IsSecure())
246 ->set_session(!cookie.IsPersistent())); 246 ->set_session(!cookie.IsPersistent());
247
248 switch (cookie.SameSite()) {
249 case net::CookieSameSite::STRICT_MODE:
250 devtools_cookie->set_same_site(cookie::kSameSiteStrict);
251 break;
252 case net::CookieSameSite::LAX_MODE:
253 devtools_cookie->set_same_site(cookie::kSameSiteLax);
254 break;
255 case net::CookieSameSite::NO_RESTRICTION:
256 break;
257 }
258 cookies.push_back(devtools_cookie);
247 } 259 }
248 client_->SendGetCookiesResponse(command_id, 260 client_->SendGetCookiesResponse(command_id,
249 GetCookiesResponse::Create()->set_cookies(cookies)); 261 GetCookiesResponse::Create()->set_cookies(cookies));
250 } 262 }
251 263
252 Response NetworkHandler::DeleteCookie( 264 Response NetworkHandler::DeleteCookie(
253 DevToolsCommandId command_id, 265 DevToolsCommandId command_id,
254 const std::string& cookie_name, 266 const std::string& cookie_name,
255 const std::string& url) { 267 const std::string& url) {
256 if (!host_) 268 if (!host_)
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return Response::InternalError("Could not connect to view"); 330 return Response::InternalError("Could not connect to view");
319 WebContents* web_contents = WebContents::FromRenderFrameHost(host_); 331 WebContents* web_contents = WebContents::FromRenderFrameHost(host_);
320 web_contents->GetDelegate()->ShowCertificateViewerInDevTools( 332 web_contents->GetDelegate()->ShowCertificateViewerInDevTools(
321 web_contents, certificate_id); 333 web_contents, certificate_id);
322 return Response::OK(); 334 return Response::OK();
323 } 335 }
324 336
325 } // namespace network 337 } // namespace network
326 } // namespace devtools 338 } // namespace devtools
327 } // namespace content 339 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/resource-har-conversion.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698