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

Unified Diff: public/platform/WebSerializedOrigin.h

Issue 201593002: Add WebSerializedOrigin to represent a serialized Web Origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/exported/WebSerializedOrigin.cpp ('k') | public/platform/WebSocketHandle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/WebSerializedOrigin.h
diff --git a/public/platform/WebSerializedOrigin.h b/public/platform/WebSerializedOrigin.h
new file mode 100644
index 0000000000000000000000000000000000000000..0e01ae4cca0e0f2e6c9eec9f9a32de98d7084a1b
--- /dev/null
+++ b/public/platform/WebSerializedOrigin.h
@@ -0,0 +1,40 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WebSerializedOrigin_h
+#define WebSerializedOrigin_h
+
+#include "WebString.h"
+
+#if INSIDE_BLINK
+namespace WebCore { class SecurityOrigin; }
+#else
+#include <url/origin.h>
+#endif
+
+namespace blink {
+
+// WebSerializedOrigin represents a serialized Web Origin specified in RFC6454.
+class WebSerializedOrigin {
+public:
+ WebSerializedOrigin() : m_string("null") { }
+#if INSIDE_BLINK
+ BLINK_PLATFORM_EXPORT WebSerializedOrigin(const WebCore::SecurityOrigin&);
+#else
+ WebSerializedOrigin(const url::Origin& origin) : m_string(WebString::fromUTF8(origin.string())) { }
+ operator url::Origin() const { return url::Origin(m_string.utf8()); }
+#endif
+
+ const WebString& string() const
+ {
+ return m_string;
+ }
+
+private:
+ const WebString m_string;
+};
+
+} // namespace blink
+
+#endif // #ifndef SerializedOrigin_h
« no previous file with comments | « Source/platform/exported/WebSerializedOrigin.cpp ('k') | public/platform/WebSocketHandle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698