diff options
author | vabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-27 22:27:11 +0000 |
---|---|---|
committer | vabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-27 22:27:11 +0000 |
commit | a61890ebc4d1d6f558edfe8a03ba6a6c72a16689 (patch) | |
tree | dc8768892744a98ba9386583a1d27fa575e72a15 | |
parent | b39a8db3e8e31029e98075863a38f8c3b188529c (diff) | |
download | chromium_src-a61890ebc4d1d6f558edfe8a03ba6a6c72a16689.zip chromium_src-a61890ebc4d1d6f558edfe8a03ba6a6c72a16689.tar.gz chromium_src-a61890ebc4d1d6f558edfe8a03ba6a6c72a16689.tar.bz2 |
Correct const accessors in base/values.(h|cc)
For problem description and other info please see the BUG page.
This is for DictionaryValue.
BUG=138946
TEST=N/A (no fix & no new feature)
TBR=jar scottbyer achuith agl mnissler davemoore garykac akalin hans bulach phajdan.jr jamesr
Review URL: https://chromiumcodereview.appspot.com/10834004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148833 0039d316-1c4b-4281-b951-d872f2087c98
98 files changed, 378 insertions, 309 deletions
diff --git a/base/json/json_value_converter.h b/base/json/json_value_converter.h index 2d605e4..9d3036a 100644 --- a/base/json/json_value_converter.h +++ b/base/json/json_value_converter.h @@ -505,7 +505,7 @@ class JSONValueConverter { for(size_t i = 0; i < fields_.size(); ++i) { const internal::FieldConverterBase<StructType>* field_converter = fields_[i]; - base::Value* field = NULL; + const base::Value* field = NULL; if (dictionary_value->Get(field_converter->field_path(), &field)) { if (!field_converter->ConvertField(*field, output)) { DVLOG(1) << "failure at field " << field_converter->field_path(); diff --git a/base/json/json_writer.cc b/base/json/json_writer.cc index e814003..9ca4813 100644 --- a/base/json/json_writer.cc +++ b/base/json/json_writer.cc @@ -173,7 +173,7 @@ void JSONWriter::BuildJSONString(const Value* const node, int depth) { for (DictionaryValue::key_iterator key_itr = dict->begin_keys(); key_itr != dict->end_keys(); ++key_itr) { - Value* value = NULL; + const Value* value = NULL; bool result = dict->GetWithoutPathExpansion(*key_itr, &value); DCHECK(result); diff --git a/base/test/trace_event_analyzer.cc b/base/test/trace_event_analyzer.cc index c0d9fae..ad50725 100644 --- a/base/test/trace_event_analyzer.cc +++ b/base/test/trace_event_analyzer.cc @@ -35,7 +35,7 @@ bool TraceEvent::SetFromJSON(const base::Value* event_value) { static_cast<const base::DictionaryValue*>(event_value); std::string phase_str; - base::DictionaryValue* args = NULL; + const base::DictionaryValue* args = NULL; if (!dictionary->GetString("ph", &phase_str)) { LOG(ERROR) << "ph is missing from TraceEvent JSON"; @@ -85,7 +85,7 @@ bool TraceEvent::SetFromJSON(const base::Value* event_value) { bool boolean = false; int int_num = 0; double double_num = 0.0; - Value* value = NULL; + const Value* value = NULL; if (args->GetWithoutPathExpansion(*keyi, &value)) { if (value->GetAsString(&str)) arg_strings[*keyi] = str; @@ -957,4 +957,3 @@ size_t CountMatches(const TraceEventVector& events, } } // namespace trace_analyzer - diff --git a/base/test/values_test_util.cc b/base/test/values_test_util.cc index 91ce347..a5667f1 100644 --- a/base/test/values_test_util.cc +++ b/base/test/values_test_util.cc @@ -21,7 +21,7 @@ void ExpectDictBooleanValue(bool expected_value, void ExpectDictDictionaryValue(const DictionaryValue& expected_value, const DictionaryValue& value, const std::string& key) { - DictionaryValue* dict_value = NULL; + const DictionaryValue* dict_value = NULL; EXPECT_TRUE(value.GetDictionary(key, &dict_value)) << key; EXPECT_TRUE(Value::Equals(dict_value, &expected_value)) << key; } @@ -37,7 +37,7 @@ void ExpectDictIntegerValue(int expected_value, void ExpectDictListValue(const ListValue& expected_value, const DictionaryValue& value, const std::string& key) { - ListValue* list_value = NULL; + const ListValue* list_value = NULL; EXPECT_TRUE(value.GetList(key, &list_value)) << key; EXPECT_TRUE(Value::Equals(list_value, &expected_value)) << key; } diff --git a/base/values.cc b/base/values.cc index 747ed0c..08fab89 100644 --- a/base/values.cc +++ b/base/values.cc @@ -441,14 +441,15 @@ void DictionaryValue::SetWithoutPathExpansion(const std::string& key, } } -bool DictionaryValue::Get(const std::string& path, Value** out_value) const { +bool DictionaryValue::Get( + const std::string& path, const Value** out_value) const { DCHECK(IsStringUTF8(path)); std::string current_path(path); const DictionaryValue* current_dictionary = this; for (size_t delimiter_position = current_path.find('.'); delimiter_position != std::string::npos; delimiter_position = current_path.find('.')) { - DictionaryValue* child_dictionary = NULL; + const DictionaryValue* child_dictionary = NULL; if (!current_dictionary->GetDictionary( current_path.substr(0, delimiter_position), &child_dictionary)) return false; @@ -460,9 +461,15 @@ bool DictionaryValue::Get(const std::string& path, Value** out_value) const { return current_dictionary->GetWithoutPathExpansion(current_path, out_value); } +bool DictionaryValue::Get(const std::string& path, Value** out_value) { + return static_cast<const DictionaryValue&>(*this).Get( + path, + const_cast<const Value**>(out_value)); +} + bool DictionaryValue::GetBoolean(const std::string& path, bool* bool_value) const { - Value* value; + const Value* value; if (!Get(path, &value)) return false; @@ -471,7 +478,7 @@ bool DictionaryValue::GetBoolean(const std::string& path, bool DictionaryValue::GetInteger(const std::string& path, int* out_value) const { - Value* value; + const Value* value; if (!Get(path, &value)) return false; @@ -480,7 +487,7 @@ bool DictionaryValue::GetInteger(const std::string& path, bool DictionaryValue::GetDouble(const std::string& path, double* out_value) const { - Value* value; + const Value* value; if (!Get(path, &value)) return false; @@ -489,7 +496,7 @@ bool DictionaryValue::GetDouble(const std::string& path, bool DictionaryValue::GetString(const std::string& path, std::string* out_value) const { - Value* value; + const Value* value; if (!Get(path, &value)) return false; @@ -498,7 +505,7 @@ bool DictionaryValue::GetString(const std::string& path, bool DictionaryValue::GetString(const std::string& path, string16* out_value) const { - Value* value; + const Value* value; if (!Get(path, &value)) return false; @@ -521,60 +528,87 @@ bool DictionaryValue::GetStringASCII(const std::string& path, } bool DictionaryValue::GetBinary(const std::string& path, - BinaryValue** out_value) const { - Value* value; + const BinaryValue** out_value) const { + const Value* value; bool result = Get(path, &value); if (!result || !value->IsType(TYPE_BINARY)) return false; if (out_value) - *out_value = static_cast<BinaryValue*>(value); + *out_value = static_cast<const BinaryValue*>(value); return true; } +bool DictionaryValue::GetBinary(const std::string& path, + BinaryValue** out_value) { + return static_cast<const DictionaryValue&>(*this).GetBinary( + path, + const_cast<const BinaryValue**>(out_value)); +} + bool DictionaryValue::GetDictionary(const std::string& path, - DictionaryValue** out_value) const { - Value* value; + const DictionaryValue** out_value) const { + const Value* value; bool result = Get(path, &value); if (!result || !value->IsType(TYPE_DICTIONARY)) return false; if (out_value) - *out_value = static_cast<DictionaryValue*>(value); + *out_value = static_cast<const DictionaryValue*>(value); return true; } +bool DictionaryValue::GetDictionary(const std::string& path, + DictionaryValue** out_value) { + return static_cast<const DictionaryValue&>(*this).GetDictionary( + path, + const_cast<const DictionaryValue**>(out_value)); +} + bool DictionaryValue::GetList(const std::string& path, - ListValue** out_value) const { - Value* value; + const ListValue** out_value) const { + const Value* value; bool result = Get(path, &value); if (!result || !value->IsType(TYPE_LIST)) return false; if (out_value) - *out_value = static_cast<ListValue*>(value); + *out_value = static_cast<const ListValue*>(value); return true; } +bool DictionaryValue::GetList(const std::string& path, ListValue** out_value) { + return static_cast<const DictionaryValue&>(*this).GetList( + path, + const_cast<const ListValue**>(out_value)); +} + bool DictionaryValue::GetWithoutPathExpansion(const std::string& key, - Value** out_value) const { + const Value** out_value) const { DCHECK(IsStringUTF8(key)); ValueMap::const_iterator entry_iterator = dictionary_.find(key); if (entry_iterator == dictionary_.end()) return false; - Value* entry = entry_iterator->second; + const Value* entry = entry_iterator->second; if (out_value) *out_value = entry; return true; } +bool DictionaryValue::GetWithoutPathExpansion(const std::string& key, + Value** out_value) { + return static_cast<const DictionaryValue&>(*this).GetWithoutPathExpansion( + key, + const_cast<const Value**>(out_value)); +} + bool DictionaryValue::GetIntegerWithoutPathExpansion(const std::string& key, int* out_value) const { - Value* value; + const Value* value; if (!GetWithoutPathExpansion(key, &value)) return false; @@ -583,7 +617,7 @@ bool DictionaryValue::GetIntegerWithoutPathExpansion(const std::string& key, bool DictionaryValue::GetDoubleWithoutPathExpansion(const std::string& key, double* out_value) const { - Value* value; + const Value* value; if (!GetWithoutPathExpansion(key, &value)) return false; @@ -593,17 +627,16 @@ bool DictionaryValue::GetDoubleWithoutPathExpansion(const std::string& key, bool DictionaryValue::GetStringWithoutPathExpansion( const std::string& key, std::string* out_value) const { - Value* value; + const Value* value; if (!GetWithoutPathExpansion(key, &value)) return false; return value->GetAsString(out_value); } -bool DictionaryValue::GetStringWithoutPathExpansion( - const std::string& key, - string16* out_value) const { - Value* value; +bool DictionaryValue::GetStringWithoutPathExpansion(const std::string& key, + string16* out_value) const { + const Value* value; if (!GetWithoutPathExpansion(key, &value)) return false; @@ -612,31 +645,50 @@ bool DictionaryValue::GetStringWithoutPathExpansion( bool DictionaryValue::GetDictionaryWithoutPathExpansion( const std::string& key, - DictionaryValue** out_value) const { - Value* value; + const DictionaryValue** out_value) const { + const Value* value; bool result = GetWithoutPathExpansion(key, &value); if (!result || !value->IsType(TYPE_DICTIONARY)) return false; if (out_value) - *out_value = static_cast<DictionaryValue*>(value); + *out_value = static_cast<const DictionaryValue*>(value); return true; } -bool DictionaryValue::GetListWithoutPathExpansion(const std::string& key, - ListValue** out_value) const { - Value* value; +bool DictionaryValue::GetDictionaryWithoutPathExpansion( + const std::string& key, + DictionaryValue** out_value) { + const DictionaryValue& const_this = + static_cast<const DictionaryValue&>(*this); + return const_this.GetDictionaryWithoutPathExpansion( + key, + const_cast<const DictionaryValue**>(out_value)); +} + +bool DictionaryValue::GetListWithoutPathExpansion( + const std::string& key, + const ListValue** out_value) const { + const Value* value; bool result = GetWithoutPathExpansion(key, &value); if (!result || !value->IsType(TYPE_LIST)) return false; if (out_value) - *out_value = static_cast<ListValue*>(value); + *out_value = static_cast<const ListValue*>(value); return true; } +bool DictionaryValue::GetListWithoutPathExpansion(const std::string& key, + ListValue** out_value) { + return + static_cast<const DictionaryValue&>(*this).GetListWithoutPathExpansion( + key, + const_cast<const ListValue**>(out_value)); +} + bool DictionaryValue::Remove(const std::string& path, Value** out_value) { DCHECK(IsStringUTF8(path)); std::string current_path(path); @@ -677,7 +729,7 @@ DictionaryValue* DictionaryValue::DeepCopyWithoutEmptyChildren() { void DictionaryValue::MergeDictionary(const DictionaryValue* dictionary) { for (DictionaryValue::key_iterator key(dictionary->begin_keys()); key != dictionary->end_keys(); ++key) { - Value* merge_value; + const Value* merge_value; if (dictionary->GetWithoutPathExpansion(*key, &merge_value)) { // Check whether we have to merge dictionaries. if (merge_value->IsType(Value::TYPE_DICTIONARY)) { @@ -719,8 +771,8 @@ bool DictionaryValue::Equals(const Value* other) const { key_iterator lhs_it(begin_keys()); key_iterator rhs_it(other_dict->begin_keys()); while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) { - Value* lhs; - Value* rhs; + const Value* lhs; + const Value* rhs; if (*lhs_it != *rhs_it || !GetWithoutPathExpansion(*lhs_it, &lhs) || !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) || diff --git a/base/values.h b/base/values.h index f9a459e..223e0f8 100644 --- a/base/values.h +++ b/base/values.h @@ -263,7 +263,8 @@ class BASE_EXPORT DictionaryValue : public Value { // through the |out_value| parameter, and the function will return true. // Otherwise, it will return false and |out_value| will be untouched. // Note that the dictionary always owns the value that's returned. - bool Get(const std::string& path, Value** out_value) const; + bool Get(const std::string& path, const Value** out_value) const; + bool Get(const std::string& path, Value** out_value); // These are convenience forms of Get(). The value will be retrieved // and the return value will be true if the path is valid and the value at @@ -274,27 +275,36 @@ class BASE_EXPORT DictionaryValue : public Value { bool GetString(const std::string& path, std::string* out_value) const; bool GetString(const std::string& path, string16* out_value) const; bool GetStringASCII(const std::string& path, std::string* out_value) const; - bool GetBinary(const std::string& path, BinaryValue** out_value) const; + bool GetBinary(const std::string& path, const BinaryValue** out_value) const; + bool GetBinary(const std::string& path, BinaryValue** out_value); bool GetDictionary(const std::string& path, - DictionaryValue** out_value) const; - bool GetList(const std::string& path, ListValue** out_value) const; + const DictionaryValue** out_value) const; + bool GetDictionary(const std::string& path, DictionaryValue** out_value); + bool GetList(const std::string& path, const ListValue** out_value) const; + bool GetList(const std::string& path, ListValue** out_value); // Like Get(), but without special treatment of '.'. This allows e.g. URLs to // be used as paths. bool GetWithoutPathExpansion(const std::string& key, - Value** out_value) const; + const Value** out_value) const; + bool GetWithoutPathExpansion(const std::string& key, Value** out_value); bool GetIntegerWithoutPathExpansion(const std::string& key, int* out_value) const; bool GetDoubleWithoutPathExpansion(const std::string& key, - double* out_value) const; + double* out_value) const; bool GetStringWithoutPathExpansion(const std::string& key, std::string* out_value) const; bool GetStringWithoutPathExpansion(const std::string& key, string16* out_value) const; + bool GetDictionaryWithoutPathExpansion( + const std::string& key, + const DictionaryValue** out_value) const; bool GetDictionaryWithoutPathExpansion(const std::string& key, - DictionaryValue** out_value) const; + DictionaryValue** out_value); bool GetListWithoutPathExpansion(const std::string& key, - ListValue** out_value) const; + const ListValue** out_value) const; + bool GetListWithoutPathExpansion(const std::string& key, + ListValue** out_value); // Removes the Value with the specified path from this dictionary (or one // of its child dictionaries, if the path is more than just a local key). diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc index 7f20390..cb07a5f 100644 --- a/chrome/browser/background/background_contents_service.cc +++ b/chrome/browser/background/background_contents_service.cc @@ -431,7 +431,7 @@ void BackgroundContentsService::LoadBackgroundContentsFromDictionary( ExtensionService* extensions_service = profile->GetExtensionService(); DCHECK(extensions_service); - DictionaryValue* dict; + const DictionaryValue* dict; if (!contents->GetDictionaryWithoutPathExpansion(extension_id, &dict) || dict == NULL) return; diff --git a/chrome/browser/background/background_contents_service_unittest.cc b/chrome/browser/background/background_contents_service_unittest.cc index 84c4c7a..c92616e 100644 --- a/chrome/browser/background/background_contents_service_unittest.cc +++ b/chrome/browser/background/background_contents_service_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -40,7 +40,7 @@ class BackgroundContentsServiceTest : public testing::Test { std::string GetPrefURLForApp(Profile* profile, const string16& appid) { const DictionaryValue* pref = GetPrefs(profile); EXPECT_TRUE(pref->HasKey(UTF16ToUTF8(appid))); - DictionaryValue* value; + const DictionaryValue* value; pref->GetDictionaryWithoutPathExpansion(UTF16ToUTF8(appid), &value); std::string url; value->GetString("url", &url); diff --git a/chrome/browser/bookmarks/bookmark_codec.cc b/chrome/browser/bookmarks/bookmark_codec.cc index 72a6cdc..6eff50a 100644 --- a/chrome/browser/bookmarks/bookmark_codec.cc +++ b/chrome/browser/bookmarks/bookmark_codec.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -134,25 +134,27 @@ bool BookmarkCodec::DecodeHelper(BookmarkNode* bb_node, if (!d_value.GetInteger(kVersionKey, &version) || version != kCurrentVersion) return false; // Unknown version. - Value* checksum_value; + const Value* checksum_value; if (d_value.Get(kChecksumKey, &checksum_value)) { if (checksum_value->GetType() != Value::TYPE_STRING) return false; - StringValue* checksum_value_str = static_cast<StringValue*>(checksum_value); + const StringValue* checksum_value_str = + static_cast<const StringValue*>(checksum_value); if (!checksum_value_str->GetAsString(&stored_checksum_)) return false; } - Value* roots; + const Value* roots; if (!d_value.Get(kRootsKey, &roots)) return false; // No roots. if (roots->GetType() != Value::TYPE_DICTIONARY) return false; // Invalid type for roots. - DictionaryValue* roots_d_value = static_cast<DictionaryValue*>(roots); - Value* root_folder_value; - Value* other_folder_value; + const DictionaryValue* roots_d_value = + static_cast<const DictionaryValue*>(roots); + const Value* root_folder_value; + const Value* other_folder_value; if (!roots_d_value->Get(kRootFolderNameKey, &root_folder_value) || root_folder_value->GetType() != Value::TYPE_DICTIONARY || !roots_d_value->Get(kOtherBookmarkFolderNameKey, &other_folder_value) || @@ -160,18 +162,18 @@ bool BookmarkCodec::DecodeHelper(BookmarkNode* bb_node, return false; // Invalid type for root folder and/or other // folder. } - DecodeNode(*static_cast<DictionaryValue*>(root_folder_value), NULL, + DecodeNode(*static_cast<const DictionaryValue*>(root_folder_value), NULL, bb_node); - DecodeNode(*static_cast<DictionaryValue*>(other_folder_value), NULL, + DecodeNode(*static_cast<const DictionaryValue*>(other_folder_value), NULL, other_folder_node); // Fail silently if we can't deserialize mobile bookmarks. We can't require // them to exist in order to be backwards-compatible with older versions of // chrome. - Value* mobile_folder_value; + const Value* mobile_folder_value; if (roots_d_value->Get(kMobileBookmarkFolderNameKey, &mobile_folder_value) && mobile_folder_value->GetType() == Value::TYPE_DICTIONARY) { - DecodeNode(*static_cast<DictionaryValue*>(mobile_folder_value), NULL, + DecodeNode(*static_cast<const DictionaryValue*>(mobile_folder_value), NULL, mobile_folder_node); } else { // If we didn't find the mobile folder, we're almost guaranteed to have a @@ -287,7 +289,7 @@ bool BookmarkCodec::DecodeNode(const DictionaryValue& value, if (!value.GetString(kDateModifiedKey, &last_modified_date)) last_modified_date = base::Int64ToString(Time::Now().ToInternalValue()); - Value* child_values; + const Value* child_values; if (!value.Get(kChildrenKey, &child_values)) return false; @@ -311,7 +313,7 @@ bool BookmarkCodec::DecodeNode(const DictionaryValue& value, UpdateChecksumWithFolderNode(id_string, title); - if (!DecodeChildren(*static_cast<ListValue*>(child_values), node)) + if (!DecodeChildren(*static_cast<const ListValue*>(child_values), node)) return false; } diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc index aa6d7b0..2800e52 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -292,7 +292,7 @@ class Writer : public base::RefCountedThreadSafe<Writer> { // Folder. std::string last_modified_date; - Value* child_values; + const Value* child_values; if (!value.GetString(BookmarkCodec::kDateModifiedKey, &last_modified_date) || !value.Get(BookmarkCodec::kChildrenKey, &child_values) || @@ -331,7 +331,7 @@ class Writer : public base::RefCountedThreadSafe<Writer> { } // Write the children. - ListValue* children = static_cast<ListValue*>(child_values); + const ListValue* children = static_cast<const ListValue*>(child_values); for (size_t i = 0; i < children->GetSize(); ++i) { Value* child_value; if (!children->Get(i, &child_value) || @@ -339,7 +339,7 @@ class Writer : public base::RefCountedThreadSafe<Writer> { NOTREACHED(); return false; } - if (!WriteNode(*static_cast<DictionaryValue*>(child_value), + if (!WriteNode(*static_cast<const DictionaryValue*>(child_value), BookmarkNode::FOLDER)) { return false; } diff --git a/chrome/browser/chromeos/cros/certificate_pattern.cc b/chrome/browser/chromeos/cros/certificate_pattern.cc index 059fa47..72f6e01 100644 --- a/chrome/browser/chromeos/cros/certificate_pattern.cc +++ b/chrome/browser/chromeos/cros/certificate_pattern.cc @@ -316,8 +316,8 @@ DictionaryValue* CertificatePattern::CreateAsDictionary() const { } bool CertificatePattern::CopyFromDictionary(const DictionaryValue &dict) { - DictionaryValue* child_dict = NULL; - ListValue* child_list = NULL; + const DictionaryValue* child_dict = NULL; + const ListValue* child_list = NULL; Clear(); // All of these are optional. diff --git a/chrome/browser/chromeos/cros/native_network_parser.cc b/chrome/browser/chromeos/cros/native_network_parser.cc index cbc393e..79740c4 100644 --- a/chrome/browser/chromeos/cros/native_network_parser.cc +++ b/chrome/browser/chromeos/cros/native_network_parser.cc @@ -551,7 +551,7 @@ bool NativeNetworkDeviceParser::ParseSimLockStateFromDictionary( std::string state_string; // Since RetriesLeft is sent as a uint32, which may overflow int32 range, from // Flimflam, it may be stored as an integer or a double in DictionaryValue. - base::Value* retries_value = NULL; + const base::Value* retries_value = NULL; if (!info.GetString(flimflam::kSIMLockTypeProperty, &state_string) || !info.GetBoolean(flimflam::kSIMLockEnabledProperty, out_enabled) || !info.Get(flimflam::kSIMLockRetriesLeftProperty, &retries_value) || @@ -1289,7 +1289,7 @@ bool NativeVirtualNetworkParser::ParseValue(PropertyIndex index, for (DictionaryValue::key_iterator iter = dict.begin_keys(); iter != dict.end_keys(); ++iter) { const std::string& key = *iter; - base::Value* provider_value; + const base::Value* provider_value; bool res = dict.GetWithoutPathExpansion(key, &provider_value); DCHECK(res); if (res) { diff --git a/chrome/browser/chromeos/cros/network_library_impl_cros.cc b/chrome/browser/chromeos/cros/network_library_impl_cros.cc index 09f2eb9..27b0085 100644 --- a/chrome/browser/chromeos/cros/network_library_impl_cros.cc +++ b/chrome/browser/chromeos/cros/network_library_impl_cros.cc @@ -726,7 +726,7 @@ void NetworkLibraryImplCros::NetworkManagerUpdate( for (DictionaryValue::key_iterator iter = properties->begin_keys(); iter != properties->end_keys(); ++iter) { const std::string& key = *iter; - Value* value; + const Value* value; bool res = properties->GetWithoutPathExpansion(key, &value); CHECK(res); if (!NetworkManagerStatusChanged(key, value)) { @@ -997,7 +997,7 @@ void NetworkLibraryImplCros::UpdateProfile( return; } VLOG(1) << "UpdateProfile for path: " << profile_path; - ListValue* profile_entries(NULL); + const ListValue* profile_entries(NULL); properties->GetList(flimflam::kEntriesProperty, &profile_entries); if (!profile_entries) { LOG(ERROR) << "'Entries' property is missing."; diff --git a/chrome/browser/chromeos/cros/network_parser.cc b/chrome/browser/chromeos/cros/network_parser.cc index 9fcdcaf..686904d 100644 --- a/chrome/browser/chromeos/cros/network_parser.cc +++ b/chrome/browser/chromeos/cros/network_parser.cc @@ -38,7 +38,7 @@ bool NetworkDeviceParser::UpdateDeviceFromInfo(const DictionaryValue& info, for (DictionaryValue::key_iterator iter = info.begin_keys(); iter != info.end_keys(); ++iter) { const std::string& key = *iter; - base::Value* value; + const base::Value* value; bool result = info.GetWithoutPathExpansion(key, &value); DCHECK(result); if (result) @@ -112,7 +112,7 @@ bool NetworkParser::UpdateNetworkFromInfo(const DictionaryValue& info, for (DictionaryValue::key_iterator iter = info.begin_keys(); iter != info.end_keys(); ++iter) { const std::string& key = *iter; - base::Value* value; + const base::Value* value; bool res = info.GetWithoutPathExpansion(key, &value); DCHECK(res); if (res) // Use network's parser to update status diff --git a/chrome/browser/chromeos/cros/network_ui_data.cc b/chrome/browser/chromeos/cros/network_ui_data.cc index 42148ff2..e2abeab 100644 --- a/chrome/browser/chromeos/cros/network_ui_data.cc +++ b/chrome/browser/chromeos/cros/network_ui_data.cc @@ -46,7 +46,7 @@ NetworkUIData::NetworkUIData(const DictionaryValue& dict) { } else { onc_source_ = ONC_SOURCE_NONE; } - DictionaryValue* cert_dict = NULL; + const DictionaryValue* cert_dict = NULL; if (dict.GetDictionary(kKeyCertificatePattern, &cert_dict) && cert_dict) certificate_pattern_.CopyFromDictionary(*cert_dict); std::string type_string; @@ -142,12 +142,12 @@ void NetworkPropertyUIData::ParseOncProperty( } recommended_property_key += "Recommended"; - base::ListValue* recommended_keys = NULL; + const base::ListValue* recommended_keys = NULL; if (onc->GetList(recommended_property_key, &recommended_keys)) { base::StringValue basename_value(property_basename); if (recommended_keys->Find(basename_value) != recommended_keys->end()) { controller_ = CONTROLLER_USER; - base::Value* default_value = NULL; + const base::Value* default_value = NULL; if (onc->Get(property_key, &default_value)) default_value_.reset(default_value->DeepCopy()); } diff --git a/chrome/browser/chromeos/cros/onc_network_parser.cc b/chrome/browser/chromeos/cros/onc_network_parser.cc index 2b5a349..86376d6 100644 --- a/chrome/browser/chromeos/cros/onc_network_parser.cc +++ b/chrome/browser/chromeos/cros/onc_network_parser.cc @@ -621,7 +621,7 @@ bool OncNetworkParser::ParseNestedObject(Network* network, if (key == onc::kRecommended) continue; - base::Value* inner_value = NULL; + const base::Value* inner_value = NULL; dict->GetWithoutPathExpansion(key, &inner_value); CHECK(inner_value != NULL); int field_index; diff --git a/chrome/browser/chromeos/gdata/gdata_wapi_parser.cc b/chrome/browser/chromeos/gdata/gdata_wapi_parser.cc index 79ac073..f604f35 100644 --- a/chrome/browser/chromeos/gdata/gdata_wapi_parser.cc +++ b/chrome/browser/chromeos/gdata/gdata_wapi_parser.cc @@ -696,7 +696,7 @@ void DocumentEntry::FillRemainingFields() { DocumentEntry* DocumentEntry::ExtractAndParse( const base::Value& value) { const base::DictionaryValue* as_dict = NULL; - base::DictionaryValue* entry_dict = NULL; + const base::DictionaryValue* entry_dict = NULL; if (value.GetAsDictionary(&as_dict) && as_dict->GetDictionary(kEntryField, &entry_dict)) { return DocumentEntry::CreateFrom(*entry_dict); @@ -859,7 +859,7 @@ bool DocumentFeed::Parse(const base::Value& value) { scoped_ptr<DocumentFeed> DocumentFeed::ExtractAndParse( const base::Value& value) { const base::DictionaryValue* as_dict = NULL; - base::DictionaryValue* feed_dict = NULL; + const base::DictionaryValue* feed_dict = NULL; if (value.GetAsDictionary(&as_dict) && as_dict->GetDictionary(kFeedField, &feed_dict)) { return DocumentFeed::CreateFrom(*feed_dict); @@ -1007,7 +1007,7 @@ scoped_ptr<AccountMetadataFeed> AccountMetadataFeed::CreateFrom( const base::Value& value) { scoped_ptr<AccountMetadataFeed> feed(new AccountMetadataFeed()); const base::DictionaryValue* dictionary = NULL; - base::Value* entry = NULL; + const base::Value* entry = NULL; if (!value.GetAsDictionary(&dictionary) || !dictionary->Get(kEntryField, &entry) || !feed->Parse(*entry)) { diff --git a/chrome/browser/chromeos/login/user_manager_impl.cc b/chrome/browser/chromeos/login/user_manager_impl.cc index 9eb7b3c..6257ebb 100644 --- a/chrome/browser/chromeos/login/user_manager_impl.cc +++ b/chrome/browser/chromeos/login/user_manager_impl.cc @@ -837,7 +837,7 @@ void UserManagerImpl::EnsureUsersLoaded() { // TODO(avayvod): Reading image path as a string is here for // backward compatibility. std::string image_path; - base::DictionaryValue* image_properties; + const base::DictionaryValue* image_properties; if (prefs_images->GetStringWithoutPathExpansion(email, &image_path)) { int image_id = User::kInvalidImageIndex; if (IsDefaultImagePath(image_path, &image_id)) { @@ -1153,7 +1153,7 @@ void UserManagerImpl::GetUserWallpaperProperties(const std::string& username, if (!username.empty()) { const DictionaryValue* user_wallpapers = g_browser_process->local_state()-> GetDictionary(UserManager::kUserWallpapersProperties); - base::DictionaryValue* wallpaper_properties; + const base::DictionaryValue* wallpaper_properties; if (user_wallpapers->GetDictionaryWithoutPathExpansion( username, &wallpaper_properties)) { diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc index d19fdb3..6dfb9ad 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider.cc @@ -561,7 +561,7 @@ void PrefProvider::MigrateObsoleteContentSettingsPatternPref() { // Copy the legacy content settings for the current |key| from the // obsolete pref prefs::kContentSettingsPatterns to the pref // prefs::kContentSettingsPatternPairs. - DictionaryValue* dictionary = NULL; + const DictionaryValue* dictionary = NULL; bool found = patterns_dictionary->GetDictionaryWithoutPathExpansion( key, &dictionary); DCHECK(found); @@ -599,7 +599,7 @@ void PrefProvider::MigrateObsoleteGeolocationPref() { GURL primary_url(primary_key); DCHECK(primary_url.is_valid()); - DictionaryValue* requesting_origin_settings = NULL; + const DictionaryValue* requesting_origin_settings = NULL; // The method GetDictionaryWithoutPathExpansion() returns false if the // value for the given key is not a |DictionaryValue|. If the value for the // |primary_key| is not a |DictionaryValue| then the location settings for @@ -620,7 +620,7 @@ void PrefProvider::MigrateObsoleteGeolocationPref() { continue; } - base::Value* value = NULL; + const base::Value* value = NULL; bool found = requesting_origin_settings->GetWithoutPathExpansion( secondary_key, &value); DCHECK(found); diff --git a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc index caa7d52..7ab4c2f 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc @@ -42,7 +42,7 @@ void ExpectObsoleteGeolocationSetting( const GURL& secondary_origin, ContentSetting expected_setting) { - DictionaryValue* one_origin_settings; + const DictionaryValue* one_origin_settings; ASSERT_TRUE(geo_settings_dictionary.GetDictionaryWithoutPathExpansion( std::string(primary_origin.spec()), &one_origin_settings)); int setting_value; diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc index 540dadf..8075666 100644 --- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc +++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc @@ -713,7 +713,7 @@ TEST_F(HostContentSettingsMapTest, CanonicalizeExceptionsUnicodeOnly) { const DictionaryValue* all_settings_dictionary = prefs->GetDictionary(prefs::kContentSettingsPatternPairs); - DictionaryValue* result = NULL; + const DictionaryValue* result = NULL; EXPECT_FALSE(all_settings_dictionary->GetDictionaryWithoutPathExpansion( "[*.]\xC4\x87ira.com,*", &result)); EXPECT_TRUE(all_settings_dictionary->GetDictionaryWithoutPathExpansion( diff --git a/chrome/browser/debugger/devtools_file_helper.cc b/chrome/browser/debugger/devtools_file_helper.cc index 188c8c8..7db0f09 100644 --- a/chrome/browser/debugger/devtools_file_helper.cc +++ b/chrome/browser/debugger/devtools_file_helper.cc @@ -137,7 +137,7 @@ void DevToolsFileHelper::Save(const std::string& url, profile_->GetPrefs()->GetDictionary(prefs::kDevToolsEditedFiles); FilePath initial_path; - Value* path_value; + const Value* path_value; if (file_map->Get(base::MD5String(url), &path_value)) base::GetValueAsFilePath(*path_value, &initial_path); diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc index 7a3315b..afdb914 100644 --- a/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc +++ b/chrome/browser/extensions/api/browsing_data/browsing_data_api.cc @@ -192,7 +192,7 @@ int BrowsingDataExtensionFunction::ParseOriginSetMask( // UNPROTECTED_WEB if the developer doesn't specify anything. int mask = BrowsingDataHelper::UNPROTECTED_WEB; - DictionaryValue* d = NULL; + const DictionaryValue* d = NULL; if (options.HasKey(extension_browsing_data_api_constants::kOriginTypesKey)) { EXTENSION_FUNCTION_VALIDATE(options.GetDictionary( extension_browsing_data_api_constants::kOriginTypesKey, &d)); diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc index 8b9124f..99290a7 100644 --- a/chrome/browser/extensions/api/commands/command_service.cc +++ b/chrome/browser/extensions/api/commands/command_service.cc @@ -170,7 +170,7 @@ ui::Accelerator CommandService::FindShortcutForCommand( profile_->GetPrefs()->GetDictionary(prefs::kExtensionKeybindings); for (DictionaryValue::key_iterator it = bindings->begin_keys(); it != bindings->end_keys(); ++it) { - DictionaryValue* item = NULL; + const DictionaryValue* item = NULL; bindings->GetDictionary(*it, &item); std::string extension; diff --git a/chrome/browser/extensions/api/context_menu/context_menu_api.cc b/chrome/browser/extensions/api/context_menu/context_menu_api.cc index acc80a4..15f1af2 100644 --- a/chrome/browser/extensions/api/context_menu/context_menu_api.cc +++ b/chrome/browser/extensions/api/context_menu/context_menu_api.cc @@ -59,7 +59,7 @@ bool ExtensionContextMenuFunction::ParseContexts( const DictionaryValue& properties, const char* key, MenuItem::ContextList* result) { - ListValue* list = NULL; + const ListValue* list = NULL; if (!properties.GetList(key, &list)) { return true; } @@ -157,7 +157,7 @@ bool ExtensionContextMenuFunction::GetParent(const DictionaryValue& properties, if (!properties.HasKey(kParentIdKey)) return true; MenuItem::Id parent_id(profile()->IsOffTheRecord(), extension_id()); - Value* parent_id_value = NULL; + const Value* parent_id_value = NULL; if (properties.Get(kParentIdKey, &parent_id_value) && !ParseID(parent_id_value, &parent_id)) return false; diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc index de04788..16d0a09 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc @@ -166,14 +166,14 @@ bool ExtensionOmniboxSuggestion::Populate(const base::DictionaryValue& value, description_styles.clear(); if (value.HasKey(kSuggestionDescriptionStyles)) { // This version comes from the extension. - ListValue* styles = NULL; + const ListValue* styles = NULL; if (!value.GetList(kSuggestionDescriptionStyles, &styles) || !ReadStylesFromValue(*styles)) { return false; } } else if (value.HasKey(kSuggestionDescriptionStylesRaw)) { // This version comes from ToValue(), which we use to persist to disk. - ListValue* styles = NULL; + const ListValue* styles = NULL; if (!value.GetList(kSuggestionDescriptionStylesRaw, &styles) || styles->empty()) { return false; diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc b/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc index 9405849..2b1a44a 100644 --- a/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc +++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc @@ -80,7 +80,7 @@ bool GetPacMandatoryFromExtensionPref(const DictionaryValue* proxy_config, bool* out, std::string* error, bool* bad_message){ - DictionaryValue* pac_dict = NULL; + const DictionaryValue* pac_dict = NULL; proxy_config->GetDictionary(keys::kProxyConfigPacScript, &pac_dict); if (!pac_dict) return true; @@ -101,7 +101,7 @@ bool GetPacUrlFromExtensionPref(const DictionaryValue* proxy_config, std::string* out, std::string* error, bool* bad_message) { - DictionaryValue* pac_dict = NULL; + const DictionaryValue* pac_dict = NULL; proxy_config->GetDictionary(keys::kProxyConfigPacScript, &pac_dict); if (!pac_dict) return true; @@ -127,7 +127,7 @@ bool GetPacDataFromExtensionPref(const DictionaryValue* proxy_config, std::string* out, std::string* error, bool* bad_message) { - DictionaryValue* pac_dict = NULL; + const DictionaryValue* pac_dict = NULL; proxy_config->GetDictionary(keys::kProxyConfigPacScript, &pac_dict); if (!pac_dict) return true; @@ -193,7 +193,7 @@ bool GetProxyRulesStringFromExtensionPref(const DictionaryValue* proxy_config, std::string* out, std::string* error, bool* bad_message) { - DictionaryValue* proxy_rules = NULL; + const DictionaryValue* proxy_rules = NULL; proxy_config->GetDictionary(keys::kProxyConfigRules, &proxy_rules); if (!proxy_rules) return true; @@ -208,7 +208,7 @@ bool GetProxyRulesStringFromExtensionPref(const DictionaryValue* proxy_config, // singleProxy that will supersede per-URL proxies, but it's worth it to keep // the code simple and extensible. for (size_t i = 0; i <= keys::SCHEME_MAX; ++i) { - DictionaryValue* proxy_dict = NULL; + const DictionaryValue* proxy_dict = NULL; has_proxy[i] = proxy_rules->GetDictionary(keys::field_name[i], &proxy_dict); if (has_proxy[i]) { @@ -256,7 +256,7 @@ bool GetProxyRulesStringFromExtensionPref(const DictionaryValue* proxy_config, return true; } -bool JoinUrlList(ListValue* list, +bool JoinUrlList(const ListValue* list, const std::string& joiner, std::string* out, std::string* error, @@ -288,7 +288,7 @@ bool GetBypassListFromExtensionPref(const DictionaryValue* proxy_config, std::string *out, std::string* error, bool* bad_message) { - DictionaryValue* proxy_rules = NULL; + const DictionaryValue* proxy_rules = NULL; proxy_config->GetDictionary(keys::kProxyConfigRules, &proxy_rules); if (!proxy_rules) return true; @@ -297,7 +297,7 @@ bool GetBypassListFromExtensionPref(const DictionaryValue* proxy_config, *out = ""; return true; } - ListValue* bypass_list = NULL; + const ListValue* bypass_list = NULL; if (!proxy_rules->GetList(keys::kProxyConfigBypassList, &bypass_list)) { LOG(ERROR) << "'rules.bypassList' could not be parsed."; *bad_message = true; diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers.h b/chrome/browser/extensions/api/proxy/proxy_api_helpers.h index a4b06b2..064b5c2 100644 --- a/chrome/browser/extensions/api/proxy/proxy_api_helpers.h +++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers.h @@ -100,7 +100,7 @@ bool GetProxyServer(const base::DictionaryValue* proxy_server, // Joins a list of URLs (stored as StringValues) in |list| with |joiner| // to |out|. Returns true if successful and sets |error| otherwise. -bool JoinUrlList(base::ListValue* list, +bool JoinUrlList(const base::ListValue* list, const std::string& joiner, std::string* out, std::string* error, diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index e3d168a..10f1d58 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -175,7 +175,7 @@ bool FromHeaderDictionary(const DictionaryValue* header_value, return false; } } else if (header_value->HasKey(keys::kHeaderBinaryValueKey)) { - ListValue* list = NULL; + const ListValue* list = NULL; if (!header_value->GetList(keys::kHeaderBinaryValueKey, &list) || !helpers::CharListToString(list, value)) { return false; @@ -350,7 +350,7 @@ bool ExtensionWebRequestEventRouter::RequestFilter::InitFromValue( for (DictionaryValue::key_iterator key = value.begin_keys(); key != value.end_keys(); ++key) { if (*key == "urls") { - ListValue* urls_value = NULL; + const ListValue* urls_value = NULL; if (!value.GetList("urls", &urls_value)) return false; for (size_t i = 0; i < urls_value->GetSize(); ++i) { @@ -368,7 +368,7 @@ bool ExtensionWebRequestEventRouter::RequestFilter::InitFromValue( urls.AddPattern(pattern); } } else if (*key == "types") { - ListValue* types_value = NULL; + const ListValue* types_value = NULL; if (!value.GetList("types", &types_value)) return false; for (size_t i = 0; i < types_value->GetSize(); ++i) { diff --git a/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc b/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc index fad5eda..da74647 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc @@ -117,7 +117,7 @@ ListValue* StringToCharList(const std::string& s) { return result; } -bool CharListToString(ListValue* list, std::string* out) { +bool CharListToString(const ListValue* list, std::string* out) { if (!list) return false; const size_t list_length = list->GetSize(); diff --git a/chrome/browser/extensions/api/web_request/web_request_api_helpers.h b/chrome/browser/extensions/api/web_request/web_request_api_helpers.h index cbe536b..ea748e4 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_helpers.h +++ b/chrome/browser/extensions/api/web_request/web_request_api_helpers.h @@ -91,7 +91,7 @@ base::ListValue* StringToCharList(const std::string& s); // Converts a list of integer values between 0 and 255 into a string |*out|. // Returns true if the conversion was successful. -bool CharListToString(base::ListValue* list, std::string* out); +bool CharListToString(const base::ListValue* list, std::string* out); // The following functions calculate and return the modifications to requests // commanded by extension handlers. All functions take the id of the extension diff --git a/chrome/browser/extensions/event_listener_map.cc b/chrome/browser/extensions/event_listener_map.cc index aa52f771..4d0c9fc 100644 --- a/chrome/browser/extensions/event_listener_map.cc +++ b/chrome/browser/extensions/event_listener_map.cc @@ -169,7 +169,7 @@ void EventListenerMap::LoadFilteredLazyListeners( for (DictionaryValue::key_iterator it = filtered.begin_keys(); it != filtered.end_keys(); ++it) { // We skip entries if they are malformed. - ListValue* filter_list = NULL; + const ListValue* filter_list = NULL; if (!filtered.GetListWithoutPathExpansion(*it, &filter_list)) continue; for (size_t i = 0; i < filter_list->GetSize(); i++) { diff --git a/chrome/browser/extensions/extension_override_apitest.cc b/chrome/browser/extensions/extension_override_apitest.cc index 69c65e6..bae1041 100644 --- a/chrome/browser/extensions/extension_override_apitest.cc +++ b/chrome/browser/extensions/extension_override_apitest.cc @@ -25,7 +25,7 @@ class ExtensionOverrideTest : public ExtensionApiTest { browser()->profile()->GetPrefs()->GetDictionary( ExtensionWebUI::kExtensionURLOverrides); - ListValue* values = NULL; + const ListValue* values = NULL; if (!overrides->GetList("history", &values)) return false; diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index dbbbf8d..9676f74 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -311,7 +311,7 @@ void ExtensionPrefs::MakePathsRelative() { std::set<std::string> absolute_keys; for (DictionaryValue::key_iterator i = dict->begin_keys(); i != dict->end_keys(); ++i) { - DictionaryValue* extension_dict = NULL; + const DictionaryValue* extension_dict = NULL; if (!dict->GetDictionaryWithoutPathExpansion(*i, &extension_dict)) continue; int location_value; @@ -332,7 +332,7 @@ void ExtensionPrefs::MakePathsRelative() { // Fix these paths. DictionaryPrefUpdate update(prefs_, kExtensionsPref); - const DictionaryValue* update_dict = update.Get(); + DictionaryValue* update_dict = update.Get(); for (std::set<std::string>::iterator i = absolute_keys.begin(); i != absolute_keys.end(); ++i) { DictionaryValue* extension_dict = NULL; @@ -430,7 +430,7 @@ bool ExtensionPrefs::ReadExtensionPrefList( const std::string& extension_id, const std::string& pref_key, const ListValue** out_value) const { const DictionaryValue* ext = GetExtensionPref(extension_id); - ListValue* out = NULL; + const ListValue* out = NULL; if (!ext || !ext->GetList(pref_key, &out)) return false; if (out_value) @@ -540,7 +540,7 @@ void ExtensionPrefs::SetExtensionPrefPermissionSet( } // static -bool ExtensionPrefs::IsBlacklistBitSet(DictionaryValue* ext) { +bool ExtensionPrefs::IsBlacklistBitSet(const DictionaryValue* ext) { return ReadBooleanFromPref(ext, kPrefBlacklist); } @@ -707,7 +707,7 @@ void ExtensionPrefs::UpdateBlacklist( if (extensions) { for (DictionaryValue::key_iterator extension_id = extensions->begin_keys(); extension_id != extensions->end_keys(); ++extension_id) { - DictionaryValue* ext; + const DictionaryValue* ext; if (!extensions->GetDictionaryWithoutPathExpansion(*extension_id, &ext)) { NOTREACHED() << "Invalid pref for extension " << *extension_id; continue; @@ -848,7 +848,7 @@ void ExtensionPrefs::MigratePermissions(const ExtensionIdSet& extension_ids) { // Add the plugin permission if the full access bit was set. if (full_access) { - ListValue* apis = NULL; + const ListValue* apis = NULL; ListValue* new_apis = NULL; std::string granted_apis = @@ -870,7 +870,7 @@ void ExtensionPrefs::MigratePermissions(const ExtensionIdSet& extension_ids) { // does not matter how we treat the old effective hosts as long as the // new effective hosts will be the same, so we move them to explicit // host permissions. - ListValue* hosts; + const ListValue* hosts; std::string explicit_hosts = JoinPrefs(kPrefGrantedPermissions, kPrefExplicitHosts); if (ext->GetList(kPrefOldGrantedHosts, &hosts)) { @@ -945,7 +945,7 @@ std::set<std::string> ExtensionPrefs::GetRegisteredEvents( if (!extension) return events; - ListValue* value = NULL; + const ListValue* value = NULL; if (!extension->GetList(kRegisteredEvents, &value)) return events; @@ -1004,7 +1004,7 @@ const DictionaryValue* ExtensionPrefs::GetFilteredEvents( const DictionaryValue* extension = GetExtensionPref(extension_id); if (!extension) return NULL; - DictionaryValue* result = NULL; + const DictionaryValue* result = NULL; if (!extension->GetDictionary(kFilteredEvents, &result)) return NULL; return result; @@ -1024,8 +1024,8 @@ ExtensionOmniboxSuggestion ExtensionPrefs::GetOmniboxDefaultSuggestion(const std::string& extension_id) { ExtensionOmniboxSuggestion suggestion; - const base::DictionaryValue* extension = GetExtensionPref(extension_id); - base::DictionaryValue* dict = NULL; + const DictionaryValue* extension = GetExtensionPref(extension_id); + const DictionaryValue* dict = NULL; if (extension && extension->GetDictionary(kOmniboxDefaultSuggestion, &dict)) suggestion.Populate(*dict, false); @@ -1336,7 +1336,7 @@ void ExtensionPrefs::UpdateManifest(const Extension* extension) { const DictionaryValue* extension_dict = GetExtensionPref(extension->id()); if (!extension_dict) return; - DictionaryValue* old_manifest = NULL; + const DictionaryValue* old_manifest = NULL; bool update_required = !extension_dict->GetDictionary(kPrefManifest, &old_manifest) || !extension->manifest()->value()->Equals(old_manifest); @@ -1386,7 +1386,7 @@ const DictionaryValue* ExtensionPrefs::GetExtensionPref( const DictionaryValue* dict = prefs_->GetDictionary(kExtensionsPref); if (!dict) return NULL; - DictionaryValue* extension = NULL; + const DictionaryValue* extension = NULL; dict->GetDictionary(extension_id, &extension); return extension; } @@ -1518,7 +1518,7 @@ bool ExtensionPrefs::GetIdleInstallInfo(const std::string& extension_id, // Do all the reads from the prefs together, and don't do any assignment // to the out parameters unless all the reads succeed. - DictionaryValue* info = NULL; + const DictionaryValue* info = NULL; if (!extension_prefs->GetDictionary(kIdleInstallInfo, &info)) return false; @@ -1683,7 +1683,7 @@ ExtensionPrefs::ExtensionIdSet ExtensionPrefs::GetExtensionsFrom( ExtensionIdSet result; for (base::DictionaryValue::key_iterator it = extension_prefs->begin_keys(); it != extension_prefs->end_keys(); ++it) { - DictionaryValue* ext; + const DictionaryValue* ext; if (!extension_prefs->GetDictionaryWithoutPathExpansion(*it, &ext)) { NOTREACHED() << "Invalid pref for extension " << *it; continue; @@ -1718,7 +1718,7 @@ void ExtensionPrefs::LoadExtensionControlledPrefs( bool success = ScopeToPrefKey(scope, &scope_string); DCHECK(success); std::string key = extension_id + "." + scope_string; - DictionaryValue* preferences = NULL; + const DictionaryValue* preferences = NULL; // First try the regular lookup. const DictionaryValue* source_dict = prefs_->GetDictionary(kExtensionsPref); if (!source_dict->GetDictionary(key, &preferences)) @@ -1778,7 +1778,7 @@ void ExtensionPrefs::InitPrefStore(bool extensions_disabled) { // Set content settings. const DictionaryValue* extension_prefs = GetExtensionPref(*ext_id); DCHECK(extension_prefs); - ListValue* content_settings = NULL; + const ListValue* content_settings = NULL; if (extension_prefs->GetList(kPrefContentSettings, &content_settings)) { content_settings_store_->SetExtensionContentSettingFromList( diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h index 51d6116..70565fa 100644 --- a/chrome/browser/extensions/extension_prefs.h +++ b/chrome/browser/extensions/extension_prefs.h @@ -526,7 +526,7 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, // Checks if kPrefBlacklist is set to true in the DictionaryValue. // Return false if the value is false or kPrefBlacklist does not exist. // This is used to decide if an extension is blacklisted. - static bool IsBlacklistBitSet(base::DictionaryValue* ext); + static bool IsBlacklistBitSet(const base::DictionaryValue* ext); // Fix missing preference entries in the extensions that are were introduced // in a later Chrome version. diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index a12bded..3475aa7 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -827,7 +827,7 @@ class ExtensionServiceTest const DictionaryValue* dict = prefs->GetDictionary("extensions.settings"); ASSERT_TRUE(dict != NULL) << msg; - DictionaryValue* pref = NULL; + const DictionaryValue* pref = NULL; ASSERT_TRUE(dict->GetDictionary(extension_id, &pref)) << msg; EXPECT_TRUE(pref != NULL) << msg; bool val; @@ -840,7 +840,7 @@ class ExtensionServiceTest const DictionaryValue* dict = profile_->GetPrefs()->GetDictionary("extensions.settings"); if (dict == NULL) return false; - DictionaryValue* pref = NULL; + const DictionaryValue* pref = NULL; if (!dict->GetDictionary(extension_id, &pref)) { return false; } @@ -868,7 +868,7 @@ class ExtensionServiceTest const DictionaryValue* dict = prefs->GetDictionary("extensions.settings"); ASSERT_TRUE(dict != NULL) << msg; - DictionaryValue* pref = NULL; + const DictionaryValue* pref = NULL; ASSERT_TRUE(dict->GetDictionary(extension_id, &pref)) << msg; EXPECT_TRUE(pref != NULL) << msg; int val; @@ -889,7 +889,7 @@ class ExtensionServiceTest const DictionaryValue* dict = profile_->GetPrefs()->GetDictionary("extensions.settings"); ASSERT_TRUE(dict != NULL) << msg; - DictionaryValue* pref = NULL; + const DictionaryValue* pref = NULL; std::string manifest_path = extension_id + ".manifest"; ASSERT_TRUE(dict->GetDictionary(manifest_path, &pref)) << msg; EXPECT_TRUE(pref != NULL) << msg; diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc index 57b0e5f..ad4233b 100644 --- a/chrome/browser/extensions/extension_web_ui.cc +++ b/chrome/browser/extensions/extension_web_ui.cc @@ -224,7 +224,7 @@ bool ExtensionWebUI::HandleChromeURLOverride( const DictionaryValue* overrides = profile->GetPrefs()->GetDictionary(kExtensionURLOverrides); std::string page = url->host(); - ListValue* url_list; + const ListValue* url_list; if (!overrides || !overrides->GetList(page, &url_list)) return false; @@ -297,7 +297,7 @@ bool ExtensionWebUI::HandleChromeURLOverrideReverse( // chrome://bookmarks/#1 for display in the omnibox. for (DictionaryValue::key_iterator it = overrides->begin_keys(), end = overrides->end_keys(); it != end; ++it) { - ListValue* url_list; + const ListValue* url_list; if (!overrides->GetList(*it, &url_list)) continue; diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc index e599f3b..92154f9 100644 --- a/chrome/browser/extensions/menu_manager.cc +++ b/chrome/browser/extensions/menu_manager.cc @@ -219,7 +219,7 @@ MenuItem* MenuItem::Populate(const std::string& extension_id, if (!value.GetBoolean(kEnabledKey, &enabled)) return NULL; ContextList contexts; - Value* contexts_value = NULL; + const Value* contexts_value = NULL; if (!value.Get(kContextsKey, &contexts_value)) return NULL; if (!contexts.Populate(*contexts_value)) @@ -248,7 +248,7 @@ bool MenuItem::PopulateURLPatterns(const DictionaryValue& properties, const char* target_url_patterns_key, std::string* error) { if (properties.HasKey(document_url_patterns_key)) { - ListValue* list = NULL; + const ListValue* list = NULL; if (!properties.GetList(document_url_patterns_key, &list)) return false; if (!document_url_patterns_.Populate( @@ -257,7 +257,7 @@ bool MenuItem::PopulateURLPatterns(const DictionaryValue& properties, } } if (properties.HasKey(target_url_patterns_key)) { - ListValue* list = NULL; + const ListValue* list = NULL; if (!properties.GetList(target_url_patterns_key, &list)) return false; if (!target_url_patterns_.Populate( diff --git a/chrome/browser/gpu_blacklist.cc b/chrome/browser/gpu_blacklist.cc index 685227c..84999eb 100644 --- a/chrome/browser/gpu_blacklist.cc +++ b/chrome/browser/gpu_blacklist.cc @@ -903,7 +903,7 @@ bool GpuBlacklist::LoadGpuBlacklist( if (!version_->IsValid()) return false; - ListValue* list = NULL; + const ListValue* list = NULL; if (!parsed_json.GetList("entries", &list)) return false; @@ -1118,4 +1118,3 @@ GpuBlacklist::NumericOp GpuBlacklist::StringToNumericOp( return kBetween; return kUnknown; } - diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 2379dc6..69fd3f8 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -819,7 +819,7 @@ void MetricsLog::WriteAllProfilesMetrics( i != all_profiles_metrics.end_keys(); ++i) { const std::string& key_name = *i; if (key_name.compare(0, profile_prefix.size(), profile_prefix) == 0) { - DictionaryValue* profile; + const DictionaryValue* profile; if (all_profiles_metrics.GetDictionaryWithoutPathExpansion(key_name, &profile)) WriteProfileMetrics(key_name.substr(profile_prefix.size()), *profile); @@ -833,7 +833,7 @@ void MetricsLog::WriteProfileMetrics(const std::string& profileidhash, WriteAttribute("profileidhash", profileidhash); for (DictionaryValue::key_iterator i = profile_metrics.begin_keys(); i != profile_metrics.end_keys(); ++i) { - Value* value; + const Value* value; if (profile_metrics.GetWithoutPathExpansion(*i, &value)) { DCHECK(*i != "id"); switch (value->GetType()) { diff --git a/chrome/browser/net/http_server_properties_manager.cc b/chrome/browser/net/http_server_properties_manager.cc index a23002c..94e4e02 100644 --- a/chrome/browser/net/http_server_properties_manager.cc +++ b/chrome/browser/net/http_server_properties_manager.cc @@ -253,7 +253,7 @@ void HttpServerPropertiesManager::UpdateCacheFromPrefsOnUI() { } else { // The "new" format has "version" and "servers" keys. The properties for a // given server is in http_server_properties_dict["servers"][server]. - base::DictionaryValue* servers_dict_temp = NULL; + const base::DictionaryValue* servers_dict_temp = NULL; if (!http_server_properties_dict.GetDictionaryWithoutPathExpansion( "servers", &servers_dict_temp)) { DVLOG(1) << "Malformed http_server_properties for servers"; @@ -282,7 +282,7 @@ void HttpServerPropertiesManager::UpdateCacheFromPrefsOnUI() { continue; } - base::DictionaryValue* server_pref_dict = NULL; + const base::DictionaryValue* server_pref_dict = NULL; if (!servers_dict->GetDictionaryWithoutPathExpansion( server_str, &server_pref_dict)) { DVLOG(1) << "Malformed http_server_properties server: " << server_str; @@ -300,7 +300,7 @@ void HttpServerPropertiesManager::UpdateCacheFromPrefsOnUI() { // Get SpdySettings. DCHECK(!ContainsKey(*spdy_settings_map, server)); if (version == kVersionNumber) { - base::DictionaryValue* spdy_settings_dict = NULL; + const base::DictionaryValue* spdy_settings_dict = NULL; if (server_pref_dict->GetDictionaryWithoutPathExpansion( "settings", &spdy_settings_dict)) { net::SettingsMap settings_map; @@ -341,7 +341,7 @@ void HttpServerPropertiesManager::UpdateCacheFromPrefsOnUI() { // Get alternate_protocol server. DCHECK(!ContainsKey(*alternate_protocol_map, server)); - base::DictionaryValue* port_alternate_protocol_dict = NULL; + const base::DictionaryValue* port_alternate_protocol_dict = NULL; if (!server_pref_dict->GetDictionaryWithoutPathExpansion( "alternate_protocol", &port_alternate_protocol_dict)) { continue; diff --git a/chrome/browser/plugin_finder.cc b/chrome/browser/plugin_finder.cc index 0c03e46..59a5052 100644 --- a/chrome/browser/plugin_finder.cc +++ b/chrome/browser/plugin_finder.cc @@ -83,7 +83,7 @@ PluginInstaller* PluginFinder::FindPlugin(const std::string& mime_type, bool success = plugin->GetString("lang", &language_str); if (language_str != language) continue; - ListValue* mime_types = NULL; + const ListValue* mime_types = NULL; plugin->GetList("mime_types", &mime_types); DCHECK(success); for (ListValue::const_iterator mime_type_it = mime_types->begin(); @@ -135,7 +135,7 @@ PluginInstaller* PluginFinder::CreateInstaller( display_url, GURL(url), GURL(help_url)); - ListValue* versions = NULL; + const ListValue* versions = NULL; if (plugin_dict->GetList("versions", &versions)) { for (ListValue::const_iterator it = versions->begin(); it != versions->end(); ++it) { diff --git a/chrome/browser/plugin_finder_unittest.cc b/chrome/browser/plugin_finder_unittest.cc index bbafbc5..8d3d46b 100644 --- a/chrome/browser/plugin_finder_unittest.cc +++ b/chrome/browser/plugin_finder_unittest.cc @@ -33,13 +33,13 @@ TEST(PluginFinderTest, JsonSyntax) { EXPECT_TRUE(plugin->GetBoolean("displayurl", &dummy_bool)); if (plugin->HasKey("requires_authorization")) EXPECT_TRUE(plugin->GetBoolean("requires_authorization", &dummy_bool)); - ListValue* mime_types = NULL; + const ListValue* mime_types = NULL; ASSERT_TRUE(plugin->GetList("mime_types", &mime_types)); for (ListValue::const_iterator mime_type_it = mime_types->begin(); mime_type_it != mime_types->end(); ++mime_type_it) { EXPECT_TRUE((*mime_type_it)->GetAsString(&dummy_str)); } - ListValue* versions = NULL; + const ListValue* versions = NULL; if (!plugin->GetList("versions", &versions)) continue; diff --git a/chrome/browser/policy/configuration_policy_handler.cc b/chrome/browser/policy/configuration_policy_handler.cc index 4892d2f..a1d65a9 100644 --- a/chrome/browser/policy/configuration_policy_handler.cc +++ b/chrome/browser/policy/configuration_policy_handler.cc @@ -920,7 +920,7 @@ const Value* ProxyPolicyHandler::GetProxyPolicyValue( if (!value || !value->GetAsDictionary(&settings)) return NULL; - Value* policy_value = NULL; + const Value* policy_value = NULL; std::string tmp; if (!settings->Get(policy_name, &policy_value) || policy_value->IsType(Value::TYPE_NULL) || diff --git a/chrome/browser/policy/policy_loader_win.cc b/chrome/browser/policy/policy_loader_win.cc index 2f25fa5..0bef5a9 100644 --- a/chrome/browser/policy/policy_loader_win.cc +++ b/chrome/browser/policy/policy_loader_win.cc @@ -263,11 +263,11 @@ base::Value::Type GetDefaultFor(DWORD reg_type) { } // Returns the entry with key |name| in |dictionary| (can be NULL), or NULL. -base::DictionaryValue* GetEntry(const base::DictionaryValue* dictionary, +const base::DictionaryValue* GetEntry(const base::DictionaryValue* dictionary, const std::string& name) { if (!dictionary) return NULL; - base::DictionaryValue* entry = NULL; + const base::DictionaryValue* entry = NULL; dictionary->GetDictionary(name, &entry); return entry; } @@ -275,10 +275,10 @@ base::DictionaryValue* GetEntry(const base::DictionaryValue* dictionary, // Returns the schema for property |name| given the |schema| of an object. // Returns the "additionalProperties" schema if no specific schema for // |name| is present. Returns NULL if no schema is found. -base::DictionaryValue* GetSchemaFor(const base::DictionaryValue* schema, +const base::DictionaryValue* GetSchemaFor(const base::DictionaryValue* schema, const std::string& name) { - base::DictionaryValue* properties = GetEntry(schema, kProperties); - base::DictionaryValue* sub_schema = GetEntry(properties, name); + const base::DictionaryValue* properties = GetEntry(schema, kProperties); + const base::DictionaryValue* sub_schema = GetEntry(properties, name); if (sub_schema) return sub_schema; // "additionalProperties" can be a boolean, but that case is ignored. @@ -470,7 +470,7 @@ base::DictionaryValue* ReadComponentDictionaryValue( continue; } - base::DictionaryValue* sub_schema = GetSchemaFor(schema, name); + const base::DictionaryValue* sub_schema = GetSchemaFor(schema, name); base::Value::Type type = GetType(sub_schema, base::Value::TYPE_DICTIONARY); base::Value* value = NULL; const string16 sub_path = path + kPathSep + name16; diff --git a/chrome/browser/prefs/pref_model_associator.cc b/chrome/browser/prefs/pref_model_associator.cc index 5edab25..27fec3b 100644 --- a/chrome/browser/prefs/pref_model_associator.cc +++ b/chrome/browser/prefs/pref_model_associator.cc @@ -254,7 +254,7 @@ Value* PrefModelAssociator::MergeDictionaryValues( for (DictionaryValue::key_iterator key = from_dict_value.begin_keys(); key != from_dict_value.end_keys(); ++key) { - Value* from_value; + const Value* from_value; bool success = from_dict_value.GetWithoutPathExpansion(*key, &from_value); DCHECK(success); diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index 54082cf..930c3f35 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -122,7 +122,7 @@ void PrintJobWorker::UpdatePrintSettings( const DictionaryValue* const new_settings) { // Create new PageRanges based on |new_settings|. PageRanges new_ranges; - ListValue* page_range_array; + const ListValue* page_range_array; if (new_settings->GetList(kSettingPageRange, &page_range_array)) { for (size_t index = 0; index < page_range_array->GetSize(); ++index) { DictionaryValue* dict; diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc index 347254d..5ea0459 100644 --- a/chrome/browser/profiles/profile_info_cache.cc +++ b/chrome/browser/profiles/profile_info_cache.cc @@ -175,7 +175,7 @@ ProfileInfoCache::ProfileInfoCache(PrefService* prefs, for (DictionaryValue::key_iterator it = cache->begin_keys(); it != cache->end_keys(); ++it) { std::string key = *it; - DictionaryValue* info = NULL; + const DictionaryValue* info = NULL; cache->GetDictionary(key, &info); string16 name; info->GetString(kNameKey, &name); @@ -713,7 +713,7 @@ const DictionaryValue* ProfileInfoCache::GetInfoForProfileAtIndex( DCHECK_LT(index, GetNumberOfProfiles()); const DictionaryValue* cache = prefs_->GetDictionary(prefs::kProfileInfoCache); - DictionaryValue* info = NULL; + const DictionaryValue* info = NULL; cache->GetDictionary(sorted_keys_[index], &info); return info; } @@ -782,7 +782,7 @@ std::vector<string16> ProfileInfoCache::GetProfileNames() { for (base::DictionaryValue::key_iterator it = cache->begin_keys(); it != cache->end_keys(); ++it) { - base::DictionaryValue* info = NULL; + const base::DictionaryValue* info = NULL; cache->GetDictionary(*it, &info); info->GetString(kNameKey, &name); names.push_back(name); diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index 1f50c8f..d5e2b4f 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc @@ -165,7 +165,7 @@ DictionaryValue* GetSettingsDictionary(const ListValue* args) { int GetPageCountFromSettingsDictionary(const DictionaryValue& settings) { int count = 0; - ListValue* page_range_array; + const ListValue* page_range_array; if (settings.GetList(printing::kSettingPageRange, &page_range_array)) { for (size_t index = 0; index < page_range_array->GetSize(); ++index) { DictionaryValue* dict; diff --git a/chrome/browser/web_resource/notification_promo.cc b/chrome/browser/web_resource/notification_promo.cc index 4baf219..e10fa0b 100644 --- a/chrome/browser/web_resource/notification_promo.cc +++ b/chrome/browser/web_resource/notification_promo.cc @@ -214,7 +214,7 @@ NotificationPromo::NotificationPromo(Profile* profile) NotificationPromo::~NotificationPromo() {} void NotificationPromo::InitFromJson(const DictionaryValue& json) { - ListValue* promo_list = NULL; + const ListValue* promo_list = NULL; #if !defined(OS_ANDROID) if (!json.GetList(promo_type_, &promo_list)) return; @@ -409,7 +409,7 @@ void NotificationPromo::InitFromPrefs() { if (!promo_dict) return; - base::ListValue* promo_list(NULL); + const base::ListValue* promo_list(NULL); promo_dict->GetList(promo_type_, &promo_list); if (!promo_list) return; diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc index 6932ea7..5001a35 100644 --- a/chrome/common/extensions/api/extension_api.cc +++ b/chrome/common/extensions/api/extension_api.cc @@ -50,8 +50,8 @@ bool IsUnprivileged(const DictionaryValue* dict) { // children with an { "unprivileged": true } property. bool HasUnprivilegedChild(const DictionaryValue* name_space_node, const std::string& child_kind) { - ListValue* child_list = NULL; - DictionaryValue* child_dict = NULL; + const ListValue* child_list = NULL; + const DictionaryValue* child_dict = NULL; if (name_space_node->GetList(child_kind, &child_list)) { for (size_t i = 0; i < child_list->GetSize(); ++i) { @@ -119,7 +119,7 @@ const DictionaryValue* GetSchemaChild(const DictionaryValue* schema_node, const std::string& child_name) { DictionaryValue* child_node = NULL; for (size_t i = 0; i < arraysize(kChildKinds); ++i) { - ListValue* list_node = NULL; + const ListValue* list_node = NULL; if (!schema_node->GetList(kChildKinds[i], &list_node)) continue; child_node = FindListItem(list_node, "name", child_name); @@ -798,7 +798,7 @@ void ExtensionAPI::GetMissingDependencies( const DictionaryValue* schema = GetSchema(feature_name); CHECK(schema) << "Schema for " << feature_name << " not found"; - ListValue* dependencies = NULL; + const ListValue* dependencies = NULL; if (!schema->GetList("dependencies", &dependencies)) return; diff --git a/chrome/common/extensions/api/extension_api_unittest.cc b/chrome/common/extensions/api/extension_api_unittest.cc index a0a94e5..d906c87 100644 --- a/chrome/common/extensions/api/extension_api_unittest.cc +++ b/chrome/common/extensions/api/extension_api_unittest.cc @@ -420,7 +420,7 @@ static void GetDictionaryFromList(const DictionaryValue* schema, const std::string& list_name, const int list_index, DictionaryValue** out) { - ListValue* list; + const ListValue* list; EXPECT_TRUE(schema->GetList(list_name, &list)); EXPECT_TRUE(list->GetDictionary(list_index, out)); } diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index e5860e1..990271e 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -598,7 +598,7 @@ bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, } // matches (required) - ListValue* matches = NULL; + const ListValue* matches = NULL; if (!content_script->GetList(keys::kMatches, &matches)) { *error = ExtensionErrorUtils::FormatErrorMessageUTF16( errors::kInvalidMatches, @@ -650,7 +650,7 @@ bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, // exclude_matches if (content_script->HasKey(keys::kExcludeMatches)) { // optional - ListValue* exclude_matches = NULL; + const ListValue* exclude_matches = NULL; if (!content_script->GetList(keys::kExcludeMatches, &exclude_matches)) { *error = ExtensionErrorUtils::FormatErrorMessageUTF16( errors::kInvalidExcludeMatches, @@ -697,7 +697,7 @@ bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, } // js and css keys - ListValue* js = NULL; + const ListValue* js = NULL; if (content_script->HasKey(keys::kJs) && !content_script->GetList(keys::kJs, &js)) { *error = ExtensionErrorUtils::FormatErrorMessageUTF16( @@ -706,7 +706,7 @@ bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, return false; } - ListValue* css = NULL; + const ListValue* css = NULL; if (content_script->HasKey(keys::kCss) && !content_script->GetList(keys::kCss, &css)) { *error = ExtensionErrorUtils:: @@ -774,7 +774,7 @@ bool Extension::LoadGlobsHelper( if (!content_script->HasKey(globs_property_name)) return true; // they are optional - ListValue* list = NULL; + const ListValue* list = NULL; if (!content_script->GetList(globs_property_name, &list)) { *error = ExtensionErrorUtils::FormatErrorMessageUTF16( errors::kInvalidGlobList, @@ -812,7 +812,7 @@ scoped_ptr<ExtensionAction> Extension::LoadExtensionActionHelper( action_type != ExtensionAction::TYPE_PAGE); if (manifest_version_ == 1) { - ListValue* icons = NULL; + const ListValue* icons = NULL; if (extension_action->HasKey(keys::kPageActionIcons) && extension_action->GetList(keys::kPageActionIcons, &icons)) { for (ListValue::const_iterator iter = icons->begin(); @@ -883,7 +883,7 @@ scoped_ptr<ExtensionAction> Extension::LoadExtensionActionHelper( } if (popup_key) { - DictionaryValue* popup = NULL; + const DictionaryValue* popup = NULL; std::string url_str; if (extension_action->GetString(popup_key, &url_str)) { @@ -1907,7 +1907,7 @@ bool Extension::LoadWebIntentAction(const std::string& action_name, service.action = UTF8ToUTF16(action_name); - ListValue* mime_types = NULL; + const ListValue* mime_types = NULL; if (!intent_service.HasKey(keys::kIntentType) || !intent_service.GetList(keys::kIntentType, &mime_types) || mime_types->GetSize() == 0) { @@ -2444,7 +2444,7 @@ FileBrowserHandler* Extension::LoadFileBrowserHandler( result->set_title(title); // Initialize access permissions (optional). - ListValue* access_list_value = NULL; + const ListValue* access_list_value = NULL; if (file_browser_handler->HasKey(keys::kFileAccessList)) { if (!file_browser_handler->GetList(keys::kFileAccessList, &access_list_value) || @@ -2470,7 +2470,7 @@ FileBrowserHandler* Extension::LoadFileBrowserHandler( // Initialize file filters (mandatory, unless "create" access is specified, // in which case is ignored). if (!result->HasCreateAccessPermission()) { - ListValue* list_value = NULL; + const ListValue* list_value = NULL; if (!file_browser_handler->HasKey(keys::kFileFilters) || !file_browser_handler->GetList(keys::kFileFilters, &list_value) || list_value->empty()) { @@ -2802,7 +2802,7 @@ bool Extension::LoadThemeFeatures(string16* error) { bool Extension::LoadThemeImages(const DictionaryValue* theme_value, string16* error) { - DictionaryValue* images_value = NULL; + const DictionaryValue* images_value = NULL; if (theme_value->GetDictionary(keys::kThemeImages, &images_value)) { // Validate that the images are all strings for (DictionaryValue::key_iterator iter = images_value->begin_keys(); @@ -2820,12 +2820,12 @@ bool Extension::LoadThemeImages(const DictionaryValue* theme_value, bool Extension::LoadThemeColors(const DictionaryValue* theme_value, string16* error) { - DictionaryValue* colors_value = NULL; + const DictionaryValue* colors_value = NULL; if (theme_value->GetDictionary(keys::kThemeColors, &colors_value)) { // Validate that the colors are RGB or RGBA lists for (DictionaryValue::key_iterator iter = colors_value->begin_keys(); iter != colors_value->end_keys(); ++iter) { - ListValue* color_list = NULL; + const ListValue* color_list = NULL; double alpha = 0.0; int color = 0; // The color must be a list @@ -2851,12 +2851,12 @@ bool Extension::LoadThemeColors(const DictionaryValue* theme_value, bool Extension::LoadThemeTints(const DictionaryValue* theme_value, string16* error) { - DictionaryValue* tints_value = NULL; + const DictionaryValue* tints_value = NULL; if (theme_value->GetDictionary(keys::kThemeTints, &tints_value)) { // Validate that the tints are all reals. for (DictionaryValue::key_iterator iter = tints_value->begin_keys(); iter != tints_value->end_keys(); ++iter) { - ListValue* tint_list = NULL; + const ListValue* tint_list = NULL; double v = 0.0; if (!tints_value->GetListWithoutPathExpansion(*iter, &tint_list) || tint_list->GetSize() != 3 || @@ -2874,7 +2874,7 @@ bool Extension::LoadThemeTints(const DictionaryValue* theme_value, bool Extension::LoadThemeDisplayProperties(const DictionaryValue* theme_value, string16* error) { - DictionaryValue* display_properties_value = NULL; + const DictionaryValue* display_properties_value = NULL; if (theme_value->GetDictionary(keys::kThemeDisplayProperties, &display_properties_value)) { theme_display_properties_.reset( diff --git a/chrome/common/extensions/features/feature.cc b/chrome/common/extensions/features/feature.cc index 7aed0a8..1d65e57 100644 --- a/chrome/common/extensions/features/feature.cc +++ b/chrome/common/extensions/features/feature.cc @@ -92,7 +92,7 @@ static base::LazyInstance<Channel> g_channel = LAZY_INSTANCE_INITIALIZER; void ParseSet(const DictionaryValue* value, const std::string& property, std::set<std::string>* set) { - ListValue* list_value = NULL; + const ListValue* list_value = NULL; if (!value->GetList(property, &list_value)) return; diff --git a/chrome/common/extensions/message_bundle.cc b/chrome/common/extensions/message_bundle.cc index 8e199af..9e39b98 100644 --- a/chrome/common/extensions/message_bundle.cc +++ b/chrome/common/extensions/message_bundle.cc @@ -134,7 +134,7 @@ bool MessageBundle::GetMessageValue(const std::string& key, std::string* value, std::string* error) const { // Get the top level tree for given key (name part). - DictionaryValue* name_tree; + const DictionaryValue* name_tree; if (!catalog.GetDictionaryWithoutPathExpansion(key, &name_tree)) { *error = base::StringPrintf("Not a valid tree for key %s.", key.c_str()); return false; @@ -166,7 +166,7 @@ bool MessageBundle::GetPlaceholders(const DictionaryValue& name_tree, if (!name_tree.HasKey(kPlaceholdersKey)) return true; - DictionaryValue* placeholders_tree; + const DictionaryValue* placeholders_tree; if (!name_tree.GetDictionary(kPlaceholdersKey, &placeholders_tree)) { *error = base::StringPrintf("Not a valid \"%s\" element for key %s.", kPlaceholdersKey, name_key.c_str()); @@ -175,7 +175,7 @@ bool MessageBundle::GetPlaceholders(const DictionaryValue& name_tree, for (DictionaryValue::key_iterator key_it = placeholders_tree->begin_keys(); key_it != placeholders_tree->end_keys(); ++key_it) { - DictionaryValue* placeholder; + const DictionaryValue* placeholder; const std::string& content_key(*key_it); if (!IsValidName(content_key)) return BadKeyMessage(content_key, error); diff --git a/chrome/common/net/gaia/oauth2_mint_token_flow.cc b/chrome/common/net/gaia/oauth2_mint_token_flow.cc index 511b8b4..285cd2b 100644 --- a/chrome/common/net/gaia/oauth2_mint_token_flow.cc +++ b/chrome/common/net/gaia/oauth2_mint_token_flow.cc @@ -227,11 +227,11 @@ bool OAuth2MintTokenFlow::ParseIssueAdviceResponse( CHECK(dict); CHECK(issue_advice); - base::DictionaryValue* consent_dict = NULL; + const base::DictionaryValue* consent_dict = NULL; if (!dict->GetDictionary(kConsentKey, &consent_dict)) return false; - base::ListValue* scopes_list = NULL; + const base::ListValue* scopes_list = NULL; if (!consent_dict->GetList(kScopesKey, &scopes_list)) return false; diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index a2f58a5..80c160f 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -299,7 +299,7 @@ GoogleChromeDistribution::GoogleChromeDistribution() // see the comment in google_chrome_distribution_dummy.cc #ifndef _WIN64 bool GoogleChromeDistribution::BuildUninstallMetricsString( - DictionaryValue* uninstall_metrics_dict, string16* metrics) { + const DictionaryValue* uninstall_metrics_dict, string16* metrics) { DCHECK(NULL != metrics); bool has_values = false; @@ -348,7 +348,7 @@ bool GoogleChromeDistribution::ExtractUninstallMetrics( return false; } - DictionaryValue* uninstall_metrics_dict; + const DictionaryValue* uninstall_metrics_dict; if (!root.HasKey(installer::kUninstallMetricsName) || !root.GetDictionary(installer::kUninstallMetricsName, &uninstall_metrics_dict)) { diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h index 811763f..e1d328d 100644 --- a/chrome/installer/util/google_chrome_distribution.h +++ b/chrome/installer/util/google_chrome_distribution.h @@ -133,7 +133,7 @@ class GoogleChromeDistribution : public BrowserDistribution { // Returns true if at least one uninstall metric was found in // uninstall_metrics_dict, false otherwise. virtual bool BuildUninstallMetricsString( - base::DictionaryValue* uninstall_metrics_dict, string16* metrics); + const base::DictionaryValue* uninstall_metrics_dict, string16* metrics); // The product ID for Google Update. string16 product_guid_; diff --git a/chrome/installer/util/google_chrome_distribution_dummy.cc b/chrome/installer/util/google_chrome_distribution_dummy.cc index ce2771f..7d02d36 100644 --- a/chrome/installer/util/google_chrome_distribution_dummy.cc +++ b/chrome/installer/util/google_chrome_distribution_dummy.cc @@ -165,7 +165,7 @@ bool GoogleChromeDistribution::ExtractUninstallMetrics( } bool GoogleChromeDistribution::BuildUninstallMetricsString( - DictionaryValue* uninstall_metrics_dict, string16* metrics) { + const DictionaryValue* uninstall_metrics_dict, string16* metrics) { NOTREACHED(); return false; } diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 59f7270..24592c6 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -39,7 +39,7 @@ std::vector<GURL> GetNamedList(const char* name, std::vector<GURL> list; if (!prefs) return list; - ListValue* value_list = NULL; + const ListValue* value_list = NULL; if (!prefs->GetList(name, &value_list)) return list; for (size_t i = 0; i < value_list->GetSize(); ++i) { diff --git a/chrome/renderer/chrome_mock_render_thread.cc b/chrome/renderer/chrome_mock_render_thread.cc index 418bf93..fc5a6eb 100644 --- a/chrome/renderer/chrome_mock_render_thread.cc +++ b/chrome/renderer/chrome_mock_render_thread.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -163,7 +163,7 @@ void ChromeMockRenderThread::OnUpdatePrintSettings( // Just return the default settings. if (printer_.get()) { - ListValue* page_range_array; + const ListValue* page_range_array; printing::PageRanges new_ranges; if (job_settings.GetList(printing::kSettingPageRange, &page_range_array)) { for (size_t index = 0; index < page_range_array->GetSize(); ++index) { diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc index 916617b..f3fb5ea 100644 --- a/chrome/service/cloud_print/print_system_cups.cc +++ b/chrome/service/cloud_print/print_system_cups.cc @@ -434,7 +434,7 @@ PrintSystemCUPS::PrintSystemCUPS(const DictionaryValue* print_system_settings) void PrintSystemCUPS::InitPrintBackends( const DictionaryValue* print_system_settings) { - ListValue* url_list; + const ListValue* url_list; if (print_system_settings && print_system_settings->GetList(kCUPSPrintServerURLs, &url_list)) { for (size_t i = 0; i < url_list->GetSize(); i++) { diff --git a/chrome/test/automation/automation_json_requests.cc b/chrome/test/automation/automation_json_requests.cc index cdb6272..96e7e00 100644 --- a/chrome/test/automation/automation_json_requests.cc +++ b/chrome/test/automation/automation_json_requests.cc @@ -933,7 +933,7 @@ bool SendSetPreferenceJSONRequest( bool SendOverrideGeolocationJSONRequest( AutomationMessageSender* sender, - base::DictionaryValue* geolocation, + const base::DictionaryValue* geolocation, Error* error) { scoped_ptr<DictionaryValue> dict(geolocation->DeepCopy()); dict->SetString("command", "OverrideGeoposition"); diff --git a/chrome/test/automation/automation_json_requests.h b/chrome/test/automation/automation_json_requests.h index fc77996..860fa61 100644 --- a/chrome/test/automation/automation_json_requests.h +++ b/chrome/test/automation/automation_json_requests.h @@ -528,7 +528,7 @@ bool SendSetPreferenceJSONRequest( // Requests to override the user's geolocation. Returns true on success. bool SendOverrideGeolocationJSONRequest( AutomationMessageSender* sender, - base::DictionaryValue* geolocation, + const base::DictionaryValue* geolocation, automation::Error* error) WARN_UNUSED_RESULT; #endif // CHROME_TEST_AUTOMATION_AUTOMATION_JSON_REQUESTS_H_ diff --git a/chrome/test/webdriver/commands/command.cc b/chrome/test/webdriver/commands/command.cc index 7f4686d..1471e0a 100644 --- a/chrome/test/webdriver/commands/command.cc +++ b/chrome/test/webdriver/commands/command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -40,7 +40,7 @@ bool Command::HasParameter(const std::string& key) const { } bool Command::IsNullParameter(const std::string& key) const { - Value* value; + const Value* value; return parameters_.get() && parameters_->Get(key, &value) && value->IsType(Value::TYPE_NULL); @@ -76,12 +76,12 @@ bool Command::GetDoubleParameter(const std::string& key, double* out) const { } bool Command::GetDictionaryParameter(const std::string& key, - DictionaryValue** out) const { + const DictionaryValue** out) const { return parameters_.get() != NULL && parameters_->GetDictionary(key, out); } bool Command::GetListParameter(const std::string& key, - ListValue** out) const { + const ListValue** out) const { return parameters_.get() != NULL && parameters_->GetList(key, out); } diff --git a/chrome/test/webdriver/commands/command.h b/chrome/test/webdriver/commands/command.h index 97f0259..3e0c90b 100644 --- a/chrome/test/webdriver/commands/command.h +++ b/chrome/test/webdriver/commands/command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -95,11 +95,11 @@ class Command { // Provides the command parameter with the given |key| as a Dictionary. // Returns false if there is no such parameter, or if it is not a Dictionary. bool GetDictionaryParameter(const std::string& key, - DictionaryValue** out) const; + const DictionaryValue** out) const; // Provides the command parameter with the given |key| as a list. Returns // false if there is no such parameter, or if it is not a list. - bool GetListParameter(const std::string& key, ListValue** out) const; + bool GetListParameter(const std::string& key, const ListValue** out) const; const std::vector<std::string> path_segments_; const scoped_ptr<const DictionaryValue> parameters_; diff --git a/chrome/test/webdriver/commands/cookie_commands.cc b/chrome/test/webdriver/commands/cookie_commands.cc index 1779d59..8c5d8e1 100644 --- a/chrome/test/webdriver/commands/cookie_commands.cc +++ b/chrome/test/webdriver/commands/cookie_commands.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -48,15 +48,16 @@ void CookieCommand::ExecuteGet(Response* const response) { } void CookieCommand::ExecutePost(Response* const response) { - DictionaryValue* cookie_dict; + const DictionaryValue* cookie_dict; if (!GetDictionaryParameter("cookie", &cookie_dict)) { response->SetError(new Error( kBadRequest, "Missing or invalid |cookie| parameter")); return; } + scoped_ptr<DictionaryValue> cookie_dict_copy(cookie_dict->DeepCopy()); std::string domain; - if (cookie_dict->GetString("domain", &domain)) { + if (cookie_dict_copy->GetString("domain", &domain)) { std::vector<std::string> split_domain; base::SplitString(domain, ':', &split_domain); if (split_domain.size() > 2) { @@ -65,14 +66,14 @@ void CookieCommand::ExecutePost(Response* const response) { return; } else if (split_domain.size() == 2) { // Remove the port number. - cookie_dict->SetString("domain", split_domain[0]); + cookie_dict_copy->SetString("domain", split_domain[0]); } } std::string url; Error* error = session_->GetURL(&url); if (!error) - error = session_->SetCookie(url, cookie_dict); + error = session_->SetCookie(url, cookie_dict_copy.get()); if (error) { response->SetError(error); return; diff --git a/chrome/test/webdriver/commands/create_session.cc b/chrome/test/webdriver/commands/create_session.cc index 7e80ec6..8aad164 100644 --- a/chrome/test/webdriver/commands/create_session.cc +++ b/chrome/test/webdriver/commands/create_session.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -26,7 +26,7 @@ CreateSession::~CreateSession() {} bool CreateSession::DoesPost() { return true; } void CreateSession::ExecutePost(Response* const response) { - DictionaryValue* dict; + const DictionaryValue* dict; if (!GetDictionaryParameter("desiredCapabilities", &dict)) { response->SetError(new Error( kBadRequest, "Missing or invalid 'desiredCapabilities'")); diff --git a/chrome/test/webdriver/commands/execute_async_script_command.cc b/chrome/test/webdriver/commands/execute_async_script_command.cc index 8acd4b8..1eb49fa 100644 --- a/chrome/test/webdriver/commands/execute_async_script_command.cc +++ b/chrome/test/webdriver/commands/execute_async_script_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -30,7 +30,7 @@ void ExecuteAsyncScriptCommand::ExecutePost(Response* const response) { return; } - ListValue* args; + const ListValue* args; if (!GetListParameter("args", &args)) { response->SetError(new Error( kBadRequest, "No script arguments specified")); diff --git a/chrome/test/webdriver/commands/execute_command.cc b/chrome/test/webdriver/commands/execute_command.cc index 7bb5a9a..120f8f4 100644 --- a/chrome/test/webdriver/commands/execute_command.cc +++ b/chrome/test/webdriver/commands/execute_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -30,7 +30,7 @@ void ExecuteCommand::ExecutePost(Response* const response) { return; } - ListValue* args; + const ListValue* args; if (!GetListParameter("args", &args)) { response->SetError(new Error( kBadRequest, "No script arguments specified")); diff --git a/chrome/test/webdriver/commands/html5_location_commands.cc b/chrome/test/webdriver/commands/html5_location_commands.cc index 312950b..eeb20ec 100644 --- a/chrome/test/webdriver/commands/html5_location_commands.cc +++ b/chrome/test/webdriver/commands/html5_location_commands.cc @@ -37,7 +37,7 @@ void HTML5LocationCommand::ExecuteGet(Response* const response) { } void HTML5LocationCommand::ExecutePost(Response* const response) { - base::DictionaryValue* geolocation; + const base::DictionaryValue* geolocation; if (!GetDictionaryParameter("location", &geolocation)) { response->SetError(new Error( kBadRequest, "Missing or invalid 'location'")); diff --git a/chrome/test/webdriver/commands/keys_command.cc b/chrome/test/webdriver/commands/keys_command.cc index 0e2b10e..7b2b628 100644 --- a/chrome/test/webdriver/commands/keys_command.cc +++ b/chrome/test/webdriver/commands/keys_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -23,7 +23,7 @@ bool KeysCommand::DoesPost() { } void KeysCommand::ExecutePost(Response* const response) { - ListValue* key_list; + const ListValue* key_list; if (!GetListParameter("value", &key_list)) { response->SetError(new Error( kBadRequest, "Missing or invalid 'value' parameter")); diff --git a/chrome/test/webdriver/commands/response.cc b/chrome/test/webdriver/commands/response.cc index 07c6e24..5dcabec 100644 --- a/chrome/test/webdriver/commands/response.cc +++ b/chrome/test/webdriver/commands/response.cc @@ -43,7 +43,7 @@ void Response::SetStatus(ErrorCode status) { } const Value* Response::GetValue() const { - Value* out = NULL; + const Value* out = NULL; data_.Get(kValueKey, &out); return out; } diff --git a/chrome/test/webdriver/commands/target_locator_commands.cc b/chrome/test/webdriver/commands/target_locator_commands.cc index a07b8f0..5b28a66 100644 --- a/chrome/test/webdriver/commands/target_locator_commands.cc +++ b/chrome/test/webdriver/commands/target_locator_commands.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -133,7 +133,7 @@ void SwitchFrameCommand::ExecutePost(Response* const response) { bool SwitchFrameCommand::GetWebElementParameter(const std::string& key, ElementId* out) const { - DictionaryValue* value; + const DictionaryValue* value; if (!GetDictionaryParameter(key, &value)) return false; diff --git a/chrome/test/webdriver/commands/webelement_commands.cc b/chrome/test/webdriver/commands/webelement_commands.cc index f9df353..2a5127b 100644 --- a/chrome/test/webdriver/commands/webelement_commands.cc +++ b/chrome/test/webdriver/commands/webelement_commands.cc @@ -52,7 +52,7 @@ bool WebElementCommand::Init(Response* const response) { ElementAttributeCommand::ElementAttributeCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementAttributeCommand::~ElementAttributeCommand() {} @@ -84,7 +84,7 @@ void ElementAttributeCommand::ExecuteGet(Response* const response) { ElementClearCommand::ElementClearCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementClearCommand::~ElementClearCommand() {} @@ -113,7 +113,7 @@ void ElementClearCommand::ExecutePost(Response* const response) { ElementCssCommand::ElementCssCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementCssCommand::~ElementCssCommand() {} @@ -151,7 +151,7 @@ void ElementCssCommand::ExecuteGet(Response* const response) { ElementDisplayedCommand::ElementDisplayedCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementDisplayedCommand::~ElementDisplayedCommand() {} @@ -176,7 +176,7 @@ void ElementDisplayedCommand::ExecuteGet(Response* const response) { ElementEnabledCommand::ElementEnabledCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementEnabledCommand::~ElementEnabledCommand() {} @@ -206,7 +206,7 @@ void ElementEnabledCommand::ExecuteGet(Response* const response) { ElementEqualsCommand::ElementEqualsCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementEqualsCommand::~ElementEqualsCommand() {} @@ -244,7 +244,7 @@ void ElementEqualsCommand::ExecuteGet(Response* const response) { ElementLocationCommand::ElementLocationCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementLocationCommand::~ElementLocationCommand() {} @@ -274,7 +274,7 @@ void ElementLocationCommand::ExecuteGet(Response* const response) { ElementLocationInViewCommand::ElementLocationInViewCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementLocationInViewCommand::~ElementLocationInViewCommand() {} @@ -300,7 +300,7 @@ void ElementLocationInViewCommand::ExecuteGet(Response* const response) { ElementNameCommand::ElementNameCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementNameCommand::~ElementNameCommand() {} @@ -324,7 +324,7 @@ void ElementNameCommand::ExecuteGet(Response* const response) { ElementSelectedCommand::ElementSelectedCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementSelectedCommand::~ElementSelectedCommand() {} @@ -361,7 +361,7 @@ void ElementSelectedCommand::ExecutePost(Response* const response) { ElementSizeCommand::ElementSizeCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementSizeCommand::~ElementSizeCommand() {} @@ -388,7 +388,7 @@ void ElementSizeCommand::ExecuteGet(Response* const response) { ElementSubmitCommand::ElementSubmitCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementSubmitCommand::~ElementSubmitCommand() {} @@ -417,7 +417,7 @@ void ElementSubmitCommand::ExecutePost(Response* const response) { ElementToggleCommand::ElementToggleCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementToggleCommand::~ElementToggleCommand() {} @@ -447,7 +447,7 @@ void ElementToggleCommand::ExecutePost(Response* const response) { ElementValueCommand::ElementValueCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementValueCommand::~ElementValueCommand() {} @@ -531,7 +531,7 @@ Error* ElementValueCommand::HasAttributeWithLowerCaseValueASCII( } Error* ElementValueCommand::DragAndDropFilePaths() const { - ListValue* path_list; + const ListValue* path_list; if (!GetListParameter("value", &path_list)) return new Error(kBadRequest, "Missing or invalid 'value' parameter"); @@ -579,7 +579,7 @@ Error* ElementValueCommand::DragAndDropFilePaths() const { } Error* ElementValueCommand::SendKeys() const { - ListValue* key_list; + const ListValue* key_list; if (!GetListParameter("value", &key_list)) { return new Error(kBadRequest, "Missing or invalid 'value' parameter"); } @@ -597,7 +597,7 @@ Error* ElementValueCommand::SendKeys() const { ElementTextCommand::ElementTextCommand( const std::vector<std::string>& path_segments, - DictionaryValue* parameters) + const DictionaryValue* parameters) : WebElementCommand(path_segments, parameters) {} ElementTextCommand::~ElementTextCommand() {} diff --git a/chrome/test/webdriver/commands/webelement_commands.h b/chrome/test/webdriver/commands/webelement_commands.h index 287e89d..5df475c 100644 --- a/chrome/test/webdriver/commands/webelement_commands.h +++ b/chrome/test/webdriver/commands/webelement_commands.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -47,7 +47,7 @@ class WebElementCommand : public WebDriverCommand { class ElementAttributeCommand : public WebElementCommand { public: ElementAttributeCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementAttributeCommand(); virtual bool DoesGet() OVERRIDE; @@ -62,7 +62,7 @@ class ElementAttributeCommand : public WebElementCommand { class ElementClearCommand : public WebElementCommand { public: ElementClearCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementClearCommand(); virtual bool DoesPost() OVERRIDE; @@ -77,7 +77,7 @@ class ElementClearCommand : public WebElementCommand { class ElementCssCommand : public WebElementCommand { public: ElementCssCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementCssCommand(); virtual bool DoesGet() OVERRIDE; @@ -92,7 +92,7 @@ class ElementCssCommand : public WebElementCommand { class ElementDisplayedCommand : public WebElementCommand { public: ElementDisplayedCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementDisplayedCommand(); virtual bool DoesGet() OVERRIDE; @@ -107,7 +107,7 @@ class ElementDisplayedCommand : public WebElementCommand { class ElementEnabledCommand : public WebElementCommand { public: ElementEnabledCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementEnabledCommand(); virtual bool DoesGet() OVERRIDE; @@ -122,7 +122,7 @@ class ElementEnabledCommand : public WebElementCommand { class ElementEqualsCommand : public WebElementCommand { public: ElementEqualsCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementEqualsCommand(); virtual bool DoesGet() OVERRIDE; @@ -137,7 +137,7 @@ class ElementEqualsCommand : public WebElementCommand { class ElementLocationCommand : public WebElementCommand { public: ElementLocationCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementLocationCommand(); virtual bool DoesGet() OVERRIDE; @@ -153,7 +153,7 @@ class ElementLocationCommand : public WebElementCommand { class ElementLocationInViewCommand : public WebElementCommand { public: ElementLocationInViewCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementLocationInViewCommand(); virtual bool DoesGet() OVERRIDE; @@ -168,7 +168,7 @@ class ElementLocationInViewCommand : public WebElementCommand { class ElementNameCommand : public WebElementCommand { public: ElementNameCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementNameCommand(); virtual bool DoesGet() OVERRIDE; @@ -184,7 +184,7 @@ class ElementNameCommand : public WebElementCommand { class ElementSelectedCommand : public WebElementCommand { public: ElementSelectedCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementSelectedCommand(); virtual bool DoesGet() OVERRIDE; @@ -201,7 +201,7 @@ class ElementSelectedCommand : public WebElementCommand { class ElementSizeCommand : public WebElementCommand { public: ElementSizeCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementSizeCommand(); virtual bool DoesGet() OVERRIDE; @@ -216,7 +216,7 @@ class ElementSizeCommand : public WebElementCommand { class ElementSubmitCommand : public WebElementCommand { public: ElementSubmitCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementSubmitCommand(); virtual bool DoesPost() OVERRIDE; @@ -231,7 +231,7 @@ class ElementSubmitCommand : public WebElementCommand { class ElementToggleCommand : public WebElementCommand { public: ElementToggleCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementToggleCommand(); virtual bool DoesPost() OVERRIDE; @@ -247,7 +247,7 @@ class ElementToggleCommand : public WebElementCommand { class ElementValueCommand : public WebElementCommand { public: ElementValueCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementValueCommand(); virtual bool DoesGet() OVERRIDE; @@ -271,7 +271,7 @@ class ElementValueCommand : public WebElementCommand { class ElementTextCommand : public WebElementCommand { public: ElementTextCommand(const std::vector<std::string>& path_segments, - base::DictionaryValue* parameters); + const base::DictionaryValue* parameters); virtual ~ElementTextCommand(); virtual bool DoesGet() OVERRIDE; diff --git a/chrome/test/webdriver/webdriver_automation.cc b/chrome/test/webdriver/webdriver_automation.cc index 5eeb1cb..20fdfae 100644 --- a/chrome/test/webdriver/webdriver_automation.cc +++ b/chrome/test/webdriver/webdriver_automation.cc @@ -1110,7 +1110,7 @@ void Automation::GetGeolocation(scoped_ptr<DictionaryValue>* geolocation, } } -void Automation::OverrideGeolocation(DictionaryValue* geolocation, +void Automation::OverrideGeolocation(const DictionaryValue* geolocation, Error** error) { *error = CheckGeolocationSupported(); if (*error) diff --git a/chrome/test/webdriver/webdriver_automation.h b/chrome/test/webdriver/webdriver_automation.h index 406d29d..895dcd1 100644 --- a/chrome/test/webdriver/webdriver_automation.h +++ b/chrome/test/webdriver/webdriver_automation.h @@ -254,7 +254,7 @@ class Automation { Error** error); // Overrides the current geolocation. - void OverrideGeolocation(base::DictionaryValue* geolocation, + void OverrideGeolocation(const base::DictionaryValue* geolocation, Error** error); private: diff --git a/chrome/test/webdriver/webdriver_capabilities_parser.cc b/chrome/test/webdriver/webdriver_capabilities_parser.cc index 5e387ee..69e1806 100644 --- a/chrome/test/webdriver/webdriver_capabilities_parser.cc +++ b/chrome/test/webdriver/webdriver_capabilities_parser.cc @@ -72,7 +72,7 @@ Error* CapabilitiesParser::Parse() { { "loggingPrefs", &CapabilitiesParser::ParseLoggingPrefs } }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(name_and_parser); ++i) { - Value* value; + const Value* value; if (dict_->Get(name_and_parser[i].name, &value)) { Error* error = (this->*name_and_parser[i].parser)(value); if (error) @@ -84,11 +84,11 @@ Error* CapabilitiesParser::Parse() { const char kOptionsKey[] = "chromeOptions"; const DictionaryValue* options = dict_; bool legacy_options = true; - Value* options_value; + const Value* options_value; if (dict_->Get(kOptionsKey, &options_value)) { legacy_options = false; if (options_value->IsType(Value::TYPE_DICTIONARY)) { - options = static_cast<DictionaryValue*>(options_value); + options = static_cast<const DictionaryValue*>(options_value); } else { return CreateBadInputError( kOptionsKey, Value::TYPE_DICTIONARY, options_value); @@ -132,7 +132,7 @@ Error* CapabilitiesParser::Parse() { "Unrecognized chrome capability: " + *key_iter); continue; } - Value* option = NULL; + const Value* option = NULL; options->GetWithoutPathExpansion(*key_iter, &option); Error* error = (this->*parser_map[*key_iter])(option); if (error) { @@ -238,7 +238,7 @@ Error* CapabilitiesParser::ParseLoggingPrefs(const base::Value* option) { if (!LogType::FromString(*key_iter, &log_type)) continue; - Value* level_value; + const Value* level_value; logging_prefs->Get(*key_iter, &level_value); std::string level_name; if (!level_value->GetAsString(&level_name)) { @@ -310,7 +310,7 @@ Error* CapabilitiesParser::ParseProxy(const base::Value* option) { proxy_type_parser_map["direct"] = NULL; proxy_type_parser_map["system"] = NULL; - Value* proxy_type_value; + const Value* proxy_type_value; if (!options->Get("proxyType", &proxy_type_value)) return new Error(kBadRequest, "Missing 'proxyType' capability."); @@ -374,7 +374,7 @@ Error* CapabilitiesParser::ParseProxyServers( proxy_servers_options.insert(kSslProxy); Error* error = NULL; - Value* option = NULL; + const Value* option = NULL; bool has_manual_settings = false; if (options->Get(kNoProxy, &option) && !option->IsType(Value::TYPE_NULL)) { error = ParseNoProxy(option); diff --git a/chrome/test/webdriver/webdriver_session.cc b/chrome/test/webdriver/webdriver_session.cc index ce0d2be..a47f90d 100644 --- a/chrome/test/webdriver/webdriver_session.cc +++ b/chrome/test/webdriver/webdriver_session.cc @@ -576,6 +576,9 @@ Error* Session::DeleteCookie(const std::string& url, return error; } +// Note that when this is called from CookieCommand::ExecutePost then +// |cookie_dict| is destroyed as soon as the caller finishes. Therefore +// it is essential that RunSessionTask executes synchronously. Error* Session::SetCookie(const std::string& url, DictionaryValue* cookie_dict) { Error* error = NULL; @@ -1364,7 +1367,8 @@ Error* Session::RemoveStorageItem(StorageType type, CreateDirectValueParser(value)); } -Error* Session::GetGeolocation(scoped_ptr<base::DictionaryValue>* geolocation) { +Error* Session::GetGeolocation( + scoped_ptr<base::DictionaryValue>* geolocation) { Error* error = NULL; RunSessionTask(base::Bind( &Automation::GetGeolocation, @@ -1374,7 +1378,7 @@ Error* Session::GetGeolocation(scoped_ptr<base::DictionaryValue>* geolocation) { return error; } -Error* Session::OverrideGeolocation(base::DictionaryValue* geolocation) { +Error* Session::OverrideGeolocation(const base::DictionaryValue* geolocation) { Error* error = NULL; RunSessionTask(base::Bind( &Automation::OverrideGeolocation, @@ -1431,6 +1435,7 @@ void Session::RunSessionTask(const base::Closure& task) { base::Unretained(this), task, &done_event)); + // See SetCookie for why it is essential that we wait here. done_event.Wait(); } diff --git a/chrome/test/webdriver/webdriver_session.h b/chrome/test/webdriver/webdriver_session.h index 6c9b5f0..2ca23bc 100644 --- a/chrome/test/webdriver/webdriver_session.h +++ b/chrome/test/webdriver/webdriver_session.h @@ -377,7 +377,7 @@ class Session { Error* GetGeolocation(scoped_ptr<base::DictionaryValue>* geolocation); // Overrides the current geolocation. - Error* OverrideGeolocation(base::DictionaryValue* geolocation); + Error* OverrideGeolocation(const base::DictionaryValue* geolocation); const std::string& id() const; diff --git a/chromeos/dbus/flimflam_device_client.cc b/chromeos/dbus/flimflam_device_client.cc index f16189f..8474c18 100644 --- a/chromeos/dbus/flimflam_device_client.cc +++ b/chromeos/dbus/flimflam_device_client.cc @@ -367,7 +367,7 @@ class FlimflamDeviceClientStubImpl : public FlimflamDeviceClient { private: void PassStubDevicePrperties(const dbus::ObjectPath& device_path, const DictionaryValueCallback& callback) const { - base::DictionaryValue* device_properties = NULL; + const base::DictionaryValue* device_properties = NULL; if (!stub_devices_.GetDictionary(device_path.value(), &device_properties)) { base::DictionaryValue empty_dictionary; callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary); diff --git a/chromeos/dbus/flimflam_manager_client_unittest.cc b/chromeos/dbus/flimflam_manager_client_unittest.cc index 502f67f..d50920e 100644 --- a/chromeos/dbus/flimflam_manager_client_unittest.cc +++ b/chromeos/dbus/flimflam_manager_client_unittest.cc @@ -66,7 +66,7 @@ void ExpectDictionaryValueArgument( NOTREACHED(); } ASSERT_TRUE(value.get()); - base::Value* expected_value = NULL; + const base::Value* expected_value = NULL; EXPECT_TRUE(expected_dictionary->GetWithoutPathExpansion(key, &expected_value)); EXPECT_TRUE(value->Equals(expected_value)); diff --git a/chromeos/network/network_sms_handler.cc b/chromeos/network/network_sms_handler.cc index 96f9950..58c5ad2 100644 --- a/chromeos/network/network_sms_handler.cc +++ b/chromeos/network/network_sms_handler.cc @@ -371,7 +371,7 @@ void NetworkSmsHandler::ManagerPropertiesCallback( LOG(ERROR) << "NetworkSmsHandler: Failed to get manager properties."; return; } - base::Value* value; + const base::Value* value; if (!properties.GetWithoutPathExpansion(flimflam::kDevicesProperty, &value) || value->GetType() != base::Value::TYPE_LIST) { LOG(ERROR) << "NetworkSmsHandler: No list value for: " diff --git a/cloud_print/service/service_state.cc b/cloud_print/service/service_state.cc index a07f8f2..8007db3 100644 --- a/cloud_print/service/service_state.cc +++ b/cloud_print/service/service_state.cc @@ -103,7 +103,7 @@ bool ServiceState::FromString(const std::string& json) { if (!data->GetAsDictionary(&services)) return false; - base::DictionaryValue* cloud_print = NULL; + const base::DictionaryValue* cloud_print = NULL; if (!services->GetDictionary(kCloudPrintJsonName, &cloud_print)) return false; @@ -208,4 +208,3 @@ bool ServiceState::Configure(const std::string& email, xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password); return IsValid(); } - diff --git a/content/browser/geolocation/network_location_request.cc b/content/browser/geolocation/network_location_request.cc index 145bba5..c091371 100644 --- a/content/browser/geolocation/network_location_request.cc +++ b/content/browser/geolocation/network_location_request.cc @@ -293,7 +293,7 @@ bool GetAsDouble(const DictionaryValue& object, const std::string& property_name, double* out) { DCHECK(out); - Value* value = NULL; + const Value* value = NULL; if (!object.Get(property_name, &value)) return false; int value_as_int; @@ -340,7 +340,7 @@ bool ParseServerResponse(const std::string& response_body, static_cast<DictionaryValue*>(response_value.get()); // Check the status code. - Value* status_value = NULL; + const Value* status_value = NULL; if (!response_object->Get(kStatusString, &status_value)) { VLOG(1) << "ParseServerResponse() : Missing status attribute."; // The status attribute is required. @@ -354,7 +354,8 @@ bool ParseServerResponse(const std::string& response_body, // The status attribute is required to be a string. return false; } - StringValue* status_object = static_cast<StringValue*>(status_value); + const StringValue* status_object = + static_cast<const StringValue*>(status_value); std::string status; if (!status_object->GetAsString(&status)) { @@ -372,7 +373,7 @@ bool ParseServerResponse(const std::string& response_body, response_object->GetString(kAccessTokenString, access_token); // Get the location - Value* location_value = NULL; + const Value* location_value = NULL; if (!response_object->Get(kLocationString, &location_value)) { VLOG(1) << "ParseServerResponse() : Missing location attribute."; // GLS returns a response with no location property to represent @@ -391,8 +392,8 @@ bool ParseServerResponse(const std::string& response_body, } return true; // Successfully parsed response containing no fix. } - DictionaryValue* location_object = - static_cast<DictionaryValue*>(location_value); + const DictionaryValue* location_object = + static_cast<const DictionaryValue*>(location_value); // latitude and longitude fields are always required. double latitude, longitude; diff --git a/content/browser/speech/google_one_shot_remote_engine.cc b/content/browser/speech/google_one_shot_remote_engine.cc index d8fad46..d56986b 100644 --- a/content/browser/speech/google_one_shot_remote_engine.cc +++ b/content/browser/speech/google_one_shot_remote_engine.cc @@ -62,7 +62,7 @@ bool ParseServerResponse(const std::string& response_body, return false; } const DictionaryValue* response_object = - static_cast<DictionaryValue*>(response_value.get()); + static_cast<const DictionaryValue*>(response_value.get()); // Get the status. int status; @@ -90,7 +90,7 @@ bool ParseServerResponse(const std::string& response_body, } // Get the hypotheses. - Value* hypotheses_value = NULL; + const Value* hypotheses_value = NULL; if (!response_object->Get(kHypothesesString, &hypotheses_value)) { VLOG(1) << "ParseServerResponse: Missing hypotheses attribute."; return false; @@ -103,7 +103,8 @@ bool ParseServerResponse(const std::string& response_body, return false; } - const ListValue* hypotheses_list = static_cast<ListValue*>(hypotheses_value); + const ListValue* hypotheses_list = + static_cast<const ListValue*>(hypotheses_value); // For now we support only single shot recognition, so we are giving only a // final result, consisting of one fragment (with one or more hypotheses). diff --git a/content/renderer/v8_value_converter_impl.cc b/content/renderer/v8_value_converter_impl.cc index 20923cc..dc76394d 100644 --- a/content/renderer/v8_value_converter_impl.cc +++ b/content/renderer/v8_value_converter_impl.cc @@ -153,7 +153,7 @@ v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Object( for (DictionaryValue::key_iterator iter = val->begin_keys(); iter != val->end_keys(); ++iter) { - Value* child = NULL; + const Value* child = NULL; CHECK(val->GetWithoutPathExpansion(*iter, &child)); const std::string& key = *iter; diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc index 29159d0..da9b48b 100644 --- a/ipc/ipc_message_utils.cc +++ b/ipc/ipc_message_utils.cc @@ -103,7 +103,7 @@ void WriteValue(Message* m, const Value* value, int recursion) { for (DictionaryValue::key_iterator it = dict->begin_keys(); it != dict->end_keys(); ++it) { - Value* subval; + const Value* subval; if (dict->GetWithoutPathExpansion(*it, &subval)) { WriteParam(m, *it); WriteValue(m, subval, recursion + 1); diff --git a/net/http/http_request_headers.cc b/net/http/http_request_headers.cc index 3669140..b8f9651 100644 --- a/net/http/http_request_headers.cc +++ b/net/http/http_request_headers.cc @@ -208,7 +208,7 @@ bool HttpRequestHeaders::FromNetLogParam(const base::Value* event_param, *request_line = ""; const base::DictionaryValue* dict; - base::ListValue* header_list; + const base::ListValue* header_list; if (!event_param || !event_param->GetAsDictionary(&dict) || diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index 90766ba..d46726d 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -1323,7 +1323,7 @@ bool HttpResponseHeaders::FromNetLogParam( http_response_headers->release(); const base::DictionaryValue* dict; - base::ListValue* header_list; + const base::ListValue* header_list; if (!event_param || !event_param->GetAsDictionary(&dict) || diff --git a/printing/page_size_margins.cc b/printing/page_size_margins.cc index 8a6b48b..0f4d4fe 100644 --- a/printing/page_size_margins.cc +++ b/printing/page_size_margins.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -12,7 +12,7 @@ namespace printing { void GetCustomMarginsFromJobSettings(const base::DictionaryValue& settings, PageSizeMargins* page_size_margins) { - DictionaryValue* custom_margins; + const DictionaryValue* custom_margins; if (!settings.GetDictionary(kSettingMarginsCustom, &custom_margins) || !custom_margins->GetDouble(kSettingMarginTop, &page_size_margins->margin_top) || diff --git a/remoting/host/policy_hack/policy_watcher.cc b/remoting/host/policy_hack/policy_watcher.cc index 23320ea..56511984 100644 --- a/remoting/host/policy_hack/policy_watcher.cc +++ b/remoting/host/policy_hack/policy_watcher.cc @@ -32,7 +32,7 @@ bool GetBooleanOrDefault(const base::DictionaryValue* dict, const char* key, if (!dict->HasKey(key)) { return default_if_value_missing; } - base::Value* value; + const base::Value* value; if (dict->Get(key, &value) && value->IsType(base::Value::TYPE_BOOLEAN)) { bool bool_value; CHECK(value->GetAsBoolean(&bool_value)); diff --git a/sync/internal_api/public/change_record_unittest.cc b/sync/internal_api/public/change_record_unittest.cc index 549b0d7..b54410e 100644 --- a/sync/internal_api/public/change_record_unittest.cc +++ b/sync/internal_api/public/change_record_unittest.cc @@ -55,7 +55,7 @@ void CheckChangeRecordValue( if (record.extra.get()) { expected_extra_value.reset(record.extra->ToValue()); } - base::Value* extra_value = NULL; + const base::Value* extra_value = NULL; EXPECT_EQ(record.extra.get() != NULL, value.Get("extra", &extra_value)); EXPECT_TRUE(Value::Equals(extra_value, expected_extra_value.get())); diff --git a/sync/internal_api/syncapi_unittest.cc b/sync/internal_api/syncapi_unittest.cc index 40a18f8..3c55738 100644 --- a/sync/internal_api/syncapi_unittest.cc +++ b/sync/internal_api/syncapi_unittest.cc @@ -584,7 +584,7 @@ void CheckNodeValue(const BaseNode& node, const DictionaryValue& value, ExpectInt64Value(node.GetFirstChildId(), value, "firstChildId"); { scoped_ptr<DictionaryValue> expected_entry(node.GetEntry()->ToValue()); - Value* entry = NULL; + const Value* entry = NULL; EXPECT_TRUE(value.Get("entry", &entry)); EXPECT_TRUE(Value::Equals(entry, expected_entry.get())); } diff --git a/sync/protocol/proto_value_conversions_unittest.cc b/sync/protocol/proto_value_conversions_unittest.cc index 4bd5f07..89a99e3 100644 --- a/sync/protocol/proto_value_conversions_unittest.cc +++ b/sync/protocol/proto_value_conversions_unittest.cc @@ -192,7 +192,7 @@ namespace { // path. bool ValueHasSpecifics(const DictionaryValue& value, const std::string& path) { - ListValue* entities_list = NULL; + const ListValue* entities_list = NULL; DictionaryValue* entry_dictionary = NULL; DictionaryValue* specifics_dictionary = NULL; diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py index 021dce1..e9318dc 100644 --- a/tools/json_schema_compiler/cc_generator.py +++ b/tools/json_schema_compiler/cc_generator.py @@ -214,7 +214,7 @@ class CCGenerator(object): """ c = Code() value_var = prop.unix_name + '_value' - c.Append('base::Value* %(value_var)s = NULL;') + c.Append('const base::Value* %(value_var)s = NULL;') if prop.optional: (c.Sblock( 'if (%(src)s->GetWithoutPathExpansion("%(key)s", &%(value_var)s)) {' @@ -460,7 +460,7 @@ class CCGenerator(object): ) elif self._IsObjectOrObjectRef(prop): if prop.optional: - (c.Append('base::DictionaryValue* dictionary = NULL;') + (c.Append('const base::DictionaryValue* dictionary = NULL;') .Append('if (!%(value_var)s->GetAsDictionary(&dictionary))') .Append(' return %(failure_value)s;') .Append('scoped_ptr<%(ctype)s> temp(new %(ctype)s());') @@ -469,7 +469,7 @@ class CCGenerator(object): .Append('%(dst)s->%(name)s = temp.Pass();') ) else: - (c.Append('base::DictionaryValue* dictionary = NULL;') + (c.Append('const base::DictionaryValue* dictionary = NULL;') .Append('if (!%(value_var)s->GetAsDictionary(&dictionary))') .Append(' return %(failure_value)s;') .Append( @@ -485,7 +485,7 @@ class CCGenerator(object): c.Append(self._any_helper.Init(prop, value_var, dst) + ';') elif self._IsArrayOrArrayRef(prop): # util_cc_helper deals with optional and required arrays - (c.Append('base::ListValue* list = NULL;') + (c.Append('const base::ListValue* list = NULL;') .Append('if (!%(value_var)s->GetAsList(&list))') .Append(' return %(failure_value)s;')) if prop.item_type.type_ == PropertyType.ENUM: @@ -523,8 +523,8 @@ class CCGenerator(object): elif prop.type_ == PropertyType.BINARY: (c.Append('if (!%(value_var)s->IsType(%(value_type)s))') .Append(' return %(failure_value)s;') - .Append('base::BinaryValue* binary_value =') - .Append(' static_cast<base::BinaryValue*>(%(value_var)s);') + .Append('const base::BinaryValue* binary_value =') + .Append(' static_cast<const base::BinaryValue*>(%(value_var)s);') ) if prop.optional: (c.Append('%(dst)s->%(name)s.reset(') @@ -564,7 +564,7 @@ class CCGenerator(object): c.Append('%(dst)s->%(name)s.reset(new std::vector<' + ( self._cpp_type_generator.GetType(prop.item_type) + '>);')) accessor = '->' - c.Sblock('for (ListValue::iterator it = list->begin(); ' + c.Sblock('for (ListValue::const_iterator it = list->begin(); ' 'it != list->end(); ++it) {') self._GenerateStringToEnumConversion(c, prop.item_type, '(*it)', 'enum_temp') diff --git a/tools/json_schema_compiler/util.h b/tools/json_schema_compiler/util.h index f0459dc..61148c6 100644 --- a/tools/json_schema_compiler/util.h +++ b/tools/json_schema_compiler/util.h @@ -67,7 +67,7 @@ bool PopulateArrayFromDictionary( const base::DictionaryValue& from, const std::string& name, std::vector<T>* out) { - base::ListValue* list = NULL; + const base::ListValue* list = NULL; if (!from.GetListWithoutPathExpansion(name, &list)) return false; @@ -102,16 +102,16 @@ bool PopulateOptionalArrayFromDictionary( const base::DictionaryValue& from, const std::string& name, scoped_ptr<std::vector<T> >* out) { - base::ListValue* list = NULL; + const base::ListValue* list = NULL; { - base::Value* maybe_list = NULL; + const base::Value* maybe_list = NULL; // Since |name| is optional, its absence is acceptable. However, anything // other than a ListValue is not. if (!from.GetWithoutPathExpansion(name, &maybe_list)) return true; if (!maybe_list->IsType(base::Value::TYPE_LIST)) return false; - list = static_cast<base::ListValue*>(maybe_list); + list = static_cast<const base::ListValue*>(maybe_list); } return PopulateOptionalArrayFromList(*list, out); |