Skip to content

Commit

Permalink
Remove content/ dependency on components/network_session_configurator.
Browse files Browse the repository at this point in the history
network_session_configurator is for sharing configuration state between chrome & ios. However the three flags that were moved from content to it aren't used on iOS, so they can remain in content.

Review-Url: https://codereview.chromium.org/2182323002
Cr-Commit-Position: refs/heads/master@{#408149}
  • Loading branch information
jam authored and Commit bot committed Jul 27, 2016
1 parent dd4636a commit 1671ed3
Show file tree
Hide file tree
Showing 27 changed files with 32 additions and 73 deletions.
1 change: 0 additions & 1 deletion android_webview/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,6 @@ source_set("common") {
"//components/metrics:profiler",
"//components/metrics:ui",
"//components/navigation_interception",
"//components/network_session_configurator:switches",
"//components/prefs",
"//components/printing/browser",
"//components/printing/common",
Expand Down
1 change: 0 additions & 1 deletion android_webview/android_webview.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@
'../components/components.gyp:metrics_profiler',
'../components/components.gyp:metrics_ui',
'../components/components.gyp:navigation_interception',
'../components/components.gyp:network_session_configurator_switches',
'../components/components.gyp:printing_common',
'../components/components.gyp:printing_browser',
'../components/components.gyp:printing_renderer',
Expand Down
1 change: 0 additions & 1 deletion android_webview/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ include_rules = [
"+components/cdm/browser",
"+components/crash/content/browser",
"+components/navigation_interception",
"+components/network_session_configurator/switches.h",
"+components/policy/core/browser",
"+components/policy/core/common",
"+components/pref_registry",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "base/strings/string_number_conversions.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/worker_pool.h"
#include "components/network_session_configurator/switches.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
Expand Down
22 changes: 22 additions & 0 deletions chrome/browser/io_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,16 @@ std::unique_ptr<net::HostResolver> CreateGlobalHostResolver(
return std::move(remapped_resolver);
}

int GetSwitchValueAsInt(const base::CommandLine& command_line,
const std::string& switch_name) {
int value;
if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name),
&value)) {
return 0;
}
return value;
}

} // namespace

class SystemURLRequestContextGetter : public net::URLRequestContextGetter {
Expand Down Expand Up @@ -632,6 +642,18 @@ void IOThread::Init() {
network_session_configurator::ParseFieldTrialsAndCommandLine(
is_quic_allowed_by_policy_, quic_user_agent_id, &params_);

// Parameters only controlled by command line.
if (command_line.HasSwitch(switches::kIgnoreCertificateErrors))
params_.ignore_certificate_errors = true;
if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
params_.testing_fixed_http_port =
GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort);
}
if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) {
params_.testing_fixed_https_port =
GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort);
}

bool always_enable_tfo_if_supported =
command_line.HasSwitch(switches::kEnableTcpFastOpen);
// Check for OS support of TCP FastOpen, and turn it on for all connections if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/test_autofill_client.h"
#include "components/autofill/core/common/password_form.h"
#include "components/network_session_configurator/switches.h"
#include "components/password_manager/content/browser/content_password_manager_driver.h"
#include "components/password_manager/content/browser/content_password_manager_driver_factory.h"
#include "components/password_manager/core/browser/login_model.h"
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/ssl/ssl_browser_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/network_session_configurator/switches.h"
#include "components/network_time/network_time_tracker.h"
#include "components/prefs/pref_service.h"
#include "components/security_interstitials/core/controller_client.h"
Expand Down
1 change: 0 additions & 1 deletion chromecast/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ source_set("browser") {
# isn't needed. crbug.com/541577
"//components/metrics:ui",
"//components/network_hints/browser",
"//components/network_session_configurator:switches",
"//components/prefs",
"//content",
"//content/public/browser",
Expand Down
1 change: 0 additions & 1 deletion chromecast/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ include_rules = [
"+components/devtools_http_handler",
"+components/external_video_surface",
"+components/network_hints/browser",
"+components/network_session_configurator/switches.h",
"+components/prefs",
"+content/public/browser",
"+gin/v8_initializer.h",
Expand Down
1 change: 0 additions & 1 deletion chromecast/browser/url_request_context_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "chromecast/base/chromecast_switches.h"
#include "chromecast/browser/cast_http_user_agent_settings.h"
#include "chromecast/browser/cast_network_delegate.h"
#include "components/network_session_configurator/switches.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_store_factory.h"
Expand Down
1 change: 0 additions & 1 deletion chromecast/chromecast.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@
'../components/components.gyp:devtools_http_handler',
'../components/components.gyp:network_hints_browser',
'../components/components.gyp:network_hints_renderer',
'../components/components.gyp:network_session_configurator_switches',
'../components/components.gyp:metrics',
'../components/components.gyp:metrics_gpu',
'../components/components.gyp:metrics_net',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled";
const char kHttp2FieldTrialName[] = "HTTP2";
const char kHttp2FieldTrialDisablePrefix[] = "Disable";

int GetSwitchValueAsInt(const base::CommandLine& command_line,
const std::string& switch_name) {
int value;
if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name),
&value)) {
return 0;
}
return value;
}

