blob: 570d156086f763c03f11938aea1e12073f824a9c [file] [log] [blame]
// Copyright 2015 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.
#import "ios/web/public/origin_util.h"
#include "base/stl_util.h"
#include "net/base/url_util.h"
#include "url/gurl.h"
#include "url/url_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
namespace web {
bool IsOriginSecure(const GURL& url) {
if (url.SchemeIsCryptographic() || url.SchemeIsFile())
return true;
if (url.SchemeIsFileSystem() && url.inner_url() &&
IsOriginSecure(*url.inner_url())) {
return true;
if (base::ContainsValue(url::GetSecureSchemes(), url.scheme()))
return true;
if (net::IsLocalhost(url))
return true;
return false;
} // namespace web