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

Side by Side Diff: chrome/installer/util/master_preferences.cc

Issue 4989001: Attempt to reland http://codereview.chromium.org/4928002/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/installer/util/master_preferences.h" 5 #include "chrome/installer/util/master_preferences.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } else { 85 } else {
86 master_dictionary_.reset(new DictionaryValue()); 86 master_dictionary_.reset(new DictionaryValue());
87 } 87 }
88 88
89 DCHECK(master_dictionary_.get()); 89 DCHECK(master_dictionary_.get());
90 90
91 // A simple map from command line switches to equivalent switches in the 91 // A simple map from command line switches to equivalent switches in the
92 // distribution dictionary. Currently all switches added will be set to 92 // distribution dictionary. Currently all switches added will be set to
93 // 'true'. 93 // 'true'.
94 static const struct CmdLineSwitchToDistributionSwitch { 94 static const struct CmdLineSwitchToDistributionSwitch {
95 const wchar_t* cmd_line_switch; 95 const char* cmd_line_switch;
96 const char* distribution_switch; 96 const char* distribution_switch;
97 } translate_switches[] = { 97 } translate_switches[] = {
98 { installer_util::switches::kCeee, 98 { installer_util::switches::kCeee,
99 installer_util::master_preferences::kCeee }, 99 installer_util::master_preferences::kCeee },
100 { installer_util::switches::kChrome, 100 { installer_util::switches::kChrome,
101 installer_util::master_preferences::kChrome }, 101 installer_util::master_preferences::kChrome },
102 { installer_util::switches::kChromeFrame, 102 { installer_util::switches::kChromeFrame,
103 installer_util::master_preferences::kChromeFrame }, 103 installer_util::master_preferences::kChromeFrame },
104 { installer_util::switches::kCreateAllShortcuts, 104 { installer_util::switches::kCreateAllShortcuts,
105 installer_util::master_preferences::kCreateAllShortcuts }, 105 installer_util::master_preferences::kCreateAllShortcuts },
(...skipping 23 matching lines...) Expand all
129 for (int i = 0; i < arraysize(translate_switches); ++i) { 129 for (int i = 0; i < arraysize(translate_switches); ++i) {
130 if (cmd_line.HasSwitch(translate_switches[i].cmd_line_switch)) { 130 if (cmd_line.HasSwitch(translate_switches[i].cmd_line_switch)) {
131 name.resize(arraysize(kDistroDict) - 1); 131 name.resize(arraysize(kDistroDict) - 1);
132 name.append(".").append(translate_switches[i].distribution_switch); 132 name.append(".").append(translate_switches[i].distribution_switch);
133 master_dictionary_->SetBoolean(name, true); 133 master_dictionary_->SetBoolean(name, true);
134 } 134 }
135 } 135 }
136 136
137 // See if the log file path was specified on the command line. 137 // See if the log file path was specified on the command line.
138 std::wstring str_value(cmd_line.GetSwitchValueNative( 138 std::wstring str_value(cmd_line.GetSwitchValueNative(
139 WideToASCII(installer_util::switches::kLogFile))); 139 installer_util::switches::kLogFile));
140 if (!str_value.empty()) { 140 if (!str_value.empty()) {
141 name.resize(arraysize(kDistroDict) - 1); 141 name.resize(arraysize(kDistroDict) - 1);
142 name.append(".").append(installer_util::master_preferences::kLogFile); 142 name.append(".").append(installer_util::master_preferences::kLogFile);
143 master_dictionary_->SetString(name, str_value); 143 master_dictionary_->SetString(name, str_value);
144 } 144 }
145 145
146 // Cache a pointer to the distribution dictionary. Ignore errors if any. 146 // Cache a pointer to the distribution dictionary. Ignore errors if any.
147 master_dictionary_->GetDictionary(kDistroDict, &distribution_); 147 master_dictionary_->GetDictionary(kDistroDict, &distribution_);
148 148
149 InitializeProductFlags(); 149 InitializeProductFlags();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 std::vector<GURL> MasterPreferences::GetFirstRunTabs() const { 229 std::vector<GURL> MasterPreferences::GetFirstRunTabs() const {
230 return GetNamedList(kFirstRunTabs, master_dictionary_.get()); 230 return GetNamedList(kFirstRunTabs, master_dictionary_.get());
231 } 231 }
232 232
233 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const { 233 bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const {
234 return master_dictionary_->GetDictionary( 234 return master_dictionary_->GetDictionary(
235 master_preferences::kExtensionsBlock, extensions); 235 master_preferences::kExtensionsBlock, extensions);
236 } 236 }
237 237
238 } // installer_util 238 } // installer_util
OLDNEW
« no previous file with comments | « chrome/installer/util/install_util.cc ('k') | chrome/installer/util/master_preferences_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698