// Returns the value associated with |key| in |params| or "" if the
// key is not present in the map.
const std::string& GetVariationParam(
Expand Down Expand Up @@ -440,18 +430,6 @@ void ParseFieldTrialsAndCommandLineInternal(
bool is_quic_allowed_by_policy,
const std::string& quic_user_agent_id,
net::HttpNetworkSession::Params* params) {
// Parameters only controlled by command line.
if (command_line.HasSwitch(switches::kIgnoreCertificateErrors))
params->ignore_certificate_errors = true;
if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
params->testing_fixed_http_port =
GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort);
}
if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) {
params->testing_fixed_https_port =
GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort);
}

// Always fetch the field trial groups to ensure they are reported correctly.
// The command line flags will be associated with a group that is reported so
// long as trial is actually queried.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,6 @@ TEST_F(NetworkSessionConfiguratorTest, Defaults) {
EXPECT_FALSE(params_.enable_quic);
}

TEST_F(NetworkSessionConfiguratorTest, IgnoreCertificateErrors) {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
"ignore-certificate-errors");

ParseFieldTrialsAndCommandLine();

EXPECT_TRUE(params_.ignore_certificate_errors);
}

TEST_F(NetworkSessionConfiguratorTest, TestingFixedPort) {
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
"testing-fixed-http-port", "42");
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
"testing-fixed-https-port", "1234");

ParseFieldTrialsAndCommandLine();

EXPECT_EQ(42u, params_.testing_fixed_http_port);
EXPECT_EQ(1234u, params_.testing_fixed_https_port);
}

TEST_F(NetworkSessionConfiguratorTest, Http2FieldTrialHttp2Disable) {
base::FieldTrialList::CreateFieldTrial("HTTP2", "Disable");

Expand Down
7 changes: 0 additions & 7 deletions components/network_session_configurator/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ const char kEnableQuic[] = "enable-quic";
// This only has an effect if the QUIC protocol is enabled.
const char kEnableQuicPortSelection[] = "enable-quic-port-selection";

// Ignores certificate-related errors.
const char kIgnoreCertificateErrors[] = "ignore-certificate-errors";

// Causes net::URLFetchers to ignore requests for SSL client certificates,
// causing them to attempt an unauthenticated SSL/TLS session. This is intended
// for use when testing various service URLs (eg: kPromoServerURL, kSbURLPrefix,
Expand All @@ -48,8 +45,4 @@ const char kQuicMaxPacketLength[] = "quic-max-packet-length";
// Specifies the version of QUIC to use.
const char kQuicVersion[] = "quic-version";

// Allows for forcing socket connections to http/https to use fixed ports.
const char kTestingFixedHttpPort[] = "testing-fixed-http-port";
const char kTestingFixedHttpsPort[] = "testing-fixed-https-port";

} // namespace switches
3 changes: 0 additions & 3 deletions components/network_session_configurator/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ extern const char kDisableQuicPortSelection[];
extern const char kDisableQuic[];
extern const char kEnableQuicPortSelection[];
extern const char kEnableQuic[];
extern const char kIgnoreCertificateErrors[];
extern const char kIgnoreUrlFetcherCertRequests[];
extern const char kOriginToForceQuicOn[];
extern const char kQuicConnectionOptions[];
extern const char kQuicHostWhitelist[];
extern const char kQuicMaxPacketLength[];
extern const char kQuicVersion[];
extern const char kTestingFixedHttpPort[];
extern const char kTestingFixedHttpsPort[];

} // namespace switches

