OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PREFS_COMMAND_LINE_PREF_STORE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_COMMAND_LINE_PREF_STORE_H_ |
6 #define CHROME_BROWSER_PREFS_COMMAND_LINE_PREF_STORE_H_ | 6 #define CHROME_BROWSER_PREFS_COMMAND_LINE_PREF_STORE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // Logs a message and returns false if the proxy switches are | 23 // Logs a message and returns false if the proxy switches are |
24 // self-contradictory. Protected so it can be used in unit testing. | 24 // self-contradictory. Protected so it can be used in unit testing. |
25 bool ValidateProxySwitches(); | 25 bool ValidateProxySwitches(); |
26 | 26 |
27 private: | 27 private: |
28 struct StringSwitchToPreferenceMapEntry { | 28 struct StringSwitchToPreferenceMapEntry { |
29 const char* switch_name; | 29 const char* switch_name; |
30 const char* preference_path; | 30 const char* preference_path; |
31 }; | 31 }; |
32 | 32 |
| 33 struct IntegerSwitchToPreferenceMapEntry { |
| 34 const char* switch_name; |
| 35 const char* preference_path; |
| 36 }; |
| 37 |
33 // |set_value| indicates what the preference should be set to if the switch | 38 // |set_value| indicates what the preference should be set to if the switch |
34 // is present. | 39 // is present. |
35 struct BooleanSwitchToPreferenceMapEntry { | 40 struct BooleanSwitchToPreferenceMapEntry { |
36 const char* switch_name; | 41 const char* switch_name; |
37 const char* preference_path; | 42 const char* preference_path; |
38 bool set_value; | 43 bool set_value; |
39 }; | 44 }; |
40 static const BooleanSwitchToPreferenceMapEntry boolean_switch_map_[]; | |
41 | 45 |
42 // Using the string and boolean maps, apply command-line switches to their | 46 // Using the string and boolean maps, apply command-line switches to their |
43 // corresponding preferences in this pref store. | 47 // corresponding preferences in this pref store. |
44 void ApplySimpleSwitches(); | 48 void ApplySimpleSwitches(); |
45 | 49 |
46 // Determines the proxy mode preference from the given proxy switches. | 50 // Determines the proxy mode preference from the given proxy switches. |
47 void ApplyProxyMode(); | 51 void ApplyProxyMode(); |
48 | 52 |
49 // Apply the SSL/TLS preferences from the given switches. | 53 // Apply the SSL/TLS preferences from the given switches. |
50 void ApplySSLSwitches(); | 54 void ApplySSLSwitches(); |
51 | 55 |
52 // Weak reference. | 56 // Weak reference. |
53 const CommandLine* command_line_; | 57 const CommandLine* command_line_; |
54 | 58 |
| 59 // Mappings of command line switches to prefs. |
| 60 static const BooleanSwitchToPreferenceMapEntry boolean_switch_map_[]; |
55 static const StringSwitchToPreferenceMapEntry string_switch_map_[]; | 61 static const StringSwitchToPreferenceMapEntry string_switch_map_[]; |
| 62 static const IntegerSwitchToPreferenceMapEntry integer_switch_map_[]; |
56 | 63 |
57 DISALLOW_COPY_AND_ASSIGN(CommandLinePrefStore); | 64 DISALLOW_COPY_AND_ASSIGN(CommandLinePrefStore); |
58 }; | 65 }; |
59 | 66 |
60 #endif // CHROME_BROWSER_PREFS_COMMAND_LINE_PREF_STORE_H_ | 67 #endif // CHROME_BROWSER_PREFS_COMMAND_LINE_PREF_STORE_H_ |
OLD | NEW |