Remove the old network implementation (see issue #2622)

The `--disable-features=NetworkService` flag is no longer supported.
This commit is contained in:
Marshall Greenblatt
2019-07-29 17:27:12 -04:00
parent ccb06ce3cb
commit 67b61c4af9
76 changed files with 296 additions and 6113 deletions

View File

@ -1,55 +1,3 @@
diff --git chrome/browser/browser_process.h chrome/browser/browser_process.h
index 761d300aa06b..f86558dd6efc 100644
--- chrome/browser/browser_process.h
+++ chrome/browser/browser_process.h
@@ -40,6 +40,10 @@ class WatchDogThread;
class WebRtcLogUploader;
class StartupData;
+namespace net_log {
+class NetExportFileWriter;
+}
+
namespace network {
class NetworkQualityTracker;
class SharedURLLoaderFactory;
@@ -184,6 +188,9 @@ class BrowserProcess {
// backed by the IOThread's URLRequestContext.
virtual SystemNetworkContextManager* system_network_context_manager() = 0;
+ // Provide direct accessor for CEF.
+ virtual net_log::NetExportFileWriter* net_export_file_writer() = 0;
+
// Returns a NetworkQualityTracker that can be used to subscribe for
// network quality change events.
virtual network::NetworkQualityTracker* network_quality_tracker() = 0;
diff --git chrome/browser/browser_process_impl.cc chrome/browser/browser_process_impl.cc
index c2e0b9172eb2..57c22ff16f4b 100644
--- chrome/browser/browser_process_impl.cc
+++ chrome/browser/browser_process_impl.cc
@@ -683,6 +683,10 @@ BrowserProcessImpl::system_network_context_manager() {
return SystemNetworkContextManager::GetInstance();
}
+net_log::NetExportFileWriter* BrowserProcessImpl::net_export_file_writer() {
+ return system_network_context_manager()->GetNetExportFileWriter();
+}
+
scoped_refptr<network::SharedURLLoaderFactory>
BrowserProcessImpl::shared_url_loader_factory() {
return system_network_context_manager()->GetSharedURLLoaderFactory();
diff --git chrome/browser/browser_process_impl.h chrome/browser/browser_process_impl.h
index 95a7bd8e8b58..af7685f86848 100644
--- chrome/browser/browser_process_impl.h
+++ chrome/browser/browser_process_impl.h
@@ -142,6 +142,7 @@ class BrowserProcessImpl : public BrowserProcess,
// TODO(qinmin): Remove this method as callers can retrieve the global
// instance from SystemNetworkContextManager directly.
SystemNetworkContextManager* system_network_context_manager() override;
+ net_log::NetExportFileWriter* net_export_file_writer() override;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
override;
network::NetworkQualityTracker* network_quality_tracker() override;
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
index 6bd5bea7ddb0..076306275b5b 100644
--- chrome/browser/ui/BUILD.gn
@ -82,7 +30,7 @@ index 6bd5bea7ddb0..076306275b5b 100644
"//chrome:resources",
"//chrome:strings",
diff --git chrome/browser/ui/webui/net_export_ui.cc chrome/browser/ui/webui/net_export_ui.cc
index 1b9b3d857f47..84b875f0e01d 100644
index 1b9b3d857f47..85e2d1e5a5d5 100644
--- chrome/browser/ui/webui/net_export_ui.cc
+++ chrome/browser/ui/webui/net_export_ui.cc
@@ -20,14 +20,13 @@
@ -183,17 +131,7 @@ index 1b9b3d857f47..84b875f0e01d 100644
base::WeakPtrFactory<NetExportMessageHandler> weak_ptr_factory_;
@@ -158,8 +179,7 @@ class NetExportMessageHandler
};
NetExportMessageHandler::NetExportMessageHandler()
- : file_writer_(g_browser_process->system_network_context_manager()
- ->GetNetExportFileWriter()),
+ : file_writer_(g_browser_process->net_export_file_writer()),
state_observer_manager_(this),
weak_ptr_factory_(this) {
file_writer_->Initialize();
@@ -168,8 +188,10 @@ NetExportMessageHandler::NetExportMessageHandler()
@@ -168,8 +189,10 @@ NetExportMessageHandler::NetExportMessageHandler()
NetExportMessageHandler::~NetExportMessageHandler() {
// There may be a pending file dialog, it needs to be told that the user
// has gone away so that it doesn't try to call back.
@ -204,7 +142,7 @@ index 1b9b3d857f47..84b875f0e01d 100644
file_writer_->StopNetLog(nullptr);
}
@@ -232,6 +254,7 @@ void NetExportMessageHandler::OnStartNetLog(const base::ListValue* list) {
@@ -232,6 +255,7 @@ void NetExportMessageHandler::OnStartNetLog(const base::ListValue* list) {
if (UsingMobileUI()) {
StartNetLog(base::FilePath());
} else {
@ -212,7 +150,7 @@ index 1b9b3d857f47..84b875f0e01d 100644
base::FilePath initial_dir = last_save_dir.Pointer()->empty() ?
DownloadPrefs::FromBrowserContext(
web_ui()->GetWebContents()->GetBrowserContext())->DownloadPath() :
@@ -239,6 +262,9 @@ void NetExportMessageHandler::OnStartNetLog(const base::ListValue* list) {
@@ -239,6 +263,9 @@ void NetExportMessageHandler::OnStartNetLog(const base::ListValue* list) {
base::FilePath initial_path =
initial_dir.Append(FILE_PATH_LITERAL("chrome-net-export-log.json"));
ShowSelectFileDialog(initial_path);
@ -222,7 +160,7 @@ index 1b9b3d857f47..84b875f0e01d 100644
}
}
@@ -248,6 +274,7 @@ void NetExportMessageHandler::OnStopNetLog(const base::ListValue* list) {
@@ -248,6 +275,7 @@ void NetExportMessageHandler::OnStopNetLog(const base::ListValue* list) {
std::unique_ptr<base::DictionaryValue> ui_thread_polled_data(
new base::DictionaryValue());
@ -230,7 +168,7 @@ index 1b9b3d857f47..84b875f0e01d 100644
Profile* profile = Profile::FromWebUI(web_ui());
SetIfNotNull(ui_thread_polled_data.get(), "prerenderInfo",
chrome_browser_net::GetPrerenderInfo(profile));
@@ -257,6 +284,7 @@ void NetExportMessageHandler::OnStopNetLog(const base::ListValue* list) {
@@ -257,6 +285,7 @@ void NetExportMessageHandler::OnStopNetLog(const base::ListValue* list) {
SetIfNotNull(ui_thread_polled_data.get(), "serviceProviders",
chrome_browser_net::GetWindowsServiceProviders());
#endif
@ -238,7 +176,7 @@ index 1b9b3d857f47..84b875f0e01d 100644
file_writer_->StopNetLog(std::move(ui_thread_polled_data));
}
@@ -273,6 +301,7 @@ void NetExportMessageHandler::OnShowFile(const base::ListValue* list) {
@@ -273,6 +302,7 @@ void NetExportMessageHandler::OnShowFile(const base::ListValue* list) {
base::Bind(&NetExportMessageHandler::ShowFileInShell, AsWeakPtr()));
}
@ -246,7 +184,7 @@ index 1b9b3d857f47..84b875f0e01d 100644
void NetExportMessageHandler::FileSelected(const base::FilePath& path,
int index,
void* params) {
@@ -291,6 +320,7 @@ void NetExportMessageHandler::FileSelectionCanceled(void* params) {
@@ -291,6 +321,7 @@ void NetExportMessageHandler::FileSelectionCanceled(void* params) {
DCHECK(select_file_dialog_);
select_file_dialog_ = nullptr;
}
@ -254,7 +192,7 @@ index 1b9b3d857f47..84b875f0e01d 100644
void NetExportMessageHandler::OnNewState(const base::DictionaryValue& state) {
NotifyUIWithState(state.CreateDeepCopy());
@@ -355,6 +385,7 @@ void NetExportMessageHandler::NotifyUIWithState(
@@ -355,6 +386,7 @@ void NetExportMessageHandler::NotifyUIWithState(
*state);
}
@ -262,7 +200,7 @@ index 1b9b3d857f47..84b875f0e01d 100644
void NetExportMessageHandler::ShowSelectFileDialog(
const base::FilePath& default_path) {
// User may have clicked more than once before the save dialog appears.
@@ -373,6 +404,43 @@ void NetExportMessageHandler::ShowSelectFileDialog(
@@ -373,6 +405,43 @@ void NetExportMessageHandler::ShowSelectFileDialog(
ui::SelectFileDialog::SELECT_SAVEAS_FILE, base::string16(), default_path,
&file_type_info, 0, base::FilePath::StringType(), owning_window, nullptr);
}

View File

@ -1,40 +0,0 @@
diff --git net/base/network_delegate.h net/base/network_delegate.h
index 49fe875c7d22..c1e3df840dc0 100644
--- net/base/network_delegate.h
+++ net/base/network_delegate.h
@@ -17,6 +17,7 @@
#include "net/base/completion_once_callback.h"
#include "net/base/net_export.h"
#include "net/cookies/canonical_cookie.h"
+#include "net/filter/source_stream.h"
#include "net/proxy_resolution/proxy_retry_info.h"
class GURL;
@@ -122,6 +123,10 @@ class NET_EXPORT NetworkDelegate {
bool CanUseReportingClient(const url::Origin& origin,
const GURL& endpoint) const;
+ virtual std::unique_ptr<SourceStream> CreateSourceStream(
+ net::URLRequest* request,
+ std::unique_ptr<SourceStream> upstream) { return upstream; }
+
protected:
THREAD_CHECKER(thread_checker_);
diff --git net/url_request/url_request_job.cc net/url_request/url_request_job.cc
index 3a7efeaf5b04..1a03e0ab8229 100644
--- net/url_request/url_request_job.cc
+++ net/url_request/url_request_job.cc
@@ -438,6 +438,12 @@ void URLRequestJob::NotifyHeadersComplete() {
DCHECK(!source_stream_);
source_stream_ = SetUpSourceStream();
+ // Allow the delegate to add a downstream SourceStream for filtering.
+ if (network_delegate_ && source_stream_) {
+ source_stream_ = network_delegate_->CreateSourceStream(
+ request_, std::move(source_stream_));
+ }
+
if (!source_stream_) {
OnDone(URLRequestStatus(URLRequestStatus::FAILED,
ERR_CONTENT_DECODING_INIT_FAILED),

View File

@ -1,52 +0,0 @@
diff --git net/http/transport_security_state.cc net/http/transport_security_state.cc
index b7a2bca7bf42..5987ee212a12 100644
--- net/http/transport_security_state.cc
+++ net/http/transport_security_state.cc
@@ -1100,8 +1100,12 @@ void TransportSecurityState::ClearReportCachesForTesting() {
sent_expect_ct_reports_cache_.Clear();
}
-// static
-bool TransportSecurityState::IsBuildTimely() {
+// Returns true if the current build is recent enough to ensure that
+// built-in security information (e.g. CT Logs) is fresh enough.
+bool TransportSecurityState::IsBuildTimely() const {
+ if (!enforce_net_security_expiration_)
+ return true;
+
const base::Time build_time = base::GetBuildTime();
// We consider built-in information to be timely for 10 weeks.
return (base::Time::Now() - build_time).InDays() < 70 /* 10 weeks */;
diff --git net/http/transport_security_state.h net/http/transport_security_state.h
index 48ccb74e2e1d..79dc9958d1de 100644
--- net/http/transport_security_state.h
+++ net/http/transport_security_state.h
@@ -530,6 +530,10 @@ class NET_EXPORT TransportSecurityState {
void EnableStaticPinsForTesting() { enable_static_pins_ = true; }
bool has_dynamic_pkp_state() const { return !enabled_pkp_hosts_.empty(); }
+ void set_enforce_net_security_expiration(bool enforce) {
+ enforce_net_security_expiration_ = enforce;
+ }
+
private:
friend class TransportSecurityStateTest;
friend class TransportSecurityStateStaticFuzzer;
@@ -548,7 +552,7 @@ class NET_EXPORT TransportSecurityState {
// IsBuildTimely returns true if the current build is new enough ensure that
// built in security information (i.e. HSTS preloading and pinning
// information) is timely.
- static bool IsBuildTimely();
+ bool IsBuildTimely() const;
// Helper method for actually checking pins.
PKPStatus CheckPublicKeyPinsImpl(
@@ -646,6 +650,8 @@ class NET_EXPORT TransportSecurityState {
// True if public key pinning bypass is enabled for local trust anchors.
bool enable_pkp_bypass_for_local_trust_anchors_;
+ bool enforce_net_security_expiration_ = true;
+
ExpectCTReporter* expect_ct_reporter_ = nullptr;
RequireCTDelegate* require_ct_delegate_ = nullptr;

View File

@ -1,16 +0,0 @@
diff --git net/url_request/url_request.h net/url_request/url_request.h
index f6043de481fa..ca4d2472f572 100644
--- net/url_request/url_request.h
+++ net/url_request/url_request.h
@@ -782,10 +782,10 @@ class NET_EXPORT URLRequest : public base::SupportsUserData {
base::WeakPtr<URLRequest> GetWeakPtr();
- protected:
// Allow the URLRequestJob class to control the is_pending() flag.
void set_is_pending(bool value) { is_pending_ = value; }
+ protected:
// Allow the URLRequestJob class to set our status too.
void set_status(URLRequestStatus status);