blob: a37280f137deb196b55f3cc8fa32c1c98fc1b5b9 [file] [log] [blame]
// Copyright (c) 2016 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 "base/command_line.h"
#include "base/macros.h"
#include "base/values.h"
#include "components/prefs/command_line_pref_store.h"
// This PrefStore keeps track of preferences set by command-line switches,
// such as proxy settings.
class ChromeCommandLinePrefStore : public CommandLinePrefStore {
explicit ChromeCommandLinePrefStore(const base::CommandLine* command_line);
~ChromeCommandLinePrefStore() override;
// Logs a message and returns false if the proxy switches are
// self-contradictory. Protected so it can be used in unit testing.
// TODO(bauerb): make this method public and remove the subclass, which calls
// this method, from the test.
bool ValidateProxySwitches();
friend class TestCommandLinePrefStore;
// Using the string and boolean maps, apply command-line switches to their
// corresponding preferences in this pref store.
void ApplySimpleSwitches();
// Determines the proxy mode preference from the given proxy switches.
void ApplyProxyMode();
// Apply the SSL/TLS preferences from the given switches.
void ApplySSLSwitches();
// Determines whether the background mode is force-disabled.
void ApplyBackgroundModeSwitches();
// Mappings of command line switches to prefs.
static const BooleanSwitchToPreferenceMapEntry boolean_switch_map_[];
static const SwitchToPreferenceMapEntry string_switch_map_[];
static const SwitchToPreferenceMapEntry path_switch_map_[];
static const SwitchToPreferenceMapEntry integer_switch_map_[];