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

Side by Side Diff: third_party/WebKit/public/platform/WebSecurityOrigin.h

Issue 2391383003: Add Origin::CreateFromNormalizedTuple and call from WebSecurityOrigin (Closed)
Patch Set: git cl format 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
« no previous file with comments | « content/child/blink_platform_impl_unittest.cc ('k') | url/origin.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 BLINK_PLATFORM_EXPORT WebSecurityOrigin& operator=( 113 BLINK_PLATFORM_EXPORT WebSecurityOrigin& operator=(
114 WTF::PassRefPtr<SecurityOrigin>); 114 WTF::PassRefPtr<SecurityOrigin>);
115 BLINK_PLATFORM_EXPORT operator WTF::PassRefPtr<SecurityOrigin>() const; 115 BLINK_PLATFORM_EXPORT operator WTF::PassRefPtr<SecurityOrigin>() const;
116 BLINK_PLATFORM_EXPORT SecurityOrigin* get() const; 116 BLINK_PLATFORM_EXPORT SecurityOrigin* get() const;
117 #else 117 #else
118 // TODO(mkwst): A number of properties don't survive a round-trip 118 // TODO(mkwst): A number of properties don't survive a round-trip
119 // ('document.domain', for instance). We'll need to fix that for OOPI-enabled 119 // ('document.domain', for instance). We'll need to fix that for OOPI-enabled
120 // embedders, https://crbug.com/490074. 120 // embedders, https://crbug.com/490074.
121 operator url::Origin() const { 121 operator url::Origin() const {
122 return isUnique() ? url::Origin() 122 return isUnique() ? url::Origin()
123 : url::Origin::UnsafelyCreateOriginWithoutNormalization( 123 : url::Origin::CreateFromNormalizedTuple(
124 protocol().utf8(), host().utf8(), effectivePort()); 124 protocol().utf8(), host().utf8(), effectivePort());
125 } 125 }
126 126
127 WebSecurityOrigin(const url::Origin& origin) : m_private(0) { 127 WebSecurityOrigin(const url::Origin& origin) : m_private(0) {
128 if (origin.unique()) { 128 if (origin.unique()) {
129 assign(WebSecurityOrigin::createUnique()); 129 assign(WebSecurityOrigin::createUnique());
130 return; 130 return;
131 } 131 }
132 132
133 // TODO(mkwst): This might open up issues by double-canonicalizing the host. 133 // TODO(mkwst): This might open up issues by double-canonicalizing the host.
134 assign(WebSecurityOrigin::createFromTuple( 134 assign(WebSecurityOrigin::createFromTuple(
135 WebString::fromUTF8(origin.scheme()), 135 WebString::fromUTF8(origin.scheme()),
136 WebString::fromUTF8(origin.host()), origin.port())); 136 WebString::fromUTF8(origin.host()), origin.port()));
137 } 137 }
138 #endif 138 #endif
139 139
140 private: 140 private:
141 // Present only to facilitate conversion from 'url::Origin'; this constructor 141 // Present only to facilitate conversion from 'url::Origin'; this constructor
142 // shouldn't be used anywhere else. 142 // shouldn't be used anywhere else.
143 BLINK_PLATFORM_EXPORT static WebSecurityOrigin 143 BLINK_PLATFORM_EXPORT static WebSecurityOrigin
144 createFromTuple(const WebString& protocol, const WebString& host, int port); 144 createFromTuple(const WebString& protocol, const WebString& host, int port);
145 145
146 void assign(WebSecurityOriginPrivate*); 146 void assign(WebSecurityOriginPrivate*);
147 WebSecurityOriginPrivate* m_private; 147 WebSecurityOriginPrivate* m_private;
148 }; 148 };
149 149
150 } // namespace blink 150 } // namespace blink
151 151
152 #endif 152 #endif
OLDNEW
« no previous file with comments | « content/child/blink_platform_impl_unittest.cc ('k') | url/origin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698