From 806acbdf1208034d71af8a47c9f116667ed4d305 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Sun, 8 Apr 2018 23:02:24 +0530 Subject: [PATCH] Move content/network to services/network. https://chromium-review.googlesource.com/891646 --- atom/browser/api/atom_api_app.cc | 3 ++- atom/browser/api/atom_api_session.cc | 16 ++++++++-------- atom/browser/net/atom_network_delegate.cc | 6 +++--- brightray/browser/net_log.cc | 8 ++++---- brightray/browser/url_request_context_getter.cc | 8 ++++---- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index f17cd2957671..675ba6d8cb5b 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -47,6 +47,7 @@ #include "native_mate/object_template_builder.h" #include "net/ssl/client_cert_identity.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/gfx/image/image.h" @@ -1304,7 +1305,7 @@ void AppendSwitch(const std::string& switch_string, mate::Arguments* args) { if (base::EndsWith(switch_string, "-path", base::CompareCase::INSENSITIVE_ASCII) || - switch_string == switches::kLogNetLog) { + switch_string == network::switches::kLogNetLog) { base::FilePath path; args->GetNext(&path); command_line->AppendSwitchPath(switch_string, path); diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index fd66b32308d1..27648c4d9c2f 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -34,8 +34,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/common/pref_names.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/download_manager_delegate.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/url_request_context.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" using atom::api::Cookies; @@ -576,20 +576,20 @@ void Session::SetDownloadPath(const base::FilePath& path) { } void Session::EnableNetworkEmulation(const mate::Dictionary& options) { - std::unique_ptr conditions; + std::unique_ptr conditions; bool offline = false; double latency = 0.0, download_throughput = 0.0, upload_throughput = 0.0; if (options.Get("offline", &offline) && offline) { - conditions.reset(new content::NetworkConditions(offline)); + conditions.reset(new network::NetworkConditions(offline)); } else { options.Get("latency", &latency); options.Get("downloadThroughput", &download_throughput); options.Get("uploadThroughput", &upload_throughput); - conditions.reset(new content::NetworkConditions( + conditions.reset(new network::NetworkConditions( false, latency, download_throughput, upload_throughput)); } - content::ThrottlingController::SetConditions( + network::ThrottlingController::SetConditions( devtools_network_emulation_client_id_, std::move(conditions)); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, @@ -600,8 +600,8 @@ void Session::EnableNetworkEmulation(const mate::Dictionary& options) { } void Session::DisableNetworkEmulation() { - auto conditions = std::make_unique(); - content::ThrottlingController::SetConditions( + auto conditions = std::make_unique(); + network::ThrottlingController::SetConditions( devtools_network_emulation_client_id_, std::move(conditions)); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, diff --git a/atom/browser/net/atom_network_delegate.cc b/atom/browser/net/atom_network_delegate.cc index e743e044ad62..05e52c491ea5 100644 --- a/atom/browser/net/atom_network_delegate.cc +++ b/atom/browser/net/atom_network_delegate.cc @@ -10,13 +10,13 @@ #include "atom/common/native_mate_converters/net_converter.h" #include "base/stl_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/render_frame_host.h" #include "net/url_request/url_request.h" +#include "services/network/throttling/throttling_network_transaction.h" using content::BrowserThread; -using content::DevToolsNetworkTransaction; +using network::ThrottlingNetworkTransaction; namespace atom { @@ -274,7 +274,7 @@ int AtomNetworkDelegate::OnBeforeStartTransaction( const net::CompletionCallback& callback, net::HttpRequestHeaders* headers) { if (!client_id_.empty()) - headers->SetHeader(content::DevToolsNetworkTransaction:: + headers->SetHeader(network::ThrottlingNetworkTransaction:: kDevToolsEmulateNetworkConditionsClientId, client_id_); if (!base::ContainsKey(response_listeners_, kOnBeforeSendHeaders)) diff --git a/brightray/browser/net_log.cc b/brightray/browser/net_log.cc index c02237a70323..6129f3e41000 100644 --- a/brightray/browser/net_log.cc +++ b/brightray/browser/net_log.cc @@ -9,9 +9,9 @@ #include "base/command_line.h" #include "base/files/file_path.h" #include "base/values.h" -#include "content/public/common/content_switches.h" #include "net/log/file_net_log_observer.h" #include "net/log/net_log_util.h" +#include "services/network/public/cpp/network_switches.h" namespace brightray { @@ -41,11 +41,11 @@ NetLog::~NetLog() { void NetLog::StartLogging() { auto* command_line = base::CommandLine::ForCurrentProcess(); - if (!command_line->HasSwitch(switches::kLogNetLog)) + if (!command_line->HasSwitch(network::switches::kLogNetLog)) return; - base::FilePath log_path; - log_path = command_line->GetSwitchValuePath(switches::kLogNetLog); + base::FilePath log_path = + command_line->GetSwitchValuePath(switches::kLogNetLog); if (log_path.empty()) return; diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 544d6c545cbf..5ad6f28da330 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -20,7 +20,6 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/cookie_store_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/cert/cert_verifier.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_intercepting_job_factory.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 "url/url_constants.h" @@ -239,11 +239,11 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { net::HostResolver::CreateDefaultResolver(nullptr)); // --host-resolver-rules - if (command_line.HasSwitch(::switches::kHostResolverRules)) { + if (command_line.HasSwitch(network::switches::kHostResolverRules)) { std::unique_ptr remapped_resolver( new net::MappedHostResolver(std::move(host_resolver))); - remapped_resolver->SetRulesFromString( - command_line.GetSwitchValueASCII(::switches::kHostResolverRules)); + remapped_resolver->SetRulesFromString(command_line.GetSwitchValueASCII( + network::switches::kHostResolverRules)); host_resolver = std::move(remapped_resolver); }