diff options
68 files changed, 249 insertions, 211 deletions
diff --git a/ash/system/network/tray_sms.cc b/ash/system/network/tray_sms.cc index f1714b8..3e3f7c4 100644 --- a/ash/system/network/tray_sms.cc +++ b/ash/system/network/tray_sms.cc @@ -209,7 +209,7 @@ class TraySms::SmsDetailedView : public TrayDetailsView, const base::ListValue& messages = tray_->messages(); scroll_content()->RemoveAllChildViews(true); for (size_t index = 0; index < messages.GetSize(); ++index) { - base::DictionaryValue* message = NULL; + const base::DictionaryValue* message = NULL; if (!messages.GetDictionary(index, &message)) { LOG(ERROR) << "SMS message not a dictionary at: " << index; continue; diff --git a/base/debug/trace_event_unittest.cc b/base/debug/trace_event_unittest.cc index f839d27..5d32f2f 100644 --- a/base/debug/trace_event_unittest.cc +++ b/base/debug/trace_event_unittest.cc @@ -220,10 +220,10 @@ bool TraceEventTestFixture::FindNonMatchingValue(const char* key, return FindMatchingTraceEntry(key_values); } -bool IsStringInDict(const char* string_to_match, DictionaryValue* dict) { +bool IsStringInDict(const char* string_to_match, const DictionaryValue* dict) { for (DictionaryValue::key_iterator ikey = dict->begin_keys(); ikey != dict->end_keys(); ++ikey) { - Value* child = NULL; + const Value* child = NULL; if (!dict->GetWithoutPathExpansion(*ikey, &child)) continue; @@ -237,7 +237,7 @@ bool IsStringInDict(const char* string_to_match, DictionaryValue* dict) { } // Recurse to test arguments - DictionaryValue* args_dict = NULL; + const DictionaryValue* args_dict = NULL; dict->GetDictionary("args", &args_dict); if (args_dict) return IsStringInDict(string_to_match, args_dict); @@ -245,13 +245,14 @@ bool IsStringInDict(const char* string_to_match, DictionaryValue* dict) { return false; } -DictionaryValue* FindTraceEntry(const ListValue& trace_parsed, - const char* string_to_match, - DictionaryValue* match_after_this_item = NULL) { +const DictionaryValue* FindTraceEntry( + const ListValue& trace_parsed, + const char* string_to_match, + const DictionaryValue* match_after_this_item = NULL) { // Scan all items size_t trace_parsed_count = trace_parsed.GetSize(); for (size_t i = 0; i < trace_parsed_count; i++) { - Value* value = NULL; + const Value* value = NULL; trace_parsed.Get(i, &value); if (match_after_this_item) { if (value == match_after_this_item) @@ -260,7 +261,7 @@ DictionaryValue* FindTraceEntry(const ListValue& trace_parsed, } if (!value || value->GetType() != Value::TYPE_DICTIONARY) continue; - DictionaryValue* dict = static_cast<DictionaryValue*>(value); + const DictionaryValue* dict = static_cast<const DictionaryValue*>(value); if (IsStringInDict(string_to_match, dict)) return dict; @@ -268,17 +269,17 @@ DictionaryValue* FindTraceEntry(const ListValue& trace_parsed, return NULL; } -std::vector<DictionaryValue*> FindTraceEntries( +std::vector<const DictionaryValue*> FindTraceEntries( const ListValue& trace_parsed, const char* string_to_match) { - std::vector<DictionaryValue*> hits; + std::vector<const DictionaryValue*> hits; size_t trace_parsed_count = trace_parsed.GetSize(); for (size_t i = 0; i < trace_parsed_count; i++) { - Value* value = NULL; + const Value* value = NULL; trace_parsed.Get(i, &value); if (!value || value->GetType() != Value::TYPE_DICTIONARY) continue; - DictionaryValue* dict = static_cast<DictionaryValue*>(value); + const DictionaryValue* dict = static_cast<const DictionaryValue*>(value); if (IsStringInDict(string_to_match, dict)) hits.push_back(dict); @@ -365,7 +366,7 @@ void TraceWithAllMacroVariants(WaitableEvent* task_complete_event) { } void ValidateAllTraceMacrosCreatedData(const ListValue& trace_parsed) { - DictionaryValue* item = NULL; + const DictionaryValue* item = NULL; #define EXPECT_FIND_(string) \ EXPECT_TRUE((item = FindTraceEntry(trace_parsed, string))); @@ -598,11 +599,11 @@ void ValidateInstantEventPresentOnEveryThread(const ListValue& trace_parsed, size_t trace_parsed_count = trace_parsed.GetSize(); for (size_t i = 0; i < trace_parsed_count; i++) { - Value* value = NULL; + const Value* value = NULL; trace_parsed.Get(i, &value); if (!value || value->GetType() != Value::TYPE_DICTIONARY) continue; - DictionaryValue* dict = static_cast<DictionaryValue*>(value); + const DictionaryValue* dict = static_cast<const DictionaryValue*>(value); std::string name; dict->GetString("name", &name); if (name != "multi thread event") @@ -1149,12 +1150,12 @@ TEST_F(TraceEventTestFixture, ThreadNames) { std::string tmp; int tmp_int; - DictionaryValue* item; + const DictionaryValue* item; // Make sure we get thread name metadata. // Note, the test suite may have created a ton of threads. // So, we'll have thread names for threads we didn't create. - std::vector<DictionaryValue*> items = + std::vector<const DictionaryValue*> items = FindTraceEntries(trace_parsed_, "thread_name"); for (int i = 0; i < static_cast<int>(items.size()); i++) { item = items[i]; @@ -1201,11 +1202,11 @@ TEST_F(TraceEventTestFixture, ThreadNameChanges) { TraceLog::GetInstance()->SetEnabled(false); - std::vector<DictionaryValue*> items = + std::vector<const DictionaryValue*> items = FindTraceEntries(trace_parsed_, "thread_name"); EXPECT_EQ(1u, items.size()); ASSERT_GT(items.size(), 0u); - DictionaryValue* item = items[0]; + const DictionaryValue* item = items[0]; ASSERT_TRUE(item); int tid; EXPECT_TRUE(item->GetInteger("tid", &tid)); @@ -1250,7 +1251,7 @@ TEST_F(TraceEventTestFixture, AtExit) { ASSERT_FALSE(TraceLog::GetInstance()); // Now that singleton is destroyed, check what trace events were recorded - DictionaryValue* item = NULL; + const DictionaryValue* item = NULL; ListValue& trace_parsed = trace_parsed_; EXPECT_FIND_("is recorded 1"); EXPECT_FIND_("is recorded 2"); @@ -1330,9 +1331,9 @@ TEST_F(TraceEventTestFixture, DeepCopy) { EXPECT_FALSE(FindTraceEntry(trace_parsed_, name2.c_str())); EXPECT_FALSE(FindTraceEntry(trace_parsed_, name3.c_str())); - DictionaryValue* entry1 = FindTraceEntry(trace_parsed_, kOriginalName1); - DictionaryValue* entry2 = FindTraceEntry(trace_parsed_, kOriginalName2); - DictionaryValue* entry3 = FindTraceEntry(trace_parsed_, kOriginalName3); + const DictionaryValue* entry1 = FindTraceEntry(trace_parsed_, kOriginalName1); + const DictionaryValue* entry2 = FindTraceEntry(trace_parsed_, kOriginalName2); + const DictionaryValue* entry3 = FindTraceEntry(trace_parsed_, kOriginalName3); ASSERT_TRUE(entry1); ASSERT_TRUE(entry2); ASSERT_TRUE(entry3); diff --git a/base/json/json_value_converter.h b/base/json/json_value_converter.h index 9d3036a..69da0d8 100644 --- a/base/json/json_value_converter.h +++ b/base/json/json_value_converter.h @@ -273,7 +273,7 @@ class RepeatedValueConverter : public ValueConverter<ScopedVector<Element> > { field->reserve(list->GetSize()); for (size_t i = 0; i < list->GetSize(); ++i) { - base::Value* element = NULL; + const base::Value* element = NULL; if (!list->Get(i, &element)) continue; @@ -307,7 +307,7 @@ class RepeatedMessageConverter field->reserve(list->GetSize()); for (size_t i = 0; i < list->GetSize(); ++i) { - base::Value* element = NULL; + const base::Value* element = NULL; if (!list->Get(i, &element)) continue; @@ -344,7 +344,7 @@ class RepeatedCustomValueConverter field->reserve(list->GetSize()); for (size_t i = 0; i < list->GetSize(); ++i) { - base::Value* element = NULL; + const base::Value* element = NULL; if (!list->Get(i, &element)) continue; diff --git a/base/json/json_writer.cc b/base/json/json_writer.cc index 9ca4813..e8cf9ac 100644 --- a/base/json/json_writer.cc +++ b/base/json/json_writer.cc @@ -139,7 +139,7 @@ void JSONWriter::BuildJSONString(const Value* const node, int depth) { const ListValue* list = static_cast<const ListValue*>(node); for (size_t i = 0; i < list->GetSize(); ++i) { - Value* value = NULL; + const Value* value = NULL; bool result = list->Get(i, &value); DCHECK(result); diff --git a/base/values.cc b/base/values.cc index 08fab89..1ccc9ec 100644 --- a/base/values.cc +++ b/base/values.cc @@ -820,7 +820,7 @@ bool ListValue::Set(size_t index, Value* in_value) { return true; } -bool ListValue::Get(size_t index, Value** out_value) const { +bool ListValue::Get(size_t index, const Value** out_value) const { if (index >= list_.size()) return false; @@ -830,8 +830,14 @@ bool ListValue::Get(size_t index, Value** out_value) const { return true; } +bool ListValue::Get(size_t index, Value** out_value) { + return static_cast<const ListValue&>(*this).Get( + index, + const_cast<const Value**>(out_value)); +} + bool ListValue::GetBoolean(size_t index, bool* bool_value) const { - Value* value; + const Value* value; if (!Get(index, &value)) return false; @@ -839,7 +845,7 @@ bool ListValue::GetBoolean(size_t index, bool* bool_value) const { } bool ListValue::GetInteger(size_t index, int* out_value) const { - Value* value; + const Value* value; if (!Get(index, &value)) return false; @@ -847,7 +853,7 @@ bool ListValue::GetInteger(size_t index, int* out_value) const { } bool ListValue::GetDouble(size_t index, double* out_value) const { - Value* value; + const Value* value; if (!Get(index, &value)) return false; @@ -855,7 +861,7 @@ bool ListValue::GetDouble(size_t index, double* out_value) const { } bool ListValue::GetString(size_t index, std::string* out_value) const { - Value* value; + const Value* value; if (!Get(index, &value)) return false; @@ -863,49 +869,68 @@ bool ListValue::GetString(size_t index, std::string* out_value) const { } bool ListValue::GetString(size_t index, string16* out_value) const { - Value* value; + const Value* value; if (!Get(index, &value)) return false; return value->GetAsString(out_value); } -bool ListValue::GetBinary(size_t index, BinaryValue** out_value) const { - Value* value; +bool ListValue::GetBinary(size_t index, const BinaryValue** out_value) const { + const Value* value; bool result = Get(index, &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 ListValue::GetDictionary(size_t index, DictionaryValue** out_value) const { - Value* value; +bool ListValue::GetBinary(size_t index, BinaryValue** out_value) { + return static_cast<const ListValue&>(*this).GetBinary( + index, + const_cast<const BinaryValue**>(out_value)); +} + +bool ListValue::GetDictionary(size_t index, + const DictionaryValue** out_value) const { + const Value* value; bool result = Get(index, &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 ListValue::GetList(size_t index, ListValue** out_value) const { - Value* value; +bool ListValue::GetDictionary(size_t index, DictionaryValue** out_value) { + return static_cast<const ListValue&>(*this).GetDictionary( + index, + const_cast<const DictionaryValue**>(out_value)); +} + +bool ListValue::GetList(size_t index, const ListValue** out_value) const { + const Value* value; bool result = Get(index, &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 ListValue::GetList(size_t index, ListValue** out_value) { + return static_cast<const ListValue&>(*this).GetList( + index, + const_cast<const ListValue**>(out_value)); +} + bool ListValue::Remove(size_t index, Value** out_value) { if (index >= list_.size()) return false; diff --git a/base/values.h b/base/values.h index 223e0f8..c583407 100644 --- a/base/values.h +++ b/base/values.h @@ -414,7 +414,8 @@ class BASE_EXPORT ListValue : public Value { // Gets the Value at the given index. Modifies |out_value| (and returns true) // only if the index falls within the current list range. // Note that the list always owns the Value passed out via |out_value|. - bool Get(size_t index, Value** out_value) const; + bool Get(size_t index, const Value** out_value) const; + bool Get(size_t index, Value** out_value); // Convenience forms of Get(). Modifies |out_value| (and returns true) // only if the index is valid and the Value at that index can be returned @@ -424,9 +425,12 @@ class BASE_EXPORT ListValue : public Value { bool GetDouble(size_t index, double* out_value) const; bool GetString(size_t index, std::string* out_value) const; bool GetString(size_t index, string16* out_value) const; - bool GetBinary(size_t index, BinaryValue** out_value) const; - bool GetDictionary(size_t index, DictionaryValue** out_value) const; - bool GetList(size_t index, ListValue** out_value) const; + bool GetBinary(size_t index, const BinaryValue** out_value) const; + bool GetBinary(size_t index, BinaryValue** out_value); + bool GetDictionary(size_t index, const DictionaryValue** out_value) const; + bool GetDictionary(size_t index, DictionaryValue** out_value); + bool GetList(size_t index, const ListValue** out_value) const; + bool GetList(size_t index, ListValue** out_value); // Removes the Value with the specified index from this list. // If |out_value| is non-NULL, the removed Value AND ITS OWNERSHIP will be diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 6c52b92..adb651d 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -5194,8 +5194,8 @@ std::vector<AutofillProfile> TestingAutomationProvider::GetAutofillProfilesFromList( const ListValue& profiles, std::string* error_message) { std::vector<AutofillProfile> autofill_profiles; - DictionaryValue* profile_info = NULL; - ListValue* current_value = NULL; + const DictionaryValue* profile_info = NULL; + const ListValue* current_value = NULL; std::map<AutofillFieldType, std::string> autofill_type_to_string = GetAutofillFieldToStringMap(); @@ -5211,7 +5211,7 @@ TestingAutomationProvider::GetAutofillProfilesFromList( if (profile_info->HasKey(type_it->second)) { if (profile_info->GetList(type_it->second, ¤t_value)) { std::vector<string16> value_list; - for (ListValue::iterator list_it = current_value->begin(); + for (ListValue::const_iterator list_it = current_value->begin(); list_it != current_value->end(); ++list_it) { string16 value; if ((*list_it)->GetAsString(&value)) { @@ -5237,7 +5237,7 @@ TestingAutomationProvider::GetAutofillProfilesFromList( std::vector<CreditCard> TestingAutomationProvider::GetCreditCardsFromList( const ListValue& cards, std::string* error_message) { std::vector<CreditCard> credit_cards; - DictionaryValue* card_info = NULL; + const DictionaryValue* card_info = NULL; string16 current_value; std::map<AutofillFieldType, std::string> credit_card_type_to_string = diff --git a/chrome/browser/bookmarks/bookmark_codec.cc b/chrome/browser/bookmarks/bookmark_codec.cc index 6eff50a..d153418 100644 --- a/chrome/browser/bookmarks/bookmark_codec.cc +++ b/chrome/browser/bookmarks/bookmark_codec.cc @@ -203,14 +203,14 @@ bool BookmarkCodec::DecodeHelper(BookmarkNode* bb_node, bool BookmarkCodec::DecodeChildren(const ListValue& child_value_list, BookmarkNode* parent) { for (size_t i = 0; i < child_value_list.GetSize(); ++i) { - Value* child_value; + const Value* child_value; if (!child_value_list.Get(i, &child_value)) return false; if (child_value->GetType() != Value::TYPE_DICTIONARY) return false; - DecodeNode(*static_cast<DictionaryValue*>(child_value), parent, NULL); + DecodeNode(*static_cast<const DictionaryValue*>(child_value), parent, NULL); } return true; } diff --git a/chrome/browser/bookmarks/bookmark_extension_api.cc b/chrome/browser/bookmarks/bookmark_extension_api.cc index 0ef128e..af082f7 100644 --- a/chrome/browser/bookmarks/bookmark_extension_api.cc +++ b/chrome/browser/bookmarks/bookmark_extension_api.cc @@ -705,7 +705,7 @@ class CreateBookmarkBucketMapper : public BookmarkBucketMapper<std::string> { // TODO(tim): This should share code with CreateBookmarkFunction::RunImpl, // but I can't figure out a good way to do that with all the macros. virtual void GetBucketsForArgs(const ListValue* args, BucketList* buckets) { - DictionaryValue* json; + const DictionaryValue* json; if (!args->GetDictionary(0, &json)) return; diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc index da80888..014fbea 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -334,7 +334,7 @@ class Writer : public base::RefCountedThreadSafe<Writer> { // Write the children. const ListValue* children = static_cast<const ListValue*>(child_values); for (size_t i = 0; i < children->GetSize(); ++i) { - Value* child_value; + const Value* child_value; if (!children->Get(i, &child_value) || child_value->GetType() != Value::TYPE_DICTIONARY) { NOTREACHED(); diff --git a/chrome/browser/bookmarks/bookmark_manager_extension_api.cc b/chrome/browser/bookmarks/bookmark_manager_extension_api.cc index 4e6ef34..199056a 100644 --- a/chrome/browser/bookmarks/bookmark_manager_extension_api.cc +++ b/chrome/browser/bookmarks/bookmark_manager_extension_api.cc @@ -58,7 +58,7 @@ const BookmarkNode* GetNodeFromArguments(BookmarkModel* model, bool GetNodesFromArguments(BookmarkModel* model, const ListValue* args, size_t args_index, std::vector<const BookmarkNode*>* nodes) { - ListValue* ids; + const ListValue* ids; if (!args->GetList(args_index, &ids)) return false; diff --git a/chrome/browser/chromeos/cros/cros_network_functions.cc b/chrome/browser/chromeos/cros/cros_network_functions.cc index 992a172..c3946de 100644 --- a/chrome/browser/chromeos/cros/cros_network_functions.cc +++ b/chrome/browser/chromeos/cros/cros_network_functions.cc @@ -141,7 +141,7 @@ class DataPlanUpdateWatcher : public CrosNetworkWatcher { const base::ListValue& data_plans) { CellularDataPlanVector* data_plan_vector = new CellularDataPlanVector; for (size_t i = 0; i != data_plans.GetSize(); ++i) { - base::DictionaryValue* data_plan = NULL; + const base::DictionaryValue* data_plan = NULL; if (!data_plans.GetDictionary(i, &data_plan)) { LOG(ERROR) << "data_plans[" << i << "] is not a dictionary."; continue; diff --git a/chrome/browser/chromeos/cros/onc_network_parser.cc b/chrome/browser/chromeos/cros/onc_network_parser.cc index 86376d6..26d722a 100644 --- a/chrome/browser/chromeos/cros/onc_network_parser.cc +++ b/chrome/browser/chromeos/cros/onc_network_parser.cc @@ -1941,7 +1941,7 @@ bool OncVirtualNetworkParser::ParseOpenVPNValue(OncNetworkParser* parser, // today. So extract the first. const base::ListValue* value_list = NULL; value.GetAsList(&value_list); - base::Value* first_item = NULL; + const base::Value* first_item = NULL; if (!value_list->Get(0, &first_item) || !first_item->IsType(base::Value::TYPE_STRING)) { VLOG(1) << "RemoteCertKU must be non-empty list of strings"; diff --git a/chrome/browser/chromeos/cros/sms_watcher.cc b/chrome/browser/chromeos/cros/sms_watcher.cc index c782a0c..d7efb29 100644 --- a/chrome/browser/chromeos/cros/sms_watcher.cc +++ b/chrome/browser/chromeos/cros/sms_watcher.cc @@ -183,7 +183,7 @@ class GsmWatcher : public SMSWatcher::WatcherBase { // List() is called only once; no one touches delete_queue_ before List(). CHECK(delete_queue_.empty()); for (size_t i = 0; i != result.GetSize(); ++i) { - base::DictionaryValue* sms_dictionary = NULL; + const base::DictionaryValue* sms_dictionary = NULL; if (!result.GetDictionary(i, &sms_dictionary)) { LOG(ERROR) << "result[" << i << "] is not a dictionary."; continue; diff --git a/chrome/browser/chromeos/gdata/gdata_contacts_service.cc b/chrome/browser/chromeos/gdata/gdata_contacts_service.cc index b6657da..16f49ad 100644 --- a/chrome/browser/chromeos/gdata/gdata_contacts_service.cc +++ b/chrome/browser/chromeos/gdata/gdata_contacts_service.cc @@ -180,7 +180,7 @@ std::string GetPhotoUrl(const DictionaryValue& dict) { return std::string(); for (size_t i = 0; i < link_list->GetSize(); ++i) { - DictionaryValue* link_dict = NULL; + const DictionaryValue* link_dict = NULL; if (!link_list->GetDictionary(i, &link_dict)) continue; @@ -237,7 +237,7 @@ bool FillContactFromDictionary(const base::DictionaryValue& dict, const ListValue* email_list = NULL; if (dict.GetList(kEmailField, &email_list)) { for (size_t i = 0; i < email_list->GetSize(); ++i) { - DictionaryValue* email_dict = NULL; + const DictionaryValue* email_dict = NULL; if (!email_list->GetDictionary(i, &email_dict)) return false; @@ -252,7 +252,7 @@ bool FillContactFromDictionary(const base::DictionaryValue& dict, const ListValue* phone_list = NULL; if (dict.GetList(kPhoneField, &phone_list)) { for (size_t i = 0; i < phone_list->GetSize(); ++i) { - DictionaryValue* phone_dict = NULL; + const DictionaryValue* phone_dict = NULL; if (!phone_list->GetDictionary(i, &phone_dict)) return false; @@ -267,7 +267,7 @@ bool FillContactFromDictionary(const base::DictionaryValue& dict, const ListValue* address_list = NULL; if (dict.GetList(kPostalAddressField, &address_list)) { for (size_t i = 0; i < address_list->GetSize(); ++i) { - DictionaryValue* address_dict = NULL; + const DictionaryValue* address_dict = NULL; if (!address_list->GetDictionary(i, &address_dict)) return false; @@ -285,7 +285,7 @@ bool FillContactFromDictionary(const base::DictionaryValue& dict, const ListValue* im_list = NULL; if (dict.GetList(kInstantMessagingField, &im_list)) { for (size_t i = 0; i < im_list->GetSize(); ++i) { - DictionaryValue* im_dict = NULL; + const DictionaryValue* im_dict = NULL; if (!im_list->GetDictionary(i, &im_dict)) return false; @@ -404,7 +404,7 @@ class GDataContactsService::DownloadContactsRequest LOG(WARNING) << "Category list missing"; return false; } - DictionaryValue* category_dict = NULL; + const DictionaryValue* category_dict = NULL; if (!category_list->GetSize() == 1 || !category_list->GetDictionary(0, &category_dict)) { LOG(WARNING) << "Unable to get dictionary from category list of size " diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc index e9e0c08..b208053 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc @@ -834,7 +834,7 @@ ProtocolHandlerRegistry::GetHandlersFromPref(const char* pref_name) const { const ListValue* handlers = prefs->GetList(pref_name); if (handlers) { for (size_t i = 0; i < handlers->GetSize(); ++i) { - DictionaryValue* dict; + const DictionaryValue* dict; if (!handlers->GetDictionary(i, &dict)) continue; if (ProtocolHandler::IsValidDict(dict)) { diff --git a/chrome/browser/extensions/api/alarms/alarm_manager.cc b/chrome/browser/extensions/api/alarms/alarm_manager.cc index fedb30f..cf72576 100644 --- a/chrome/browser/extensions/api/alarms/alarm_manager.cc +++ b/chrome/browser/extensions/api/alarms/alarm_manager.cc @@ -59,11 +59,11 @@ base::TimeDelta TimeDeltaFromDelay(double delay_in_minutes) { std::vector<Alarm> AlarmsFromValue(const base::ListValue* list) { std::vector<Alarm> alarms; for (size_t i = 0; i < list->GetSize(); ++i) { - base::DictionaryValue* alarm_dict = NULL; + const base::DictionaryValue* alarm_dict = NULL; Alarm alarm; if (list->GetDictionary(i, &alarm_dict) && api::alarms::Alarm::Populate(*alarm_dict, alarm.js_alarm.get())) { - base::Value* time_value = NULL; + const base::Value* time_value = NULL; if (alarm_dict->Get(kAlarmGranularity, &time_value)) base::GetValueAsTimeDelta(*time_value, &alarm.granularity); alarms.push_back(alarm); diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc index 3408fed..0af965c 100644 --- a/chrome/browser/extensions/api/management/management_api.cc +++ b/chrome/browser/extensions/api/management/management_api.cc @@ -268,10 +268,11 @@ class SafeManifestJSONParser : public UtilityProcessHostClient { void OnJSONParseSucceeded(const ListValue& wrapper) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - Value* value = NULL; + const Value* value = NULL; CHECK(wrapper.Get(0, &value)); if (value->IsType(Value::TYPE_DICTIONARY)) - parsed_manifest_.reset(static_cast<DictionaryValue*>(value)->DeepCopy()); + parsed_manifest_.reset( + static_cast<const DictionaryValue*>(value)->DeepCopy()); else error_ = keys::kManifestParseError; diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc index 16d0a09..29f3ae8 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc @@ -179,7 +179,7 @@ bool ExtensionOmniboxSuggestion::Populate(const base::DictionaryValue& value, return false; } for (size_t i = 0; i < styles->GetSize(); ++i) { - base::DictionaryValue* style = NULL; + const base::DictionaryValue* style = NULL; int offset, type; if (!styles->GetDictionary(i, &style)) return false; @@ -206,7 +206,7 @@ bool ExtensionOmniboxSuggestion::ReadStylesFromValue( styles.resize(description.length()); // sets all styles to 0 for (size_t i = 0; i < styles_value.GetSize(); ++i) { - DictionaryValue* style; + const DictionaryValue* style; std::string type; int offset; int length; diff --git a/chrome/browser/extensions/api/record/record_api_test.cc b/chrome/browser/extensions/api/record/record_api_test.cc index f5260c7..8d13914 100644 --- a/chrome/browser/extensions/api/record/record_api_test.cc +++ b/chrome/browser/extensions/api/record/record_api_test.cc @@ -243,7 +243,7 @@ class RecordApiTest : public InProcessBrowserTest { const TestProcessStrategy& strategy) { // Check that the two bad URLs are returned. - base::Value* string_value = NULL; + const base::Value* string_value = NULL; StringValue badURL2("URL 2(bad)"), badURL4("URL 4(bad)"); EXPECT_TRUE(result->GetSize() == 2); diff --git a/chrome/browser/extensions/event_listener_map.cc b/chrome/browser/extensions/event_listener_map.cc index 4d0c9fc..18874f3 100644 --- a/chrome/browser/extensions/event_listener_map.cc +++ b/chrome/browser/extensions/event_listener_map.cc @@ -173,7 +173,7 @@ void EventListenerMap::LoadFilteredLazyListeners( if (!filtered.GetListWithoutPathExpansion(*it, &filter_list)) continue; for (size_t i = 0; i < filter_list->GetSize(); i++) { - DictionaryValue* filter = NULL; + const DictionaryValue* filter = NULL; if (!filter_list->GetDictionary(i, &filter)) continue; AddListener(scoped_ptr<EventListener>(new EventListener( diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc index 47c727d..820fbde 100644 --- a/chrome/browser/extensions/extension_function_test_utils.cc +++ b/chrome/browser/extensions/extension_function_test_utils.cc @@ -153,7 +153,7 @@ base::Value* RunFunctionAndReturnSingleResult( RunFunction(function, args, browser, flags); EXPECT_TRUE(function->GetError().empty()) << "Unexpected error: " << function->GetError(); - base::Value* single_result = NULL; + const base::Value* single_result = NULL; if (function->GetResultList() != NULL && function->GetResultList()->Get(0, &single_result)) { return single_result->DeepCopy(); diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc index ad4233b..d433118 100644 --- a/chrome/browser/extensions/extension_web_ui.cc +++ b/chrome/browser/extensions/extension_web_ui.cc @@ -232,7 +232,7 @@ bool ExtensionWebUI::HandleChromeURLOverride( size_t i = 0; while (i < url_list->GetSize()) { - Value* val = NULL; + const Value* val = NULL; url_list->Get(i, &val); // Verify that the override value is good. If not, unregister it and find @@ -365,7 +365,7 @@ void ExtensionWebUI::RegisterChromeURLOverrides( void ExtensionWebUI::UnregisterAndReplaceOverride(const std::string& page, Profile* profile, ListValue* list, - Value* override) { + const Value* override) { size_t index = 0; bool found = list->Remove(*override, &index); if (found && index == 0) { @@ -379,7 +379,8 @@ void ExtensionWebUI::UnregisterAndReplaceOverride(const std::string& page, // static void ExtensionWebUI::UnregisterChromeURLOverride(const std::string& page, - Profile* profile, Value* override) { + Profile* profile, + const Value* override) { if (!override) return; PrefService* prefs = profile->GetPrefs(); diff --git a/chrome/browser/extensions/extension_web_ui.h b/chrome/browser/extensions/extension_web_ui.h index f44d14b..f317cd4 100644 --- a/chrome/browser/extensions/extension_web_ui.h +++ b/chrome/browser/extensions/extension_web_ui.h @@ -50,7 +50,7 @@ class ExtensionWebUI : public content::WebUIController { const extensions::Extension::URLOverrideMap& overrides); static void UnregisterChromeURLOverride(const std::string& page, Profile* profile, - base::Value* override); + const base::Value* override); // Called from BrowserPrefs static void RegisterUserPrefs(PrefService* prefs); @@ -66,7 +66,7 @@ class ExtensionWebUI : public content::WebUIController { static void UnregisterAndReplaceOverride(const std::string& page, Profile* profile, base::ListValue* list, - base::Value* override); + const base::Value* override); // TODO(aa): This seems out of place. Why is it not with the event routers for // the other extension APIs? diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc index 6e09305..f7e8698 100644 --- a/chrome/browser/extensions/webstore_inline_installer.cc +++ b/chrome/browser/extensions/webstore_inline_installer.cc @@ -101,11 +101,11 @@ class SafeWebstoreResponseParser : public UtilityProcessHostClient { void OnJSONParseSucceeded(const ListValue& wrapper) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - Value* value = NULL; + const Value* value = NULL; CHECK(wrapper.Get(0, &value)); if (value->IsType(Value::TYPE_DICTIONARY)) { parsed_webstore_data_.reset( - static_cast<DictionaryValue*>(value)->DeepCopy()); + static_cast<const DictionaryValue*>(value)->DeepCopy()); } else { error_ = kInvalidWebstoreResponseError; } diff --git a/chrome/browser/extensions/webstore_install_helper.cc b/chrome/browser/extensions/webstore_install_helper.cc index f1960b5..950fbb6 100644 --- a/chrome/browser/extensions/webstore_install_helper.cc +++ b/chrome/browser/extensions/webstore_install_helper.cc @@ -152,11 +152,11 @@ void WebstoreInstallHelper::OnDecodeImageFailed() { void WebstoreInstallHelper::OnJSONParseSucceeded(const ListValue& wrapper) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); manifest_parse_complete_ = true; - Value* value = NULL; + const Value* value = NULL; CHECK(wrapper.Get(0, &value)); if (value->IsType(Value::TYPE_DICTIONARY)) { parsed_manifest_.reset( - static_cast<DictionaryValue*>(value)->DeepCopy()); + static_cast<const DictionaryValue*>(value)->DeepCopy()); } else { parse_error_ = Delegate::MANIFEST_ERROR; } diff --git a/chrome/browser/gpu_blacklist.cc b/chrome/browser/gpu_blacklist.cc index 39cd4a8..4327c51 100644 --- a/chrome/browser/gpu_blacklist.cc +++ b/chrome/browser/gpu_blacklist.cc @@ -315,7 +315,7 @@ bool GpuBlacklist::FloatInfo::IsValid() const { // static GpuBlacklist::ScopedGpuBlacklistEntry GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( - DictionaryValue* value, bool top_level) { + const DictionaryValue* value, bool top_level) { DCHECK(value); ScopedGpuBlacklistEntry entry(new GpuBlacklistEntry()); @@ -345,7 +345,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( entry->description_ = "The GPU is unavailable for an unexplained reason."; } - ListValue* cr_bugs; + const ListValue* cr_bugs; if (value->GetList("cr_bugs", &cr_bugs)) { for (size_t i = 0; i < cr_bugs->GetSize(); ++i) { int bug_id; @@ -359,7 +359,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - ListValue* webkit_bugs; + const ListValue* webkit_bugs; if (value->GetList("webkit_bugs", &webkit_bugs)) { for (size_t i = 0; i < webkit_bugs->GetSize(); ++i) { int bug_id; @@ -373,14 +373,14 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - DictionaryValue* os_value = NULL; + const DictionaryValue* os_value = NULL; if (value->GetDictionary("os", &os_value)) { std::string os_type; std::string os_version_op = "any"; std::string os_version_string; std::string os_version_string2; os_value->GetString("type", &os_type); - DictionaryValue* os_version_value = NULL; + const DictionaryValue* os_version_value = NULL; if (os_value->GetDictionary("version", &os_version_value)) { os_version_value->GetString("op", &os_version_op); os_version_value->GetString("number", &os_version_string); @@ -403,7 +403,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - ListValue* device_id_list; + const ListValue* device_id_list; if (value->GetList("device_id", &device_id_list)) { for (size_t i = 0; i < device_id_list->GetSize(); ++i) { std::string device_id; @@ -434,7 +434,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - DictionaryValue* driver_vendor_value = NULL; + const DictionaryValue* driver_vendor_value = NULL; if (value->GetDictionary("driver_vendor", &driver_vendor_value)) { std::string vendor_op; std::string vendor_value; @@ -447,7 +447,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - DictionaryValue* driver_version_value = NULL; + const DictionaryValue* driver_version_value = NULL; if (value->GetDictionary("driver_version", &driver_version_value)) { std::string driver_version_op = "any"; std::string driver_version_style; @@ -467,7 +467,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - DictionaryValue* driver_date_value = NULL; + const DictionaryValue* driver_date_value = NULL; if (value->GetDictionary("driver_date", &driver_date_value)) { std::string driver_date_op = "any"; std::string driver_date_string; @@ -483,7 +483,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - DictionaryValue* gl_vendor_value = NULL; + const DictionaryValue* gl_vendor_value = NULL; if (value->GetDictionary("gl_vendor", &gl_vendor_value)) { std::string vendor_op; std::string vendor_value; @@ -496,7 +496,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - DictionaryValue* gl_renderer_value = NULL; + const DictionaryValue* gl_renderer_value = NULL; if (value->GetDictionary("gl_renderer", &gl_renderer_value)) { std::string renderer_op; std::string renderer_value; @@ -509,7 +509,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - DictionaryValue* perf_graphics_value = NULL; + const DictionaryValue* perf_graphics_value = NULL; if (value->GetDictionary("perf_graphics", &perf_graphics_value)) { std::string op; std::string float_value; @@ -524,7 +524,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - DictionaryValue* perf_gaming_value = NULL; + const DictionaryValue* perf_gaming_value = NULL; if (value->GetDictionary("perf_gaming", &perf_gaming_value)) { std::string op; std::string float_value; @@ -539,7 +539,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - DictionaryValue* perf_overall_value = NULL; + const DictionaryValue* perf_overall_value = NULL; if (value->GetDictionary("perf_overall", &perf_overall_value)) { std::string op; std::string float_value; @@ -555,7 +555,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( } if (top_level) { - ListValue* blacklist_value = NULL; + const ListValue* blacklist_value = NULL; if (!value->GetList("blacklist", &blacklist_value)) { LOG(WARNING) << "Malformed blacklist entry " << entry->id(); return NULL; @@ -578,10 +578,10 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( } if (top_level) { - ListValue* exception_list_value = NULL; + const ListValue* exception_list_value = NULL; if (value->GetList("exceptions", &exception_list_value)) { for (size_t i = 0; i < exception_list_value->GetSize(); ++i) { - DictionaryValue* exception_value = NULL; + const DictionaryValue* exception_value = NULL; if (!exception_list_value->GetDictionary(i, &exception_value)) { LOG(WARNING) << "Malformed exceptions entry " << entry->id(); return NULL; @@ -602,7 +602,7 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue( dictionary_entry_count++; } - DictionaryValue* browser_version_value = NULL; + const DictionaryValue* browser_version_value = NULL; // browser_version is processed in LoadGpuBlacklist(). if (value->GetDictionary("browser_version", &browser_version_value)) dictionary_entry_count++; @@ -975,7 +975,7 @@ bool GpuBlacklist::LoadGpuBlacklist( uint32 max_entry_id = 0; bool contains_unknown_fields = false; for (size_t i = 0; i < list->GetSize(); ++i) { - DictionaryValue* list_item = NULL; + const DictionaryValue* list_item = NULL; bool valid = list->GetDictionary(i, &list_item); if (!valid || list_item == NULL) return false; @@ -1138,9 +1138,9 @@ void GpuBlacklist::Clear() { GpuBlacklist::BrowserVersionSupport GpuBlacklist::IsEntrySupportedByCurrentBrowserVersion( - DictionaryValue* value) { + const DictionaryValue* value) { DCHECK(value); - DictionaryValue* browser_version_value = NULL; + const DictionaryValue* browser_version_value = NULL; if (value->GetDictionary("browser_version", &browser_version_value)) { std::string version_op = "any"; std::string version_string; diff --git a/chrome/browser/gpu_blacklist.h b/chrome/browser/gpu_blacklist.h index 44692be..8a1d0f3 100644 --- a/chrome/browser/gpu_blacklist.h +++ b/chrome/browser/gpu_blacklist.h @@ -228,7 +228,7 @@ class GpuBlacklist : public content::GpuDataManagerObserver { // Constructs GpuBlacklistEntry from DictionaryValue loaded from json. // Top-level entry must have an id number. Others are exceptions. static ScopedGpuBlacklistEntry GetGpuBlacklistEntryFromValue( - base::DictionaryValue* value, bool top_level); + const base::DictionaryValue* value, bool top_level); // Determines if a given os/gc/driver is included in the Entry set. bool Contains(OsType os_type, @@ -381,7 +381,7 @@ class GpuBlacklist : public content::GpuDataManagerObserver { // By default, if there is no browser version information in the entry, // return kSupported; BrowserVersionSupport IsEntrySupportedByCurrentBrowserVersion( - base::DictionaryValue* value); + const base::DictionaryValue* value); // GpuDataManager::Observer implementation. virtual void OnGpuInfoUpdate() OVERRIDE; diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc index 5df69b86..66f7956 100644 --- a/chrome/browser/net/predictor.cc +++ b/chrome/browser/net/predictor.cc @@ -613,7 +613,7 @@ void Predictor::DeserializeReferrers(const base::ListValue& referral_list) { referral_list.GetInteger(0, &format_version) && format_version == kPredictorReferrerVersion) { for (size_t i = 1; i < referral_list.GetSize(); ++i) { - base::ListValue* motivator; + const base::ListValue* motivator; if (!referral_list.GetList(i, &motivator)) { NOTREACHED(); return; @@ -624,7 +624,7 @@ void Predictor::DeserializeReferrers(const base::ListValue& referral_list) { return; } - Value* subresource_list; + const Value* subresource_list; if (!motivator->Get(1, &subresource_list)) { NOTREACHED(); return; diff --git a/chrome/browser/net/predictor_unittest.cc b/chrome/browser/net/predictor_unittest.cc index 9022be5..c379c17 100644 --- a/chrome/browser/net/predictor_unittest.cc +++ b/chrome/browser/net/predictor_unittest.cc @@ -247,15 +247,16 @@ TEST_F(PredictorTest, MassiveConcurrentLookupTest) { // Return a motivation_list if we can find one for the given motivating_host (or // NULL if a match is not found). -static ListValue* FindSerializationMotivation(const GURL& motivation, - const ListValue& referral_list) { - CHECK_LT(0u, referral_list.GetSize()); // Room for version. +static const ListValue* FindSerializationMotivation( + const GURL& motivation, + const ListValue* referral_list) { + CHECK_LT(0u, referral_list->GetSize()); // Room for version. int format_version = -1; - CHECK(referral_list.GetInteger(0, &format_version)); + CHECK(referral_list->GetInteger(0, &format_version)); CHECK_EQ(Predictor::kPredictorReferrerVersion, format_version); - ListValue* motivation_list(NULL); - for (size_t i = 1; i < referral_list.GetSize(); ++i) { - referral_list.GetList(i, &motivation_list); + const ListValue* motivation_list(NULL); + for (size_t i = 1; i < referral_list->GetSize(); ++i) { + referral_list->GetList(i, &motivation_list); std::string existing_spec; EXPECT_TRUE(motivation_list->GetString(0, &existing_spec)); if (motivation == GURL(existing_spec)) @@ -264,6 +265,12 @@ static ListValue* FindSerializationMotivation(const GURL& motivation, return NULL; } +static ListValue* FindSerializationMotivation(const GURL& motivation, + ListValue* referral_list) { + return const_cast<ListValue*>(FindSerializationMotivation( + motivation, static_cast<const ListValue*>(referral_list))); +} + // Create a new empty serialization list. static ListValue* NewEmptySerializationList() { base::ListValue* list = new base::ListValue; @@ -281,7 +288,7 @@ static void AddToSerializedList(const GURL& motivation, ListValue* referral_list ) { // Find the motivation if it is already used. ListValue* motivation_list = FindSerializationMotivation(motivation, - *referral_list); + referral_list); if (!motivation_list) { // This is the first mention of this motivation, so build a list. motivation_list = new ListValue; @@ -315,11 +322,11 @@ static bool GetDataFromSerialization(const GURL& motivation, const GURL& subresource, const ListValue& referral_list, double* use_rate) { - ListValue* motivation_list = FindSerializationMotivation(motivation, - referral_list); + const ListValue* motivation_list = + FindSerializationMotivation(motivation, &referral_list); if (!motivation_list) return false; - ListValue* subresource_list; + const ListValue* subresource_list; EXPECT_TRUE(motivation_list->GetList(1, &subresource_list)); for (size_t i = 0; i < subresource_list->GetSize();) { std::string url_spec; diff --git a/chrome/browser/policy/policy_loader_win_unittest.cc b/chrome/browser/policy/policy_loader_win_unittest.cc index 9173c26..4119a2f 100644 --- a/chrome/browser/policy/policy_loader_win_unittest.cc +++ b/chrome/browser/policy/policy_loader_win_unittest.cc @@ -95,7 +95,7 @@ bool InstallValue(const base::Value& value, if (!value.GetAsList(&list)) return false; for (size_t i = 0; i < list->GetSize(); ++i) { - base::Value* item; + const base::Value* item; if (!list->Get(i, &item)) return false; if (!InstallValue(*item, hive, path + kPathSep + name, diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index 930c3f35..90ea961 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -125,7 +125,7 @@ void PrintJobWorker::UpdatePrintSettings( 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; + const DictionaryValue* dict; if (!page_range_array->GetDictionary(index, &dict)) continue; diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc index 82da8f6..acd3089 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc @@ -3364,8 +3364,8 @@ void GetPrepopulatedTemplateFromPrefs(Profile* profile, size_t num_engines = list->GetSize(); for (size_t i = 0; i != num_engines; ++i) { - Value* val; - DictionaryValue* engine; + const Value* val; + const DictionaryValue* engine; if (list->GetDictionary(i, &engine) && engine->Get("name", &val) && val->GetAsString(&name) && engine->Get("keyword", &val) && val->GetAsString(&keyword) && diff --git a/chrome/browser/sync/invalidations/invalidator_storage.cc b/chrome/browser/sync/invalidations/invalidator_storage.cc index 3546d9c..5e2f861 100644 --- a/chrome/browser/sync/invalidations/invalidator_storage.cc +++ b/chrome/browser/sync/invalidations/invalidator_storage.cc @@ -122,7 +122,7 @@ void InvalidatorStorage::DeserializeFromList( InvalidationVersionMap* max_versions_map) { max_versions_map->clear(); for (size_t i = 0; i < max_versions_list.GetSize(); ++i) { - DictionaryValue* value = NULL; + const DictionaryValue* value = NULL; if (!max_versions_list.GetDictionary(i, &value)) { DLOG(WARNING) << "Unable to deserialize entry " << i; continue; diff --git a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm index 4b088ea..f8de658 100644 --- a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm @@ -104,7 +104,7 @@ void ChromeToMobileBubbleNotificationBridge::OnSendComplete(bool success) { NSWindow* window = [self window]; const ListValue* mobiles = service_->GetMobiles(); - DictionaryValue* mobile = NULL; + const DictionaryValue* mobile = NULL; string16 name; if (mobiles->GetSize() == 1) { @@ -185,7 +185,7 @@ void ChromeToMobileBubbleNotificationBridge::OnSendComplete(bool success) { // NSMatrix selectedRow is -1 by default (in the single mobile device case). const int selected_index = std::max<int>([mobileRadioGroup_ selectedRow], 0); - DictionaryValue* mobile = NULL; + const DictionaryValue* mobile = NULL; if (mobiles->GetDictionary(selected_index, &mobile)) { service_->SendToMobile(*mobile, ([sendCopy_ state] == NSOnState) ? snapshotPath_ : FilePath(), diff --git a/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.cc b/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.cc index 8f868f0..92a678b 100644 --- a/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.cc @@ -172,7 +172,7 @@ ChromeToMobileBubbleGtk::ChromeToMobileBubbleGtk(GtkImage* anchor_image, GtkWidget* title = NULL; if (mobiles->GetSize() == 1) { string16 name; - DictionaryValue* mobile = NULL; + const DictionaryValue* mobile = NULL; if (mobiles->GetDictionary(0, &mobile) && mobile->GetString("name", &name)) { title = gtk_label_new(l10n_util::GetStringFUTF8( @@ -191,7 +191,7 @@ ChromeToMobileBubbleGtk::ChromeToMobileBubbleGtk(GtkImage* anchor_image, // Create and pack the device radio group; init the selected mobile device. if (mobiles->GetSize() > 1) { std::string name; - DictionaryValue* mobile = NULL; + const DictionaryValue* mobile = NULL; GtkWidget* radio = NULL; GtkWidget* row = NULL; for (size_t index = 0; index < mobiles->GetSize(); ++index) { @@ -321,7 +321,7 @@ void ChromeToMobileBubbleGtk::OnSendClicked(GtkWidget* widget) { DCHECK(radio_buttons_.empty()); } - DictionaryValue* mobile = NULL; + const DictionaryValue* mobile = NULL; if (mobiles->GetDictionary(selected_index, &mobile)) { bool snapshot = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(send_copy_)); service_->SendToMobile(*mobile, snapshot ? snapshot_path_ : FilePath(), diff --git a/chrome/browser/ui/tabs/pinned_tab_codec.cc b/chrome/browser/ui/tabs/pinned_tab_codec.cc index a147a5c..3ff361dc 100644 --- a/chrome/browser/ui/tabs/pinned_tab_codec.cc +++ b/chrome/browser/ui/tabs/pinned_tab_codec.cc @@ -152,7 +152,7 @@ StartupTabs PinnedTabCodec::ReadPinnedTabs(const base::Value* value) { return results; for (size_t i = 0, max = tabs_list->GetSize(); i < max; ++i) { - base::DictionaryValue* tab_values = NULL; + const base::DictionaryValue* tab_values = NULL; if (tabs_list->GetDictionary(i, &tab_values)) { StartupTab tab; if (DecodeTab(*tab_values, &tab)) diff --git a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc index b140c36..f881633 100644 --- a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc +++ b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc @@ -261,7 +261,7 @@ void ChromeToMobileBubbleView::Init() { const ListValue* mobiles = service_->GetMobiles(); if (mobiles->GetSize() == 1) { string16 name; - DictionaryValue* mobile = NULL; + const DictionaryValue* mobile = NULL; if (mobiles->GetDictionary(0, &mobile) && mobile->GetString("name", &name)) { title_label->SetText(l10n_util::GetStringFUTF16( @@ -274,7 +274,7 @@ void ChromeToMobileBubbleView::Init() { IDS_CHROME_TO_MOBILE_BUBBLE_MULTI_TITLE)); string16 name; - DictionaryValue* mobile = NULL; + const DictionaryValue* mobile = NULL; views::RadioButton* radio = NULL; layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); for (size_t index = 0; index < mobiles->GetSize(); ++index) { @@ -366,7 +366,7 @@ void ChromeToMobileBubbleView::Send() { DCHECK(radio_buttons_.empty()); } - DictionaryValue* mobile = NULL; + const DictionaryValue* mobile = NULL; if (mobiles->GetDictionary(selected_index, &mobile)) { FilePath snapshot = send_copy_->checked() ? snapshot_path_ : FilePath(); service_->SendToMobile(*mobile, snapshot, browser_, diff --git a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc index 2efea06..b7bc4a8 100644 --- a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc +++ b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc @@ -293,7 +293,7 @@ class WebUIHandler void ExtractTargetedDevicePath(const ListValue& list_value, int index, FilePath* device_path) { - Value* list_member; + const Value* list_member; if (list_value.Get(index, &list_member) && list_member->GetType() == Value::TYPE_STRING) { const StringValue* string_value = diff --git a/chrome/browser/ui/webui/gpu_internals_ui.cc b/chrome/browser/ui/webui/gpu_internals_ui.cc index e05ffda..c55d267 100644 --- a/chrome/browser/ui/webui/gpu_internals_ui.cc +++ b/chrome/browser/ui/webui/gpu_internals_ui.cc @@ -132,7 +132,7 @@ void GpuMessageHandler::OnCallAsync(const ListValue* args) { DCHECK_GE(args->GetSize(), static_cast<size_t>(2)); // unpack args into requestId, submessage and submessageArgs bool ok; - Value* requestId; + const Value* requestId; ok = args->Get(0, &requestId); DCHECK(ok); @@ -142,7 +142,7 @@ void GpuMessageHandler::OnCallAsync(const ListValue* args) { ListValue* submessageArgs = new ListValue(); for (size_t i = 2; i < args->GetSize(); ++i) { - Value* arg; + const Value* arg; ok = args->Get(i, &arg); DCHECK(ok); diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc index 960374b..c78b275 100644 --- a/chrome/browser/ui/webui/history_ui.cc +++ b/chrome/browser/ui/webui/history_ui.cc @@ -378,7 +378,7 @@ void BrowsingHistoryHandler::ExtractSearchHistoryArguments( int* month, string16* query) { *month = 0; - Value* list_member; + const Value* list_member; // Get search string. if (args->Get(0, &list_member) && diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index c86412f..c6b8286 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -652,7 +652,7 @@ void AppLauncherHandler::HandleReorderApps(const ListValue* args) { CHECK(args->GetSize() == 2); std::string dragged_app_id; - ListValue* app_order; + const ListValue* app_order; CHECK(args->GetString(0, &dragged_app_id)); CHECK(args->GetList(1, &app_order)); diff --git a/chrome/browser/ui/webui/options2/autofill_options_handler.cc b/chrome/browser/ui/webui/options2/autofill_options_handler.cc index f1491a2..414243e 100644 --- a/chrome/browser/ui/webui/options2/autofill_options_handler.cc +++ b/chrome/browser/ui/webui/options2/autofill_options_handler.cc @@ -158,15 +158,14 @@ void GetNameList(const AutofillProfile& profile, } // Set the multi-valued element for |type| from input |list| values. -void SetNameList(const ListValue* names, - AutofillProfile* profile) { +void SetNameList(const ListValue* names, AutofillProfile* profile) { const size_t size = names->GetSize(); std::vector<string16> first_names(size); std::vector<string16> middle_names(size); std::vector<string16> last_names(size); for (size_t i = 0; i < size; ++i) { - ListValue* name; + const ListValue* name; bool success = names->GetList(i, &name); DCHECK(success); @@ -195,7 +194,7 @@ void SetNameList(const ListValue* names, // the |args| input. void ExtractPhoneNumberInformation(const ListValue* args, size_t* index, - ListValue** phone_number_list, + const ListValue** phone_number_list, std::string* country_code) { // Retrieve index as a |double|, as that is how it comes across from // JavaScript. @@ -249,12 +248,15 @@ void RemoveDuplicatePhoneNumberAtIndex(size_t index, list->Remove(index, NULL); } -void ValidatePhoneArguments(const ListValue* args, ListValue** list) { +scoped_ptr<ListValue> ValidatePhoneArguments(const ListValue* args) { size_t index = 0; std::string country_code; - ExtractPhoneNumberInformation(args, &index, list, &country_code); + const ListValue* extracted_list = NULL; + ExtractPhoneNumberInformation(args, &index, &extracted_list, &country_code); - RemoveDuplicatePhoneNumberAtIndex(index, country_code, *list); + scoped_ptr<ListValue> list(extracted_list->DeepCopy()); + RemoveDuplicatePhoneNumberAtIndex(index, country_code, list.get()); + return list.Pass(); } } // namespace @@ -550,7 +552,7 @@ void AutofillOptionsHandler::SetAddress(const ListValue* args) { std::string country_code; string16 value; - ListValue* list_value; + const ListValue* list_value; if (args->GetList(1, &list_value)) SetNameList(list_value, &profile); if (args->GetString(2, &value)) @@ -614,8 +616,7 @@ void AutofillOptionsHandler::ValidatePhoneNumbers(const ListValue* args) { if (!IsPersonalDataLoaded()) return; - ListValue* list_value = NULL; - ValidatePhoneArguments(args, &list_value); + scoped_ptr<ListValue> list_value = ValidatePhoneArguments(args); web_ui()->CallJavascriptFunction( "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); diff --git a/chrome/browser/ui/webui/options2/core_options_handler.cc b/chrome/browser/ui/webui/options2/core_options_handler.cc index f0ddbf9..5a2b5c7 100644 --- a/chrome/browser/ui/webui/options2/core_options_handler.cc +++ b/chrome/browser/ui/webui/options2/core_options_handler.cc @@ -298,7 +298,7 @@ void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) { DCHECK_GE(static_cast<int>(args->GetSize()), 2); // Get callback JS function name. - base::Value* callback; + const base::Value* callback; if (!args->Get(0, &callback) || !callback->IsType(base::Value::TYPE_STRING)) return; @@ -308,7 +308,7 @@ void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) { // Get the list of name for prefs to build the response dictionary. DictionaryValue result_value; - base::Value* list_member; + const base::Value* list_member; for (size_t i = 1; i < args->GetSize(); i++) { if (!args->Get(i, &list_member)) @@ -339,7 +339,7 @@ void CoreOptionsHandler::HandleObservePrefs(const ListValue* args) { // Get all other parameters - pref identifiers. for (size_t i = 1; i < args->GetSize(); i++) { - base::Value* list_member; + const base::Value* list_member; if (!args->Get(i, &list_member)) break; @@ -389,7 +389,7 @@ void CoreOptionsHandler::HandleSetPref(const ListValue* args, PrefType type) { if (!args->GetString(0, &pref_name)) return; - base::Value* value; + const base::Value* value; if (!args->Get(1, &value)) return; diff --git a/chrome/browser/ui/webui/options2/handler_options_handler.cc b/chrome/browser/ui/webui/options2/handler_options_handler.cc index b2177de..c243706 100644 --- a/chrome/browser/ui/webui/options2/handler_options_handler.cc +++ b/chrome/browser/ui/webui/options2/handler_options_handler.cc @@ -131,7 +131,7 @@ void HandlerOptionsHandler::UpdateHandlerList() { } void HandlerOptionsHandler::RemoveHandler(const ListValue* args) { - ListValue* list; + const ListValue* list; if (!args->GetList(0, &list)) { NOTREACHED(); return; @@ -146,7 +146,7 @@ void HandlerOptionsHandler::RemoveHandler(const ListValue* args) { } void HandlerOptionsHandler::RemoveIgnoredHandler(const ListValue* args) { - ListValue* list; + const ListValue* list; if (!args->GetList(0, &list)) { NOTREACHED(); return; @@ -166,7 +166,7 @@ void HandlerOptionsHandler::SetHandlersEnabled(const ListValue* args) { } void HandlerOptionsHandler::ClearDefault(const ListValue* args) { - Value* value; + const Value* value; CHECK(args->Get(0, &value)); std::string protocol_to_clear; CHECK(value->GetAsString(&protocol_to_clear)); @@ -174,9 +174,7 @@ void HandlerOptionsHandler::ClearDefault(const ListValue* args) { } void HandlerOptionsHandler::SetDefault(const ListValue* args) { - Value* value; - CHECK(args->Get(0, &value)); - ListValue* list; + const ListValue* list; CHECK(args->GetList(0, &list)); const ProtocolHandler& handler(ParseHandlerFromArgs(list)); CHECK(!handler.IsEmpty()); diff --git a/chrome/browser/ui/webui/options2/manage_profile_handler.cc b/chrome/browser/ui/webui/options2/manage_profile_handler.cc index 9ff6ccb..0fe67b0 100644 --- a/chrome/browser/ui/webui/options2/manage_profile_handler.cc +++ b/chrome/browser/ui/webui/options2/manage_profile_handler.cc @@ -152,7 +152,7 @@ void ManageProfileHandler::SendProfileNames() { void ManageProfileHandler::SetProfileNameAndIcon(const ListValue* args) { DCHECK(args); - Value* file_path_value; + const Value* file_path_value; FilePath profile_file_path; if (!args->Get(0, &file_path_value) || !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) @@ -239,7 +239,7 @@ void ManageProfileHandler::DeleteProfile(const ListValue* args) { ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::PROFILE_DELETED); - Value* file_path_value; + const Value* file_path_value; FilePath profile_file_path; if (!args->Get(0, &file_path_value) || !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) @@ -253,7 +253,7 @@ void ManageProfileHandler::ProfileIconSelectionChanged( const base::ListValue* args) { DCHECK(args); - Value* file_path_value; + const Value* file_path_value; FilePath file_path; if (!args->Get(0, &file_path_value) || !base::GetValueAsFilePath(*file_path_value, &file_path)) { diff --git a/chrome/browser/ui/webui/options2/startup_pages_handler.cc b/chrome/browser/ui/webui/options2/startup_pages_handler.cc index a9ca56d..43d231b 100644 --- a/chrome/browser/ui/webui/options2/startup_pages_handler.cc +++ b/chrome/browser/ui/webui/options2/startup_pages_handler.cc @@ -204,7 +204,7 @@ void StartupPagesHandler::DragDropStartupPage(const ListValue* args) { CHECK(args->GetString(0, &value)); base::StringToInt(value, &to_index); - ListValue* selected; + const ListValue* selected; CHECK(args->GetList(1, &selected)); std::vector<int> index_list; 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 db933fa..94d84ce 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc @@ -174,7 +174,7 @@ int GetPageCountFromSettingsDictionary(const DictionaryValue& settings) { 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; + const DictionaryValue* dict; if (!page_range_array->GetDictionary(index, &dict)) continue; diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc index d8d0f73..b67bb8f 100644 --- a/chrome/browser/ui/webui/web_ui_browsertest.cc +++ b/chrome/browser/ui/webui/web_ui_browsertest.cc @@ -587,7 +587,7 @@ class WebUIBrowserAsyncTest : public WebUIBrowserTest { // Starts the test in |list_value|[0] with the runAsync wrapper. void HandleStartAsyncTest(const ListValue* list_value) { - Value* test_name; + const Value* test_name; ASSERT_TRUE(list_value->Get(0, &test_name)); web_ui()->CallJavascriptFunction("runAsync", *test_name); } diff --git a/chrome/browser/web_resource/notification_promo.cc b/chrome/browser/web_resource/notification_promo.cc index 9dc8f40..ceb6b72 100644 --- a/chrome/browser/web_resource/notification_promo.cc +++ b/chrome/browser/web_resource/notification_promo.cc @@ -226,12 +226,12 @@ void NotificationPromo::InitFromJson(const DictionaryValue& json) { #endif // !defined(OS_ANDROID) // No support for multiple promos yet. Only consider the first one. - DictionaryValue* promo = NULL; + const DictionaryValue* promo = NULL; if (!promo_list->GetDictionary(0, &promo)) return; // Strings. Assume the first one is the promo text. - DictionaryValue* strings = NULL; + const DictionaryValue* strings = NULL; if (promo->GetDictionary("strings", &strings)) { #if !defined(OS_ANDROID) DictionaryValue::Iterator iter(*strings); @@ -241,9 +241,9 @@ void NotificationPromo::InitFromJson(const DictionaryValue& json) { } // Date. - ListValue* date_list = NULL; + const ListValue* date_list = NULL; if (promo->GetList("date", &date_list)) { - DictionaryValue* date; + const DictionaryValue* date; if (date_list->GetDictionary(0, &date)) { std::string time_str; base::Time time; @@ -263,7 +263,7 @@ void NotificationPromo::InitFromJson(const DictionaryValue& json) { } // Grouping. - DictionaryValue* grouping = NULL; + const DictionaryValue* grouping = NULL; if (promo->GetDictionary("grouping", &grouping)) { grouping->GetInteger("buckets", &num_groups_); grouping->GetInteger("segment", &initial_segment_); @@ -279,7 +279,7 @@ void NotificationPromo::InitFromJson(const DictionaryValue& json) { } // Payload. - DictionaryValue* payload = NULL; + const DictionaryValue* payload = NULL; if (promo->GetDictionary("payload", &payload)) { payload->GetBoolean("gplus_required", &gplus_required_); @@ -317,7 +317,7 @@ void NotificationPromo::InitFromJson(const DictionaryValue& json) { payload->GetString("promo_action_type", &promo_action_type_); // We need to be idempotent as the tests call us more than once. promo_action_args_.reset(new base::ListValue); - ListValue* args; + const ListValue* args; if (payload->GetList("promo_action_args", &args)) { // JSON format for args: "promo_action_args" : [ "<arg1>", "<arg2>"... ] // Every value comes from "strings" dictionary, either directly or not. @@ -415,7 +415,7 @@ void NotificationPromo::InitFromPrefs() { if (!promo_list) return; - base::DictionaryValue* ntp_promo(NULL); + const base::DictionaryValue* ntp_promo(NULL); promo_list->GetDictionary(0, &ntp_promo); if (!ntp_promo) return; @@ -424,7 +424,7 @@ void NotificationPromo::InitFromPrefs() { #if defined(OS_ANDROID) ntp_promo->GetString(kPrefPromoTextLong, &promo_text_long_); ntp_promo->GetString(kPrefPromoActionType, &promo_action_type_); - base::ListValue* lv(NULL); + const base::ListValue* lv(NULL); ntp_promo->GetList(kPrefPromoActionArgs, &lv); DCHECK(lv != NULL); promo_action_args_.reset(lv->DeepCopy()); diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc index 3399bf8..c8e3295 100644 --- a/chrome/common/extensions/api/extension_api.cc +++ b/chrome/common/extensions/api/extension_api.cc @@ -56,7 +56,7 @@ bool HasUnprivilegedChild(const DictionaryValue* name_space_node, if (name_space_node->GetList(child_kind, &child_list)) { for (size_t i = 0; i < child_list->GetSize(); ++i) { - DictionaryValue* item = NULL; + const DictionaryValue* item = NULL; CHECK(child_list->GetDictionary(i, &item)); if (IsUnprivileged(item)) return true; @@ -101,11 +101,11 @@ scoped_ptr<ListValue> LoadSchemaList(const std::string& name, return scoped_ptr<ListValue>(static_cast<ListValue*>(result.release())); } -DictionaryValue* FindListItem(const ListValue* list, - const std::string& property_name, - const std::string& property_value) { +const DictionaryValue* FindListItem(const ListValue* list, + const std::string& property_name, + const std::string& property_value) { for (size_t i = 0; i < list->GetSize(); ++i) { - DictionaryValue* item = NULL; + const DictionaryValue* item = NULL; CHECK(list->GetDictionary(i, &item)) << property_value << "/" << property_name; std::string value; @@ -118,7 +118,7 @@ DictionaryValue* FindListItem(const ListValue* list, const DictionaryValue* GetSchemaChild(const DictionaryValue* schema_node, const std::string& child_name) { - DictionaryValue* child_node = NULL; + const DictionaryValue* child_node = NULL; for (size_t i = 0; i < arraysize(kChildKinds); ++i) { const ListValue* list_node = NULL; if (!schema_node->GetList(kChildKinds[i], &list_node)) diff --git a/chrome/common/extensions/api/extension_api_unittest.cc b/chrome/common/extensions/api/extension_api_unittest.cc index d906c87..0082e96 100644 --- a/chrome/common/extensions/api/extension_api_unittest.cc +++ b/chrome/common/extensions/api/extension_api_unittest.cc @@ -419,7 +419,7 @@ TEST(ExtensionAPI, FeaturesRequireContexts) { static void GetDictionaryFromList(const DictionaryValue* schema, const std::string& list_name, const int list_index, - DictionaryValue** out) { + const DictionaryValue** out) { const ListValue* list; EXPECT_TRUE(schema->GetList(list_name, &list)); EXPECT_TRUE(list->GetDictionary(list_index, out)); @@ -442,8 +442,8 @@ TEST(ExtensionAPI, TypesHaveNamespace) { const DictionaryValue* schema = api.GetSchema("test.foo"); - DictionaryValue* dict; - DictionaryValue* sub_dict; + const DictionaryValue* dict; + const DictionaryValue* sub_dict; std::string type; GetDictionaryFromList(schema, "types", 0, &dict); @@ -452,7 +452,7 @@ TEST(ExtensionAPI, TypesHaveNamespace) { EXPECT_TRUE(dict->GetString("customBindings", &type)); EXPECT_EQ("test.foo.TestType", type); EXPECT_TRUE(dict->GetDictionary("properties", &sub_dict)); - DictionaryValue* property; + const DictionaryValue* property; EXPECT_TRUE(sub_dict->GetDictionary("foo", &property)); EXPECT_TRUE(property->GetString("$ref", &type)); EXPECT_EQ("test.foo.OtherType", type); diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 6e1f8df..7852314 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -728,7 +728,7 @@ bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, if (js) { for (size_t script_index = 0; script_index < js->GetSize(); ++script_index) { - Value* value; + const Value* value; std::string relative; if (!js->Get(script_index, &value) || !value->GetAsString(&relative)) { *error = ExtensionErrorUtils::FormatErrorMessageUTF16( @@ -747,7 +747,7 @@ bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, if (css) { for (size_t script_index = 0; script_index < css->GetSize(); ++script_index) { - Value* value; + const Value* value; std::string relative; if (!css->Get(script_index, &value) || !value->GetAsString(&relative)) { *error = ExtensionErrorUtils::FormatErrorMessageUTF16( diff --git a/chrome/common/net/gaia/oauth2_mint_token_flow.cc b/chrome/common/net/gaia/oauth2_mint_token_flow.cc index 285cd2b..afee277 100644 --- a/chrome/common/net/gaia/oauth2_mint_token_flow.cc +++ b/chrome/common/net/gaia/oauth2_mint_token_flow.cc @@ -237,7 +237,7 @@ bool OAuth2MintTokenFlow::ParseIssueAdviceResponse( bool success = true; for (size_t index = 0; index < scopes_list->GetSize(); ++index) { - base::DictionaryValue* scopes_entry = NULL; + const base::DictionaryValue* scopes_entry = NULL; IssueAdviceInfoEntry entry; string16 detail; if (!scopes_list->GetDictionary(index, &scopes_entry) || diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 24592c6..21c05b1 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -43,7 +43,7 @@ std::vector<GURL> GetNamedList(const char* name, if (!prefs->GetList(name, &value_list)) return list; for (size_t i = 0; i < value_list->GetSize(); ++i) { - Value* entry; + const Value* entry; GURL gurl_entry; if (!value_list->Get(i, &entry) || !GetGURLFromValue(entry, &gurl_entry)) { NOTREACHED(); diff --git a/chrome/renderer/chrome_mock_render_thread.cc b/chrome/renderer/chrome_mock_render_thread.cc index fc5a6eb..b946dd6 100644 --- a/chrome/renderer/chrome_mock_render_thread.cc +++ b/chrome/renderer/chrome_mock_render_thread.cc @@ -167,7 +167,7 @@ void ChromeMockRenderThread::OnUpdatePrintSettings( printing::PageRanges new_ranges; if (job_settings.GetList(printing::kSettingPageRange, &page_range_array)) { for (size_t index = 0; index < page_range_array->GetSize(); ++index) { - base::DictionaryValue* dict; + const base::DictionaryValue* dict; if (!page_range_array->GetDictionary(index, &dict)) continue; printing::PageRange range; diff --git a/chrome/renderer/extensions/chrome_v8_context_set.cc b/chrome/renderer/extensions/chrome_v8_context_set.cc index 808e464..76ed870 100644 --- a/chrome/renderer/extensions/chrome_v8_context_set.cc +++ b/chrome/renderer/extensions/chrome_v8_context_set.cc @@ -137,7 +137,7 @@ void ChromeV8ContextSet::DispatchChromeHiddenMethod( v8::Local<v8::Context> context(*((*it)->v8_context())); std::vector<v8::Handle<v8::Value> > v8_arguments; for (size_t i = 0; i < arguments.GetSize(); ++i) { - base::Value* item = NULL; + const base::Value* item = NULL; CHECK(arguments.Get(i, &item)); v8_arguments.push_back(converter->ToV8Value(item, context)); } diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index dcdbbaf..0fdcb4d 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc @@ -1764,17 +1764,17 @@ void RenderViewHostImpl::OnAccessibilityNotifications( } void RenderViewHostImpl::OnScriptEvalResponse(int id, const ListValue& result) { - Value* result_value; + const Value* result_value; if (!result.Get(0, &result_value)) { // Programming error or rogue renderer. NOTREACHED() << "Got bad arguments for OnScriptEvalResponse"; return; } - std::pair<int, Value*> details(id, result_value); + std::pair<int, const Value*> details(id, result_value); content::NotificationService::current()->Notify( content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, content::Source<RenderViewHost>(this), - content::Details<std::pair<int, Value*> >(&details)); + content::Details<std::pair<int, const Value*> >(&details)); } void RenderViewHostImpl::OnDidZoomURL(double zoom_level, diff --git a/content/browser/speech/google_one_shot_remote_engine.cc b/content/browser/speech/google_one_shot_remote_engine.cc index d56986b..3c2e292 100644 --- a/content/browser/speech/google_one_shot_remote_engine.cc +++ b/content/browser/speech/google_one_shot_remote_engine.cc @@ -110,7 +110,7 @@ bool ParseServerResponse(const std::string& response_body, // final result, consisting of one fragment (with one or more hypotheses). size_t index = 0; for (; index < hypotheses_list->GetSize(); ++index) { - Value* hypothesis = NULL; + const Value* hypothesis = NULL; if (!hypotheses_list->Get(index, &hypothesis)) { LOG(WARNING) << "ParseServerResponse: Unable to read hypothesis value."; break; @@ -123,7 +123,7 @@ bool ParseServerResponse(const std::string& response_body, } const DictionaryValue* hypothesis_value = - static_cast<DictionaryValue*>(hypothesis); + static_cast<const DictionaryValue*>(hypothesis); string16 utterance; if (!hypothesis_value->GetString(kUtteranceString, &utterance)) { diff --git a/content/renderer/v8_value_converter_impl.cc b/content/renderer/v8_value_converter_impl.cc index dc76394d..f1cda82 100644 --- a/content/renderer/v8_value_converter_impl.cc +++ b/content/renderer/v8_value_converter_impl.cc @@ -132,7 +132,7 @@ v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Array( v8::Handle<v8::Array> result(v8::Array::New(val->GetSize())); for (size_t i = 0; i < val->GetSize(); ++i) { - Value* child = NULL; + const Value* child = NULL; CHECK(val->Get(i, &child)); v8::Handle<v8::Value> child_v8 = ToV8ValueImpl(child); diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc index da9b48b..3ce9be5 100644 --- a/ipc/ipc_message_utils.cc +++ b/ipc/ipc_message_utils.cc @@ -117,7 +117,7 @@ void WriteValue(Message* m, const Value* value, int recursion) { const ListValue* list = static_cast<const ListValue*>(value); WriteParam(m, static_cast<int>(list->GetSize())); for (size_t i = 0; i < list->GetSize(); ++i) { - Value* subval; + const Value* subval; if (list->Get(i, &subval)) { WriteValue(m, subval, recursion + 1); } else { diff --git a/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc b/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc index 5bf74cb..d3454ead 100644 --- a/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc +++ b/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc @@ -30,7 +30,7 @@ void PPB_X509Certificate_Fields::SetField( PP_Var PPB_X509Certificate_Fields::GetFieldAsPPVar( PP_X509Certificate_Private_Field field) const { uint32_t index = static_cast<uint32_t>(field); - base::Value* value; + const base::Value* value; bool success = values_.Get(index, &value); if (!success) { // Our list received might be smaller than the number of fields, so just diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc index 950e280..93da8de 100644 --- a/sync/internal_api/sync_manager_impl.cc +++ b/sync/internal_api/sync_manager_impl.cc @@ -1683,7 +1683,7 @@ JsArgList GetNodeInfoById(const JsArgList& args, ListValue return_args; ListValue* node_summaries = new ListValue(); return_args.Append(node_summaries); - ListValue* id_list = NULL; + const ListValue* id_list = NULL; ReadTransaction trans(FROM_HERE, user_share); if (args.Get().GetList(0, &id_list)) { CHECK(id_list); diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc index 6cf652e..0e6b464 100644 --- a/sync/internal_api/sync_manager_impl_unittest.cc +++ b/sync/internal_api/sync_manager_impl_unittest.cc @@ -1000,7 +1000,7 @@ TEST_F(SyncManagerTest, ProcessJsMessageGetRootNodeDetails) { SendJsMessage("getRootNodeDetails", kNoArgs, reply_handler.AsWeakHandle()); EXPECT_EQ(1u, return_args.Get().GetSize()); - DictionaryValue* node_info = NULL; + const DictionaryValue* node_info = NULL; EXPECT_TRUE(return_args.Get().GetDictionary(0, &node_info)); if (node_info) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); @@ -1017,11 +1017,11 @@ void CheckGetNodesByIdReturnArgs(SyncManager* sync_manager, int64 id, bool is_detailed) { EXPECT_EQ(1u, return_args.Get().GetSize()); - ListValue* nodes = NULL; + const ListValue* nodes = NULL; ASSERT_TRUE(return_args.Get().GetList(0, &nodes)); ASSERT_TRUE(nodes); EXPECT_EQ(1u, nodes->GetSize()); - DictionaryValue* node_info = NULL; + const DictionaryValue* node_info = NULL; EXPECT_TRUE(nodes->GetDictionary(0, &node_info)); ASSERT_TRUE(node_info); ReadTransaction trans(FROM_HERE, sync_manager->GetUserShare()); @@ -1164,7 +1164,7 @@ TEST_F(SyncManagerTest, GetChildNodeIds) { } EXPECT_EQ(1u, return_args.Get().GetSize()); - ListValue* nodes = NULL; + const ListValue* nodes = NULL; ASSERT_TRUE(return_args.Get().GetList(0, &nodes)); ASSERT_TRUE(nodes); EXPECT_EQ(6u, nodes->GetSize()); @@ -1238,8 +1238,8 @@ TEST_F(SyncManagerTest, GetAllNodesTest) { // would make this test brittle without greatly increasing our chances of // catching real bugs. - ListValue* node_list; - DictionaryValue* first_result; + const ListValue* node_list; + const DictionaryValue* first_result; // The resulting argument list should have one argument, a list of nodes. ASSERT_EQ(1U, return_args.Get().GetSize()); diff --git a/sync/protocol/proto_value_conversions_unittest.cc b/sync/protocol/proto_value_conversions_unittest.cc index 89a99e3..fd36450 100644 --- a/sync/protocol/proto_value_conversions_unittest.cc +++ b/sync/protocol/proto_value_conversions_unittest.cc @@ -193,8 +193,8 @@ namespace { bool ValueHasSpecifics(const DictionaryValue& value, const std::string& path) { const ListValue* entities_list = NULL; - DictionaryValue* entry_dictionary = NULL; - DictionaryValue* specifics_dictionary = NULL; + const DictionaryValue* entry_dictionary = NULL; + const DictionaryValue* specifics_dictionary = NULL; if (!value.GetList(path, &entities_list)) return false; diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py index 6875187..d09d325 100644 --- a/tools/json_schema_compiler/cc_generator.py +++ b/tools/json_schema_compiler/cc_generator.py @@ -420,7 +420,7 @@ class CCGenerator(object): failure_value = 'scoped_ptr<Params>()' c.Append() value_var = param.unix_name + '_value' - (c.Append('base::Value* %(value_var)s = NULL;') + (c.Append('const base::Value* %(value_var)s = NULL;') .Append('if (args.Get(%(i)s, &%(value_var)s) &&\n' ' !%(value_var)s->IsType(base::Value::TYPE_NULL))') .Sblock('{') diff --git a/tools/json_schema_compiler/util.cc b/tools/json_schema_compiler/util.cc index 9d8abd5..ca5c25a 100644 --- a/tools/json_schema_compiler/util.cc +++ b/tools/json_schema_compiler/util.cc @@ -28,7 +28,7 @@ bool GetItemFromList(const ListValue& from, int index, std::string* out) { bool GetItemFromList(const ListValue& from, int index, linked_ptr<any::Any>* out) { - Value* value = NULL; + const Value* value = NULL; if (!from.Get(index, &value)) return false; scoped_ptr<any::Any> any_object(new any::Any()); @@ -39,7 +39,7 @@ bool GetItemFromList(const ListValue& from, int index, bool GetItemFromList(const ListValue& from, int index, linked_ptr<base::DictionaryValue>* out) { - DictionaryValue* dict = NULL; + const DictionaryValue* dict = NULL; if (!from.GetDictionary(index, &dict)) return false; *out = linked_ptr<DictionaryValue>(dict->DeepCopy()); diff --git a/tools/json_schema_compiler/util.h b/tools/json_schema_compiler/util.h index 61148c6..509b0dc 100644 --- a/tools/json_schema_compiler/util.h +++ b/tools/json_schema_compiler/util.h @@ -34,7 +34,7 @@ bool GetItemFromList(const ListValue& from, int index, // This template is used for types generated by tools/json_schema_compiler. template<class T> bool GetItemFromList(const ListValue& from, int index, linked_ptr<T>* out) { - DictionaryValue* dict; + const DictionaryValue* dict; if (!from.GetDictionary(index, &dict)) return false; scoped_ptr<T> obj(new T()); |