Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1093)

Unified Diff: chrome/browser/prefs/command_line_pref_store.cc

Issue 8572006: Add policies to control the disk cache size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: This time two more for realz. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store.h ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4f2e2b3af46ac27c65262259792c380a6de7c826 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 },
};
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 },
+ };
+
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(
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store.h ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698