blob: cebf5dd85f430e086709c7b2240a2b988f6f2ced [file] [log] [blame]
James Robinson27e97f02014-10-03 15:33:28 -07001// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "url/origin.h"
6
James Robinsona4a072d2016-01-28 14:31:21 -08007#include "base/logging.h"
8#include "base/strings/pattern.h"
James Robinson27e97f02014-10-03 15:33:28 -07009
10namespace url {
11
12Origin::Origin() : string_("null") {}
13
14Origin::Origin(const std::string& origin) : string_(origin) {
James Robinsona4a072d2016-01-28 14:31:21 -080015 DCHECK(origin == "null" || base::MatchPattern(origin, "?*://?*"));
James Robinson27e97f02014-10-03 15:33:28 -070016 DCHECK_GT(origin.size(), 0u);
James Robinson6e777532014-12-03 13:38:42 -080017 DCHECK(origin == "file://" || origin[origin.size() - 1] != '/');
James Robinson27e97f02014-10-03 15:33:28 -070018}
19
20} // namespace url