Commit 7d25f813 authored by Takashi Toyoshima's avatar Takashi Toyoshima Committed by Commit Bot

OOR-CORS: remove unused network::cors::legacy

CORS support code for non network service code path existed
in the network::cors::legacy namespace, and mistakenly is left
even after the network service full launch.

This patch removes the network::cors::legacy,
//services/network/public/cpp/cors/cors_legacy.{cc|h}.

Bug: 1053866
Change-Id: Id03f49751d63dbe8fc1cac48161aa9c579d3ebe8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2552322
Auto-Submit: Takashi Toyoshima <toyoshim@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829637}
parent 4b419241
// Copyright 2018 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 "services/network/public/cpp/cors/cors_legacy.h"
#include <algorithm>
#include "url/gurl.h"
#include "url/url_util.h"
namespace {
std::vector<std::string>* secure_origins = nullptr;
} // namespace
namespace network {
namespace cors {
namespace legacy {
void RegisterSecureOrigins(const std::vector<std::string>& origins) {
delete secure_origins;
secure_origins = new std::vector<std::string>(origins.size());
std::copy(origins.begin(), origins.end(), secure_origins->begin());
}
const std::vector<std::string>& GetSecureOrigins() {
if (!secure_origins)
secure_origins = new std::vector<std::string>;
return *secure_origins;
}
} // namespace legacy
} // namespace cors
} // namespace network
// Copyright 2018 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 SERVICES_NETWORK_PUBLIC_CPP_CORS_CORS_LEGACY_H_
#define SERVICES_NETWORK_PUBLIC_CPP_CORS_CORS_LEGACY_H_
#include <string>
#include <vector>
#include "base/component_export.h"
namespace network {
namespace cors {
// Functions in namespace legacy are for legacy code path. Pure Network
// Service code should not use it. Since files in public/cpp/cors are shared
// between Network Service and legacy code path in content, but Network Service
// should not know content dependent concepts, we need to provide abstracted
// interfaces to implement extra checks for the case code runs in content.
//
// TODO(toyoshim): Remove all functions after Network Service is enabled.
namespace legacy {
// Registers allowlisted secure origins and hostname patterns for CORS checks in
// CorsURLLoader.
COMPONENT_EXPORT(NETWORK_CPP)
void RegisterSecureOrigins(const std::vector<std::string>& secure_origins);
// Refers the registered allowlisted secure origins and hostname patterns.
COMPONENT_EXPORT(NETWORK_CPP)
const std::vector<std::string>& GetSecureOrigins();
} // namespace legacy
} // namespace cors
} // namespace network
#endif // SERVICES_NETWORK_PUBLIC_CPP_CORS_CORS_LEGACY_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment