OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "components/prefs/command_line_pref_store.h" | 5 #include "components/prefs/command_line_pref_store.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 std::string str_value = command_line_->GetSwitchValueASCII( | 53 std::string str_value = command_line_->GetSwitchValueASCII( |
54 integer_switch[i].switch_name); | 54 integer_switch[i].switch_name); |
55 int int_value = 0; | 55 int int_value = 0; |
56 if (!base::StringToInt(str_value, &int_value)) { | 56 if (!base::StringToInt(str_value, &int_value)) { |
57 LOG(ERROR) << "The value " << str_value << " of " | 57 LOG(ERROR) << "The value " << str_value << " of " |
58 << integer_switch[i].switch_name | 58 << integer_switch[i].switch_name |
59 << " can not be converted to integer, ignoring!"; | 59 << " can not be converted to integer, ignoring!"; |
60 continue; | 60 continue; |
61 } | 61 } |
62 SetValue(integer_switch[i].preference_path, | 62 SetValue(integer_switch[i].preference_path, |
63 base::MakeUnique<base::FundamentalValue>(int_value), | 63 base::MakeUnique<base::Value>(int_value), |
64 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 64 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 void CommandLinePrefStore::ApplyBooleanSwitches( | 69 void CommandLinePrefStore::ApplyBooleanSwitches( |
70 const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry | 70 const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry |
71 boolean_switch_map[], size_t size) { | 71 boolean_switch_map[], size_t size) { |
72 for (size_t i = 0; i < size; ++i) { | 72 for (size_t i = 0; i < size; ++i) { |
73 if (command_line_->HasSwitch(boolean_switch_map[i].switch_name)) { | 73 if (command_line_->HasSwitch(boolean_switch_map[i].switch_name)) { |
74 SetValue(boolean_switch_map[i].preference_path, | 74 SetValue(boolean_switch_map[i].preference_path, |
75 base::MakeUnique<base::FundamentalValue>( | 75 base::MakeUnique<base::Value>(boolean_switch_map[i].set_value), |
76 boolean_switch_map[i].set_value), | |
77 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 76 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
78 } | 77 } |
79 } | 78 } |
80 } | 79 } |
OLD | NEW |