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

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp

Issue 2378323003: Add url::Origin::GetURL() to convert Origins to URLs without reparsing (Closed)
Patch Set: propagate file:/// change to weborigin 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 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 String SecurityOrigin::toPhysicalOriginString() const { 425 String SecurityOrigin::toPhysicalOriginString() const {
426 if (isUnique()) 426 if (isUnique())
427 return "null"; 427 return "null";
428 if (isLocal() && m_blockLocalAccessFromLocalOrigin) 428 if (isLocal() && m_blockLocalAccessFromLocalOrigin)
429 return "null"; 429 return "null";
430 return toRawStringIgnoreSuborigin(); 430 return toRawStringIgnoreSuborigin();
431 } 431 }
432 432
433 String SecurityOrigin::toRawString() const { 433 String SecurityOrigin::toRawString() const {
434 if (m_protocol == "file") 434 if (m_protocol == "file")
435 return "file://"; 435 return "file:///";
436 436
437 StringBuilder result; 437 StringBuilder result;
438 buildRawString(result, true); 438 buildRawString(result, true);
439 return result.toString(); 439 return result.toString();
440 } 440 }
441 441
442 String SecurityOrigin::toRawStringIgnoreSuborigin() const { 442 String SecurityOrigin::toRawStringIgnoreSuborigin() const {
443 if (m_protocol == "file") 443 if (m_protocol == "file")
444 return "file://"; 444 return "file:///";
445 445
446 StringBuilder result; 446 StringBuilder result;
447 buildRawString(result, false); 447 buildRawString(result, false);
448 return result.toString(); 448 return result.toString();
449 } 449 }
450 450
451 // Returns true if and only if a suborigin component was found. If false, no 451 // Returns true if and only if a suborigin component was found. If false, no
452 // guarantees about the return value |suboriginName| are made. 452 // guarantees about the return value |suboriginName| are made.
453 bool SecurityOrigin::deserializeSuboriginAndProtocolAndHost( 453 bool SecurityOrigin::deserializeSuboriginAndProtocolAndHost(
454 const String& oldProtocol, 454 const String& oldProtocol,
(...skipping 20 matching lines...) Expand all
475 } 475 }
476 476
477 suboriginName = oldHost.substring(0, suboriginEnd); 477 suboriginName = oldHost.substring(0, suboriginEnd);
478 newHost = oldHost.substring(suboriginEnd + 1); 478 newHost = oldHost.substring(suboriginEnd + 1);
479 479
480 return true; 480 return true;
481 } 481 }
482 482
483 AtomicString SecurityOrigin::toRawAtomicString() const { 483 AtomicString SecurityOrigin::toRawAtomicString() const {
484 if (m_protocol == "file") 484 if (m_protocol == "file")
485 return AtomicString("file://"); 485 return AtomicString("file:///");
486 486
487 StringBuilder result; 487 StringBuilder result;
488 buildRawString(result, true); 488 buildRawString(result, true);
489 return result.toAtomicString(); 489 return result.toAtomicString();
490 } 490 }
491 491
492 void SecurityOrigin::buildRawString(StringBuilder& builder, 492 void SecurityOrigin::buildRawString(StringBuilder& builder,
493 bool includeSuborigin) const { 493 bool includeSuborigin) const {
494 builder.append(m_protocol); 494 builder.append(m_protocol);
495 if (includeSuborigin && hasSuborigin()) { 495 if (includeSuborigin && hasSuborigin()) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 privilegeData->m_blockLocalAccessFromLocalOrigin; 579 privilegeData->m_blockLocalAccessFromLocalOrigin;
580 } 580 }
581 581
582 void SecurityOrigin::setUniqueOriginIsPotentiallyTrustworthy( 582 void SecurityOrigin::setUniqueOriginIsPotentiallyTrustworthy(
583 bool isUniqueOriginPotentiallyTrustworthy) { 583 bool isUniqueOriginPotentiallyTrustworthy) {
584 ASSERT(!isUniqueOriginPotentiallyTrustworthy || isUnique()); 584 ASSERT(!isUniqueOriginPotentiallyTrustworthy || isUnique());
585 m_isUniqueOriginPotentiallyTrustworthy = isUniqueOriginPotentiallyTrustworthy; 585 m_isUniqueOriginPotentiallyTrustworthy = isUniqueOriginPotentiallyTrustworthy;
586 } 586 }
587 587
588 } // namespace blink 588 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698