OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PREFS_CHROME_COMMAND_LINE_PREF_STORE_H_ |
| 6 #define CHROME_BROWSER_PREFS_CHROME_COMMAND_LINE_PREF_STORE_H_ |
| 7 |
| 8 #include "base/command_line.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/values.h" |
| 11 #include "components/prefs/command_line_pref_store.h" |
| 12 |
| 13 // This PrefStore keeps track of preferences set by command-line switches, |
| 14 // such as proxy settings. |
| 15 class ChromeCommandLinePrefStore : public CommandLinePrefStore { |
| 16 public: |
| 17 explicit ChromeCommandLinePrefStore(const base::CommandLine* command_line); |
| 18 |
| 19 protected: |
| 20 ~ChromeCommandLinePrefStore() override; |
| 21 |
| 22 // Logs a message and returns false if the proxy switches are |
| 23 // self-contradictory. Protected so it can be used in unit testing. |
| 24 // TODO(bauerb): make this method public and remove the subclass, which calls |
| 25 // this method, from the test. |
| 26 bool ValidateProxySwitches(); |
| 27 |
| 28 private: |
| 29 friend class TestCommandLinePrefStore; |
| 30 |
| 31 // Using the string and boolean maps, apply command-line switches to their |
| 32 // corresponding preferences in this pref store. |
| 33 void ApplySimpleSwitches(); |
| 34 |
| 35 // Determines the proxy mode preference from the given proxy switches. |
| 36 void ApplyProxyMode(); |
| 37 |
| 38 // Apply the SSL/TLS preferences from the given switches. |
| 39 void ApplySSLSwitches(); |
| 40 |
| 41 // Determines whether the background mode is force-disabled. |
| 42 void ApplyBackgroundModeSwitches(); |
| 43 |
| 44 // Mappings of command line switches to prefs. |
| 45 static const BooleanSwitchToPreferenceMapEntry boolean_switch_map_[]; |
| 46 static const SwitchToPreferenceMapEntry string_switch_map_[]; |
| 47 static const SwitchToPreferenceMapEntry path_switch_map_[]; |
| 48 static const SwitchToPreferenceMapEntry integer_switch_map_[]; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ChromeCommandLinePrefStore); |
| 51 }; |
| 52 |
| 53 #endif // CHROME_BROWSER_PREFS_CHROME_COMMAND_LINE_PREF_STORE_H_ |
OLD | NEW |