Chromium Code Reviews| Index: chrome/browser/prefs/command_line_pref_store.cc |
| diff --git a/chrome/browser/prefs/command_line_pref_store.cc b/chrome/browser/prefs/command_line_pref_store.cc |
| index af4f39d6df05a9a0224eee9cf6c4c53e21cccd38..382460f7d76e669dfc5a608c70934d741054c54c 100644 |
| --- a/chrome/browser/prefs/command_line_pref_store.cc |
| +++ b/chrome/browser/prefs/command_line_pref_store.cc |
| @@ -5,6 +5,7 @@ |
| #include "chrome/browser/prefs/command_line_pref_store.h" |
| #include "base/logging.h" |
| +#include "base/string_number_conversions.h" |
| #include "base/string_split.h" |
| #include "base/values.h" |
| #include "chrome/browser/prefs/proxy_config_dictionary.h" |
| @@ -20,6 +21,7 @@ const CommandLinePrefStore::StringSwitchToPreferenceMapEntry |
| { switches::kAuthNegotiateDelegateWhitelist, |
| prefs::kAuthNegotiateDelegateWhitelist }, |
| { switches::kGSSAPILibraryName, prefs::kGSSAPILibraryName }, |
| + { switches::kDiskCacheDir, prefs::kDiskCacheDir } |
|
Joao da Silva
2011/11/16 16:10:42
Nitty nit: comma at the end
pastarmovj
2011/11/17 13:10:10
I never got the idea why should we end those lists
|
| }; |
| const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry |
| @@ -46,6 +48,12 @@ const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry |
| { switches::kDisableTLS1, prefs::kTLS1Enabled, false }, |
| }; |
| +const CommandLinePrefStore::IntegerSwitchToPreferenceMapEntry |
| + CommandLinePrefStore::integer_switch_map_[] = { |
| + { switches::kDiskCacheSize, prefs::kDiskCacheSize }, |
| + { switches::kMediaCacheSize, prefs::kMediaCacheSize } |
|
Joao da Silva
2011/11/16 16:10:42
Same
pastarmovj
2011/11/17 13:10:10
Done.
|
| + }; |
| + |
| CommandLinePrefStore::CommandLinePrefStore(const CommandLine* command_line) |
| : command_line_(command_line) { |
| ApplySimpleSwitches(); |
| @@ -66,6 +74,22 @@ void CommandLinePrefStore::ApplySimpleSwitches() { |
| } |
| } |
| + for (size_t i = 0; i < arraysize(integer_switch_map_); ++i) { |
| + if (command_line_->HasSwitch(integer_switch_map_[i].switch_name)) { |
| + std::string str_value = command_line_->GetSwitchValueASCII( |
| + integer_switch_map_[i].switch_name); |
| + int int_value = 0; |
| + if (!base::StringToInt(str_value, &int_value)) { |
| + LOG(ERROR) << "The value " << str_value << " of " |
| + << integer_switch_map_[i].switch_name |
| + << " can not be converted to integer, ignoring!"; |
| + continue; |
| + } |
| + Value* value = Value::CreateIntegerValue(int_value); |
| + SetValue(integer_switch_map_[i].preference_path, value); |
| + } |
| + } |
| + |
| for (size_t i = 0; i < arraysize(boolean_switch_map_); ++i) { |
| if (command_line_->HasSwitch(boolean_switch_map_[i].switch_name)) { |
| Value* value = Value::CreateBooleanValue( |