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

Side by Side Diff: content/common/resource_messages.cc

Issue 2405483002: Make the request initiator Optional (Closed)
Patch Set: Introduce NullableOrigin to use for request initiator 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 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 #include "content/common/resource_messages.h" 5 #include "content/common/resource_messages.h"
6 6
7 #include "net/base/load_timing_info.h" 7 #include "net/base/load_timing_info.h"
8 #include "net/http/http_response_headers.h" 8 #include "net/http/http_response_headers.h"
9 9
10 namespace IPC { 10 namespace IPC {
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 *r = net::ct::SignedCertificateTimestamp::CreateFromPickle(iter); 473 *r = net::ct::SignedCertificateTimestamp::CreateFromPickle(iter);
474 return true; 474 return true;
475 } 475 }
476 476
477 void ParamTraits<scoped_refptr<net::ct::SignedCertificateTimestamp>>::Log( 477 void ParamTraits<scoped_refptr<net::ct::SignedCertificateTimestamp>>::Log(
478 const param_type& p, 478 const param_type& p,
479 std::string* l) { 479 std::string* l) {
480 l->append("<SignedCertificateTimestamp>"); 480 l->append("<SignedCertificateTimestamp>");
481 } 481 }
482 482
483 void ParamTraits<scoped_refptr<url::NullableOrigin>>::GetSize(
484 base::PickleSizer* s,
485 const param_type& p) {
486 GetParamSize(s, p.get() != NULL);
487 if (p.get()) {
488 GetParamSize(s, p->unique());
489 GetParamSize(s, p->scheme());
490 GetParamSize(s, p->host());
491 GetParamSize(s, p->port());
492 }
493 }
494
495 void ParamTraits<scoped_refptr<url::NullableOrigin>>::Write(
496 base::Pickle* m,
497 const param_type& p) {
498 WriteParam(m, p.get() != NULL);
499 if (p.get()) {
500 WriteParam(m, p->unique());
501 WriteParam(m, p->scheme());
502 WriteParam(m, p->host());
503 WriteParam(m, p->port());
504 }
505 }
506
507 bool ParamTraits<scoped_refptr<url::NullableOrigin>>::Read(
508 const base::Pickle* m,
509 base::PickleIterator* iter,
510 param_type* r) {
511 bool has_object;
512 if (!ReadParam(m, iter, &has_object))
513 return false;
514
515 if (!has_object)
516 return true;
517
518 bool unique;
519 std::string scheme;
520 std::string host;
521 uint16_t port;
522 if (!ReadParam(m, iter, &unique) || !ReadParam(m, iter, &scheme) ||
523 !ReadParam(m, iter, &host) || !ReadParam(m, iter, &port)) {
524 return false;
525 }
526
527 *r = unique ? new url::NullableOrigin(url::Origin())
528 : new url::NullableOrigin(
529 url::Origin::UnsafelyCreateOriginWithoutNormalization(
530 scheme, host, port));
531
532 // If a unique origin was created, but the unique flag wasn't set, then
533 // the values provided to 'UnsafelyCreateOriginWithoutNormalization' were
534 // invalid; kill the renderer.
535 if (!unique && (*r)->unique())
536 return false;
537
538 return true;
539 }
540
541 void ParamTraits<scoped_refptr<url::NullableOrigin>>::Log(const param_type& p,
542 std::string* l) {
543 l->append("<NullableOrigin>");
544 if (p.get())
545 l->append(p->Serialize());
546 }
547
483 } // namespace IPC 548 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698