Move content/network to services/network.

https://chromium-review.googlesource.com/891646
This commit is contained in:
deepak1556 2018-04-08 23:02:24 +05:30 committed by Samuel Attard
parent fba2ab0996
commit 806acbdf12
5 changed files with 21 additions and 20 deletions

View file

@ -47,6 +47,7 @@
#include "native_mate/object_template_builder.h" #include "native_mate/object_template_builder.h"
#include "net/ssl/client_cert_identity.h" #include "net/ssl/client_cert_identity.h"
#include "net/ssl/ssl_cert_request_info.h" #include "net/ssl/ssl_cert_request_info.h"
#include "services/network/public/cpp/network_switches.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
@ -1304,7 +1305,7 @@ void AppendSwitch(const std::string& switch_string, mate::Arguments* args) {
if (base::EndsWith(switch_string, "-path", if (base::EndsWith(switch_string, "-path",
base::CompareCase::INSENSITIVE_ASCII) || base::CompareCase::INSENSITIVE_ASCII) ||
switch_string == switches::kLogNetLog) { switch_string == network::switches::kLogNetLog) {
base::FilePath path; base::FilePath path;
args->GetNext(&path); args->GetNext(&path);
command_line->AppendSwitchPath(switch_string, path); command_line->AppendSwitchPath(switch_string, path);

View file

@ -34,8 +34,6 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "content/network/throttling/network_conditions.h"
#include "content/network/throttling/throttling_controller.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_manager_delegate.h" #include "content/public/browser/download_manager_delegate.h"
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
@ -51,6 +49,8 @@
#include "net/url_request/static_http_user_agent_settings.h" #include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_context_getter.h"
#include "services/network/throttling/network_conditions.h"
#include "services/network/throttling/throttling_controller.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
using atom::api::Cookies; using atom::api::Cookies;
@ -576,20 +576,20 @@ void Session::SetDownloadPath(const base::FilePath& path) {
} }
void Session::EnableNetworkEmulation(const mate::Dictionary& options) { void Session::EnableNetworkEmulation(const mate::Dictionary& options) {
std::unique_ptr<content::NetworkConditions> conditions; std::unique_ptr<network::NetworkConditions> conditions;
bool offline = false; bool offline = false;
double latency = 0.0, download_throughput = 0.0, upload_throughput = 0.0; double latency = 0.0, download_throughput = 0.0, upload_throughput = 0.0;
if (options.Get("offline", &offline) && offline) { if (options.Get("offline", &offline) && offline) {
conditions.reset(new content::NetworkConditions(offline)); conditions.reset(new network::NetworkConditions(offline));
} else { } else {
options.Get("latency", &latency); options.Get("latency", &latency);
options.Get("downloadThroughput", &download_throughput); options.Get("downloadThroughput", &download_throughput);
options.Get("uploadThroughput", &upload_throughput); options.Get("uploadThroughput", &upload_throughput);
conditions.reset(new content::NetworkConditions( conditions.reset(new network::NetworkConditions(
false, latency, download_throughput, upload_throughput)); false, latency, download_throughput, upload_throughput));
} }
content::ThrottlingController::SetConditions( network::ThrottlingController::SetConditions(
devtools_network_emulation_client_id_, std::move(conditions)); devtools_network_emulation_client_id_, std::move(conditions));
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE, BrowserThread::IO, FROM_HERE,
@ -600,8 +600,8 @@ void Session::EnableNetworkEmulation(const mate::Dictionary& options) {
} }
void Session::DisableNetworkEmulation() { void Session::DisableNetworkEmulation() {
auto conditions = std::make_unique<content::NetworkConditions>(); auto conditions = std::make_unique<network::NetworkConditions>();
content::ThrottlingController::SetConditions( network::ThrottlingController::SetConditions(
devtools_network_emulation_client_id_, std::move(conditions)); devtools_network_emulation_client_id_, std::move(conditions));
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE, BrowserThread::IO, FROM_HERE,

View file

@ -10,13 +10,13 @@
#include "atom/common/native_mate_converters/net_converter.h" #include "atom/common/native_mate_converters/net_converter.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "content/common/devtools/devtools_network_transaction.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
#include "services/network/throttling/throttling_network_transaction.h"
using content::BrowserThread; using content::BrowserThread;
using content::DevToolsNetworkTransaction; using network::ThrottlingNetworkTransaction;
namespace atom { namespace atom {
@ -274,7 +274,7 @@ int AtomNetworkDelegate::OnBeforeStartTransaction(
const net::CompletionCallback& callback, const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) { net::HttpRequestHeaders* headers) {
if (!client_id_.empty()) if (!client_id_.empty())
headers->SetHeader(content::DevToolsNetworkTransaction:: headers->SetHeader(network::ThrottlingNetworkTransaction::
kDevToolsEmulateNetworkConditionsClientId, kDevToolsEmulateNetworkConditionsClientId,
client_id_); client_id_);
if (!base::ContainsKey(response_listeners_, kOnBeforeSendHeaders)) if (!base::ContainsKey(response_listeners_, kOnBeforeSendHeaders))

View file

@ -9,9 +9,9 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/values.h" #include "base/values.h"
#include "content/public/common/content_switches.h"
#include "net/log/file_net_log_observer.h" #include "net/log/file_net_log_observer.h"
#include "net/log/net_log_util.h" #include "net/log/net_log_util.h"
#include "services/network/public/cpp/network_switches.h"
namespace brightray { namespace brightray {
@ -41,11 +41,11 @@ NetLog::~NetLog() {
void NetLog::StartLogging() { void NetLog::StartLogging() {
auto* command_line = base::CommandLine::ForCurrentProcess(); auto* command_line = base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kLogNetLog)) if (!command_line->HasSwitch(network::switches::kLogNetLog))
return; return;
base::FilePath log_path; base::FilePath log_path =
log_path = command_line->GetSwitchValuePath(switches::kLogNetLog); command_line->GetSwitchValuePath(switches::kLogNetLog);
if (log_path.empty()) if (log_path.empty())
return; return;

View file

@ -20,7 +20,6 @@
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_store_factory.h" #include "content/public/browser/cookie_store_factory.h"
#include "content/public/browser/devtools_network_transaction_factory.h" #include "content/public/browser/devtools_network_transaction_factory.h"
#include "content/public/common/content_switches.h"
#include "net/base/host_mapping_rules.h" #include "net/base/host_mapping_rules.h"
#include "net/cert/cert_verifier.h" #include "net/cert/cert_verifier.h"
#include "net/cert/ct_known_logs.h" #include "net/cert/ct_known_logs.h"
@ -50,6 +49,7 @@
#include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_context_storage.h"
#include "net/url_request/url_request_intercepting_job_factory.h" #include "net/url_request/url_request_intercepting_job_factory.h"
#include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_job_factory_impl.h"
#include "services/network/public/cpp/network_switches.h"
#include "storage/browser/quota/special_storage_policy.h" #include "storage/browser/quota/special_storage_policy.h"
#include "url/url_constants.h" #include "url/url_constants.h"
@ -239,11 +239,11 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
net::HostResolver::CreateDefaultResolver(nullptr)); net::HostResolver::CreateDefaultResolver(nullptr));
// --host-resolver-rules // --host-resolver-rules
if (command_line.HasSwitch(::switches::kHostResolverRules)) { if (command_line.HasSwitch(network::switches::kHostResolverRules)) {
std::unique_ptr<net::MappedHostResolver> remapped_resolver( std::unique_ptr<net::MappedHostResolver> remapped_resolver(
new net::MappedHostResolver(std::move(host_resolver))); new net::MappedHostResolver(std::move(host_resolver)));
remapped_resolver->SetRulesFromString( remapped_resolver->SetRulesFromString(command_line.GetSwitchValueASCII(
command_line.GetSwitchValueASCII(::switches::kHostResolverRules)); network::switches::kHostResolverRules));
host_resolver = std::move(remapped_resolver); host_resolver = std::move(remapped_resolver);
} }