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

Side by Side Diff: components/prefs/command_line_pref_store.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 months 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 unified diff | Download patch
OLDNEW
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"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 12
13 CommandLinePrefStore::CommandLinePrefStore( 13 CommandLinePrefStore::CommandLinePrefStore(
14 const base::CommandLine* command_line) 14 const base::CommandLine* command_line)
15 : command_line_(command_line) {} 15 : command_line_(command_line) {}
16 16
17 CommandLinePrefStore::~CommandLinePrefStore() {} 17 CommandLinePrefStore::~CommandLinePrefStore() {}
18 18
19 void CommandLinePrefStore::ApplyStringSwitches( 19 void CommandLinePrefStore::ApplyStringSwitches(
20 const CommandLinePrefStore::SwitchToPreferenceMapEntry string_switch[], 20 const CommandLinePrefStore::SwitchToPreferenceMapEntry string_switch[],
21 size_t size) { 21 size_t size) {
22 for (size_t i = 0; i < size; ++i) { 22 for (size_t i = 0; i < size; ++i) {
23 if (command_line_->HasSwitch(string_switch[i].switch_name)) { 23 if (command_line_->HasSwitch(string_switch[i].switch_name)) {
24 SetValue(string_switch[i].preference_path, 24 SetValue(string_switch[i].preference_path,
25 base::MakeUnique<base::StringValue>( 25 base::MakeUnique<base::Value>(command_line_->GetSwitchValueASCII(
26 command_line_->GetSwitchValueASCII( 26 string_switch[i].switch_name)),
27 string_switch[i].switch_name)),
28 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 27 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
29 } 28 }
30 } 29 }
31 } 30 }
32 31
33 void CommandLinePrefStore::ApplyPathSwitches( 32 void CommandLinePrefStore::ApplyPathSwitches(
34 const CommandLinePrefStore::SwitchToPreferenceMapEntry path_switch[], 33 const CommandLinePrefStore::SwitchToPreferenceMapEntry path_switch[],
35 size_t size) { 34 size_t size) {
36 for (size_t i = 0; i < size; ++i) { 35 for (size_t i = 0; i < size; ++i) {
37 if (command_line_->HasSwitch(path_switch[i].switch_name)) { 36 if (command_line_->HasSwitch(path_switch[i].switch_name)) {
38 SetValue( 37 SetValue(path_switch[i].preference_path,
39 path_switch[i].preference_path, 38 base::MakeUnique<base::Value>(
40 base::MakeUnique<base::StringValue>( 39 command_line_->GetSwitchValuePath(path_switch[i].switch_name)
41 command_line_->GetSwitchValuePath(path_switch[i].switch_name) 40 .value()),
42 .value()), 41 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
43 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
44 } 42 }
45 } 43 }
46 } 44 }
47 45
48 void CommandLinePrefStore::ApplyIntegerSwitches( 46 void CommandLinePrefStore::ApplyIntegerSwitches(
49 const CommandLinePrefStore::SwitchToPreferenceMapEntry integer_switch[], 47 const CommandLinePrefStore::SwitchToPreferenceMapEntry integer_switch[],
50 size_t size) { 48 size_t size) {
51 for (size_t i = 0; i < size; ++i) { 49 for (size_t i = 0; i < size; ++i) {
52 if (command_line_->HasSwitch(integer_switch[i].switch_name)) { 50 if (command_line_->HasSwitch(integer_switch[i].switch_name)) {
53 std::string str_value = command_line_->GetSwitchValueASCII( 51 std::string str_value = command_line_->GetSwitchValueASCII(
(...skipping 16 matching lines...) Expand all
70 const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry 68 const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry
71 boolean_switch_map[], size_t size) { 69 boolean_switch_map[], size_t size) {
72 for (size_t i = 0; i < size; ++i) { 70 for (size_t i = 0; i < size; ++i) {
73 if (command_line_->HasSwitch(boolean_switch_map[i].switch_name)) { 71 if (command_line_->HasSwitch(boolean_switch_map[i].switch_name)) {
74 SetValue(boolean_switch_map[i].preference_path, 72 SetValue(boolean_switch_map[i].preference_path,
75 base::MakeUnique<base::Value>(boolean_switch_map[i].set_value), 73 base::MakeUnique<base::Value>(boolean_switch_map[i].set_value),
76 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 74 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
77 } 75 }
78 } 76 }
79 } 77 }
OLDNEW
« no previous file with comments | « components/policy/tools/generate_policy_source_test.py ('k') | components/prefs/default_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698