Expand Down
1 change: 0 additions & 1 deletion content/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ include_rules = [
"+components/memory_coordinator/browser",
"+components/memory_coordinator/common",
"+components/mime_util",
"+components/network_session_configurator/switches.h",
"+components/profile_service",
"+components/scheduler/common",
"+components/tracing",
Expand Down
1 change: 0 additions & 1 deletion content/browser/site_per_process_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "base/test/test_timeouts.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "components/network_session_configurator/switches.h"
#include "content/browser/frame_host/cross_process_frame_connector.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
Expand Down
1 change: 0 additions & 1 deletion content/content_shell.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
'../components/components.gyp:crash_component_breakpad_to_be_deleted',
'../components/components.gyp:devtools_discovery',
'../components/components.gyp:devtools_http_handler',
'../components/components.gyp:network_session_configurator_switches',
'../components/components.gyp:web_cache_renderer',
'../components/components.gyp:plugins_renderer',
'../components/test_runner/test_runner.gyp:test_runner',
Expand Down
7 changes: 7 additions & 0 deletions content/public/common/content_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,9 @@ const char kGpuStartupDialog[] = "gpu-startup-dialog";
// Passes gpu vendor_id from browser process to GPU process.
const char kGpuVendorID[] = "gpu-vendor-id";

// Ignores certificate-related errors.
const char kIgnoreCertificateErrors[] = "ignore-certificate-errors";

// These mappings only apply to the host resolver.
const char kHostResolverRules[] = "host-resolver-rules";

Expand Down Expand Up @@ -838,6 +841,10 @@ const char kStartFullscreen[] = "start-fullscreen";
const char kStatsCollectionController[] =
"enable-stats-collection-bindings";

// Allows for forcing socket connections to http/https to use fixed ports.
const char kTestingFixedHttpPort[] = "testing-fixed-http-port";
const char kTestingFixedHttpsPort[] = "testing-fixed-https-port";

// Type of the current test harness ("browser" or "ui").
const char kTestType[] = "test-type";

Expand Down
3 changes: 3 additions & 0 deletions content/public/common/content_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ CONTENT_EXPORT extern const char kGpuSandboxStartEarly[];
CONTENT_EXPORT extern const char kGpuStartupDialog[];
extern const char kGpuVendorID[];
CONTENT_EXPORT extern const char kHostResolverRules[];
CONTENT_EXPORT extern const char kIgnoreCertificateErrors[];
CONTENT_EXPORT extern const char kIgnoreGpuBlacklist[];
CONTENT_EXPORT extern const char kInertVisualViewport[];
CONTENT_EXPORT extern const char kInProcessGPU[];
Expand Down Expand Up @@ -235,6 +236,8 @@ CONTENT_EXPORT extern const char kSkipGpuDataLoading[];
extern const char kSkipReencodingOnSKPCapture[];
CONTENT_EXPORT extern const char kStartFullscreen[];
CONTENT_EXPORT extern const char kStatsCollectionController[];
CONTENT_EXPORT extern const char kTestingFixedHttpPort[];
CONTENT_EXPORT extern const char kTestingFixedHttpsPort[];
CONTENT_EXPORT extern const char kTestType[];
CONTENT_EXPORT extern const char kTopDocumentIsolation[];
CONTENT_EXPORT extern const char kTouchTextSelectionStrategy[];
Expand Down
1 change: 0 additions & 1 deletion content/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ static_library("content_shell_lib") {
"//components/crash/content/app:app_breakpad_mac_win_to_be_deleted",
"//components/devtools_discovery",
"//components/devtools_http_handler",
"//components/network_session_configurator:switches",
"//components/plugins/renderer",
"//components/test_runner:test_runner",
"//components/url_formatter",
Expand Down
1 change: 0 additions & 1 deletion content/shell/browser/DEPS
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include_rules = [
"+components/network_session_configurator/switches.h",
"-content/shell/browser/layout_test",
"+services/shell/public/cpp",
]
Expand Down
1 change: 0 additions & 1 deletion content/shell/browser/shell_browser_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "base/path_service.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "components/network_session_configurator/switches.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_switches.h"
Expand Down
1 change: 0 additions & 1 deletion content/shell/browser/shell_url_request_context_getter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/worker_pool.h"
#include "build/build_config.h"
#include "components/network_session_configurator/switches.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_store_factory.h"
#include "content/public/common/content_switches.h"
Expand Down
1 change: 0 additions & 1 deletion content/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ test("content_browsertests") {
":web_ui_test_mojo_bindings",
"//base/test:test_support",
"//components/memory_coordinator/browser",
"//components/network_session_configurator",
"//components/scheduler",
"//content:resources",
"//content/app:both_for_content_tests",
Expand Down
1 change: 0 additions & 1 deletion extensions/shell/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ include_rules = [
"+components/keyed_service",
"+components/nacl/browser",
"+components/nacl/common",
"+components/network_session_configurator/switches.h",
"+components/pref_registry",
"+components/update_client",
"+components/user_prefs",
Expand Down
1 change: 0 additions & 1 deletion extensions/shell/browser/shell_browser_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "base/command_line.h"
#include "components/guest_view/browser/guest_view_manager.h"
#include "components/network_session_configurator/switches.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
#include "extensions/browser/extension_protocols.h"
Expand Down

0 comments on commit 1671ed3

Please sign in to comment.