diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 20:47:52 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 20:47:52 +0000 |
commit | 4dad9ad838f6671fbd67e1c5292525e739e31983 (patch) | |
tree | 4d79fc17f12752cc221e0e40d16951677da71f92 /chrome/installer/util | |
parent | 2b3f0f59a6761a41e22007c2c3096e8e18517e08 (diff) | |
download | chromium_src-4dad9ad838f6671fbd67e1c5292525e739e31983.zip chromium_src-4dad9ad838f6671fbd67e1c5292525e739e31983.tar.gz chromium_src-4dad9ad838f6671fbd67e1c5292525e739e31983.tar.bz2 |
Many changes to DictionaryValues:
* Add support for keys with "." in them via new XXXWithoutPathExpansion() APIs.
* Use these APIs with all key iterator usage.
* SetXXX() calls cannot fail, so change them from bool to void.
* Change GetSize() to size() since it's cheap, and add empty().
Other:
* Use standard for loop format in more places (e.g. instead of while loops when they're really doing a for loop).
* Shorten a few bits of code.
BUG=567
TEST=none
Review URL: http://codereview.chromium.org/441008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33109 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util')
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.cc | 8 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences.cc | 16 |
2 files changed, 9 insertions, 15 deletions
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index faf574b..d501701 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -112,15 +112,15 @@ bool GoogleChromeDistribution::BuildUninstallMetricsString( DCHECK(NULL != metrics); bool has_values = false; - DictionaryValue::key_iterator iter(uninstall_metrics_dict->begin_keys()); - for (; iter != uninstall_metrics_dict->end_keys(); ++iter) { + for (DictionaryValue::key_iterator iter(uninstall_metrics_dict->begin_keys()); + iter != uninstall_metrics_dict->end_keys(); ++iter) { has_values = true; metrics->append(L"&"); metrics->append(*iter); metrics->append(L"="); std::wstring value; - uninstall_metrics_dict->GetString(*iter, &value); + uninstall_metrics_dict->GetStringWithoutPathExpansion(*iter, &value); metrics->append(value); } diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 8eb3ad1..176c2fb 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -11,9 +11,7 @@ namespace { const wchar_t* kDistroDict = L"distribution"; - - -} // namespace +} namespace installer_util { namespace master_preferences { @@ -116,14 +114,10 @@ bool SetDistroBooleanPreference(DictionaryValue* prefs, const std::wstring& name, bool value) { - bool ret = false; - if (prefs && !name.empty()) { - std::wstring key(kDistroDict); - key.append(L"." + name); - if (prefs->SetBoolean(key, value)) - ret = true; - } - return ret; + if (!prefs || name.empty()) + return false; + prefs->SetBoolean(std::wstring(kDistroDict) + L"." + name, value); + return true; } } // installer_util |