summaryrefslogtreecommitdiffstats
path: root/url/origin.cc
diff options
context:
space:
mode:
authoryhirano@chromium.org <yhirano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-13 10:22:57 +0000
committeryhirano@chromium.org <yhirano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-13 10:22:57 +0000
commit7824cf82df8244b5f66a56e663ce6e121c25de88 (patch)
tree3a2908a3687bc00a80d2ca49b7324ce3cd71c088 /url/origin.cc
parented8fd9152e0dff6c26f69f968e0d4aa4bd890d57 (diff)
downloadchromium_src-7824cf82df8244b5f66a56e663ce6e121c25de88.zip
chromium_src-7824cf82df8244b5f66a56e663ce6e121c25de88.tar.gz
chromium_src-7824cf82df8244b5f66a56e663ce6e121c25de88.tar.bz2
Introduce url::Origin to represent Web Origin.
Introduce url::Origin to represent a serialized Web Origin defined in RFC6455. This class wraps a string representation of blink-side SecurityOrigin object. BUG=339373 R=tyoshino@chromium.org, ricea@chromium.org Review URL: https://codereview.chromium.org/170843007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256789 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'url/origin.cc')
-rw-r--r--url/origin.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/url/origin.cc b/url/origin.cc
new file mode 100644
index 0000000..eb2cf14
--- /dev/null
+++ b/url/origin.cc
@@ -0,0 +1,19 @@
+// 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.
+
+#include "url/origin.h"
+
+#include "base/strings/string_util.h"
+
+namespace url {
+
+Origin::Origin() : string_("null") {}
+
+Origin::Origin(const std::string& origin) : string_(origin) {
+ DCHECK(origin == "null" || MatchPattern(origin, "?*://?*"));
+ DCHECK_GT(origin.size(), 0u);
+ DCHECK_NE(origin[origin.size() - 1], '/');
+}
+
+} // namespace url