Skip to content

Commit

Permalink
Add base namespace to more values in sync and elsewhere.
Browse files Browse the repository at this point in the history
This makes sync and net compile with no "using *Value".

BUG=

Review URL: https://codereview.chromium.org/17034006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207907 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
brettw@chromium.org committed Jun 21, 2013
1 parent ae0c0f6 commit 0c6c1e4
Show file tree
Hide file tree
Showing 78 changed files with 260 additions and 244 deletions.
2 changes: 1 addition & 1 deletion cc/base/math_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ scoped_ptr<base::Value> MathUtil::AsValue(gfx::Rect r) {
}

bool MathUtil::FromValue(const base::Value* raw_value, gfx::Rect* out_rect) {
const ListValue* value = NULL;
const base::ListValue* value = NULL;
if (!raw_value->GetAsList(&value))
return false;

Expand Down
2 changes: 1 addition & 1 deletion cc/resources/picture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ void Picture::Raster(
"num_pixels_rasterized", bounds.width() * bounds.height());
}

scoped_ptr<Value> Picture::AsValue() const {
scoped_ptr<base::Value> Picture::AsValue() const {
SkDynamicMemoryWStream stream;

// Serialize the picture.
Expand Down
2 changes: 1 addition & 1 deletion cc/resources/tile_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class CC_EXPORT TileManager : public RasterWorkerPoolClient {
void DidTileTreeBinChange(Tile* tile,
TileManagerBin new_tree_bin,
WhichTree tree);
scoped_ptr<Value> GetMemoryRequirementsAsValue() const;
scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const;
void AddRequiredTileForActivation(Tile* tile);

TileManagerClient* client_;
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/policy/policy_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PolicyMap {
struct Entry {
PolicyLevel level;
PolicyScope scope;
Value* value;
base::Value* value;

Entry()
: level(POLICY_LEVEL_RECOMMENDED),
Expand All @@ -50,14 +50,14 @@ class PolicyMap {
// Returns a weak reference to the value currently stored for key |policy|,
// or NULL if not found. Ownership is retained by the PolicyMap.
// This is equivalent to Get(policy)->value, when it doesn't return NULL.
const Value* GetValue(const std::string& policy) const;
const base::Value* GetValue(const std::string& policy) const;

// Takes ownership of |value|. Overwrites any existing value stored in the
// map for the key |policy|.
void Set(const std::string& policy,
PolicyLevel level,
PolicyScope scope,
Value* value);
base::Value* value);

// Erase the given |policy|, if it exists in this map.
void Erase(const std::string& policy);
Expand All @@ -80,7 +80,7 @@ class PolicyMap {
// Loads the values in |policies| into this PolicyMap. All policies loaded
// will have |level| and |scope| in their entries. Existing entries are
// replaced.
void LoadFrom(const DictionaryValue* policies,
void LoadFrom(const base::DictionaryValue* policies,
PolicyLevel level,
PolicyScope scope);

Expand Down
24 changes: 13 additions & 11 deletions chrome/installer/util/master_preferences.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ const char kFirstRunTabs[] = "first_run_tabs";
base::LazyInstance<installer::MasterPreferences> g_master_preferences =
LAZY_INSTANCE_INITIALIZER;

bool GetURLFromValue(const Value* in_value, std::string* out_value) {
bool GetURLFromValue(const base::Value* in_value, std::string* out_value) {
return in_value && out_value && in_value->GetAsString(out_value);
}

std::vector<std::string> GetNamedList(const char* name,
const DictionaryValue* prefs) {
const base::DictionaryValue* prefs) {
std::vector<std::string> list;
if (!prefs)
return list;

const ListValue* value_list = NULL;
const base::ListValue* value_list = NULL;
if (!prefs->GetList(name, &value_list))
return list;

list.reserve(value_list->GetSize());
for (size_t i = 0; i < value_list->GetSize(); ++i) {
const Value* entry;
const base::Value* entry;
std::string url_entry;
if (!value_list->Get(i, &entry) || !GetURLFromValue(entry, &url_entry)) {
NOTREACHED();
Expand All @@ -50,20 +50,21 @@ std::vector<std::string> GetNamedList(const char* name,
return list;
}

DictionaryValue* ParseDistributionPreferences(const std::string& json_data) {
base::DictionaryValue* ParseDistributionPreferences(
const std::string& json_data) {
JSONStringValueSerializer json(json_data);
std::string error;
scoped_ptr<Value> root(json.Deserialize(NULL, &error));
scoped_ptr<base::Value> root(json.Deserialize(NULL, &error));
if (!root.get()) {
LOG(WARNING) << "Failed to parse master prefs file: " << error;
return NULL;
}
if (!root->IsType(Value::TYPE_DICTIONARY)) {
if (!root->IsType(base::Value::TYPE_DICTIONARY)) {
LOG(WARNING) << "Failed to parse master prefs file: "
<< "Root item must be a dictionary.";
return NULL;
}
return static_cast<DictionaryValue*>(root.release());
return static_cast<base::DictionaryValue*>(root.release());
}

} // namespace
Expand Down Expand Up @@ -128,7 +129,7 @@ void MasterPreferences::InitializeFromCommandLine(const CommandLine& cmd_line) {
installer::switches::kInstallerData));
this->MasterPreferences::MasterPreferences(prefs_path);
} else {
master_dictionary_.reset(new DictionaryValue());
master_dictionary_.reset(new base::DictionaryValue());
}

DCHECK(master_dictionary_.get());
Expand Down Expand Up @@ -216,7 +217,7 @@ bool MasterPreferences::InitializeFromString(const std::string& json_data) {

bool data_is_valid = true;
if (!master_dictionary_.get()) {
master_dictionary_.reset(new DictionaryValue());
master_dictionary_.reset(new base::DictionaryValue());
data_is_valid = false;
} else {
// Cache a pointer to the distribution dictionary.
Expand Down Expand Up @@ -305,7 +306,8 @@ std::vector<std::string> MasterPreferences::GetFirstRunTabs() const {
return GetNamedList(kFirstRunTabs, master_dictionary_.get());
}

bool MasterPreferences::GetExtensionsBlock(DictionaryValue** extensions) const {
bool MasterPreferences::GetExtensionsBlock(
base::DictionaryValue** extensions) const {
return master_dictionary_->GetDictionary(
master_preferences::kExtensionsBlock, extensions);
}
Expand Down
20 changes: 10 additions & 10 deletions chrome/tools/build/generate_policy_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def _WritePolicyConstantSource(policies, os, f):
f.write('const PolicyDefinitionList::Entry kEntries[] = {\n')
for policy in policies:
if policy.is_supported:
f.write(' { key::k%s, Value::%s, %s, %s },\n' %
f.write(' { key::k%s, base::Value::%s, %s, %s },\n' %
(policy.name, policy.value_type,
'true' if policy.is_device_only else 'false', policy.id))
f.write('};\n\n')
Expand Down Expand Up @@ -424,23 +424,23 @@ def _WriteCloudPolicyProtobuf(policies, os, f):
namespace em = enterprise_management;
Value* DecodeIntegerValue(google::protobuf::int64 value) {
base::Value* DecodeIntegerValue(google::protobuf::int64 value) {
if (value < std::numeric_limits<int>::min() ||
value > std::numeric_limits<int>::max()) {
LOG(WARNING) << "Integer value " << value
<< " out of numeric limits, ignoring.";
return NULL;
}
return Value::CreateIntegerValue(static_cast<int>(value));
return base::Value::CreateIntegerValue(static_cast<int>(value));
}
ListValue* DecodeStringList(const em::StringList& string_list) {
ListValue* list_value = new ListValue;
base::ListValue* DecodeStringList(const em::StringList& string_list) {
base::ListValue* list_value = new base::ListValue;
RepeatedPtrField<std::string>::const_iterator entry;
for (entry = string_list.entries().begin();
entry != string_list.entries().end(); ++entry) {
list_value->Append(Value::CreateStringValue(*entry));
list_value->Append(base::Value::CreateStringValue(*entry));
}
return list_value;
}
Expand All @@ -457,16 +457,16 @@ def _WriteCloudPolicyProtobuf(policies, os, f):

def _CreateValue(type, arg):
if type == 'TYPE_BOOLEAN':
return 'Value::CreateBooleanValue(%s)' % arg
return 'base::Value::CreateBooleanValue(%s)' % arg
elif type == 'TYPE_INTEGER':
return 'DecodeIntegerValue(%s)' % arg
elif type == 'TYPE_STRING':
return 'Value::CreateStringValue(%s)' % arg
return 'base::Value::CreateStringValue(%s)' % arg
elif type == 'TYPE_LIST':
return 'DecodeStringList(%s)' % arg
elif type == 'TYPE_DICTIONARY':
# TODO(joaodasilva): decode 'dict' types. http://crbug.com/108997
return 'new DictionaryValue()'
return 'new base::DictionaryValue()'
else:
raise NotImplementedError('Unknown type %s' % type)

Expand Down Expand Up @@ -496,7 +496,7 @@ def _WritePolicyCode(f, policy):
' }\n'
' }\n'
' if (do_set) {\n')
f.write(' Value* value = %s;\n' %
f.write(' base::Value* value = %s;\n' %
(_CreateValue(policy.value_type, 'policy_proto.value()')))
f.write(' map->Set(key::k%s, level, POLICY_SCOPE_USER, value);\n' %
policy.name)
Expand Down
2 changes: 1 addition & 1 deletion chromeos/dbus/shill_ipconfig_client_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void ShillIPConfigClientStub::SetProperty(
dict->SetWithoutPathExpansion(name, value.DeepCopy());
} else {
// Create a new stub ipconfig object, and update its properties.
DictionaryValue* dvalue = new DictionaryValue;
base::DictionaryValue* dvalue = new base::DictionaryValue;
dvalue->SetWithoutPathExpansion(name, value.DeepCopy());
ipconfigs_.SetWithoutPathExpansion(ipconfig_path.value(),
dvalue);
Expand Down
6 changes: 3 additions & 3 deletions chromeos/dbus/shill_manager_client_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ namespace {
// Used to compare values for finding entries to erase in a ListValue.
// (ListValue only implements a const_iterator version of Find).
struct ValueEquals {
explicit ValueEquals(const Value* first) : first_(first) {}
bool operator()(const Value* second) const {
explicit ValueEquals(const base::Value* first) : first_(first) {}
bool operator()(const base::Value* second) const {
return first_->Equals(second);
}
const Value* first_;
const base::Value* first_;
};

} // namespace
Expand Down
2 changes: 1 addition & 1 deletion chromeos/network/certificate_pattern.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ base::ListValue* CreateListFromStrings(
base::ListValue* new_list = new base::ListValue;
for (std::vector<std::string>::const_iterator iter = strings.begin();
iter != strings.end(); ++iter) {
new_list->Append(new StringValue(*iter));
new_list->Append(new base::StringValue(*iter));
}
return new_list;
}
Expand Down
4 changes: 2 additions & 2 deletions chromeos/network/cros_network_functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void ListIPConfigsCallback(const NetworkGetIPConfigsCallback& callback,
const base::DictionaryValue& properties) {
NetworkIPConfigVector ipconfig_vector;
std::string hardware_address;
const ListValue* ips = NULL;
const base::ListValue* ips = NULL;
if (call_status != DBUS_METHOD_CALL_SUCCESS ||
!properties.GetListWithoutPathExpansion(flimflam::kIPConfigsProperty,
&ips)) {
Expand Down Expand Up @@ -627,7 +627,7 @@ bool CrosListIPConfigsAndBlock(const std::string& device_path,
if (!properties.get())
return false;

ListValue* ips = NULL;
base::ListValue* ips = NULL;
if (!properties->GetListWithoutPathExpansion(
flimflam::kIPConfigsProperty, &ips))
return false;
Expand Down
4 changes: 2 additions & 2 deletions chromeos/network/device_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bool DeviceState::PropertyChanged(const std::string& key,
} else if (key == shill::kProviderRequiresRoamingProperty) {
return GetBooleanValue(key, value, &provider_requires_roaming_);
} else if (key == flimflam::kHomeProviderProperty) {
const DictionaryValue* dict = NULL;
const base::DictionaryValue* dict = NULL;
if (!value.GetAsDictionary(&dict))
return false;
std::string home_provider_country;
Expand All @@ -60,7 +60,7 @@ bool DeviceState::PropertyChanged(const std::string& key,
} else if (key == flimflam::kTechnologyFamilyProperty) {
return GetStringValue(key, value, &technology_family_);
} else if (key == flimflam::kSIMLockStatusProperty) {
const DictionaryValue* dict = NULL;
const base::DictionaryValue* dict = NULL;
if (!value.GetAsDictionary(&dict))
return false;
if (!dict->GetStringWithoutPathExpansion(flimflam::kSIMLockTypeProperty,
Expand Down
2 changes: 1 addition & 1 deletion chromeos/network/network_connection_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool NetworkRequiresActivation(const NetworkState* network) {

bool VPNIsConfigured(const std::string& service_path,
const base::DictionaryValue& service_properties) {
const DictionaryValue* properties;
const base::DictionaryValue* properties;
if (!service_properties.GetDictionary(flimflam::kProviderProperty,
&properties)) {
NET_LOG_ERROR("VPN Provider Dictionary not present", service_path);
Expand Down
4 changes: 2 additions & 2 deletions chromeos/network/network_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ void NetworkState::GetProperties(base::DictionaryValue* dictionary) const {
error_);
dictionary->SetStringWithoutPathExpansion(shill::kErrorDetailsProperty,
error_details_);
base::DictionaryValue* ipconfig_properties = new DictionaryValue;
base::DictionaryValue* ipconfig_properties = new base::DictionaryValue;
ipconfig_properties->SetStringWithoutPathExpansion(flimflam::kAddressProperty,
ip_address_);
base::ListValue* name_servers = new ListValue;
base::ListValue* name_servers = new base::ListValue;
name_servers->AppendStrings(dns_servers_);
ipconfig_properties->SetWithoutPathExpansion(flimflam::kNameServersProperty,
name_servers);
Expand Down
6 changes: 3 additions & 3 deletions chromeos/network/network_ui_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ NetworkUIData& NetworkUIData::operator=(const NetworkUIData& other) {
return *this;
}

NetworkUIData::NetworkUIData(const DictionaryValue& dict) {
NetworkUIData::NetworkUIData(const base::DictionaryValue& dict) {
std::string source;
dict.GetString(kKeyONCSource, &source);
onc_source_ = StringToEnum(kONCSourceTable, source, onc::ONC_SOURCE_NONE);
Expand All @@ -94,7 +94,7 @@ NetworkUIData::NetworkUIData(const DictionaryValue& dict) {
StringToEnum(kClientCertTable, type_string, CLIENT_CERT_TYPE_NONE);

if (certificate_type_ == CLIENT_CERT_TYPE_PATTERN) {
const DictionaryValue* cert_dict = NULL;
const base::DictionaryValue* cert_dict = NULL;
dict.GetDictionary(kKeyCertificatePattern, &cert_dict);
if (cert_dict)
certificate_pattern_.CopyFromDictionary(*cert_dict);
Expand All @@ -104,7 +104,7 @@ NetworkUIData::NetworkUIData(const DictionaryValue& dict) {
}
}

const DictionaryValue* user_settings = NULL;
const base::DictionaryValue* user_settings = NULL;
if (dict.GetDictionary(kKeyUserSettings, &user_settings))
user_settings_.reset(user_settings->DeepCopy());
}
Expand Down
4 changes: 2 additions & 2 deletions chromeos/network/onc/onc_merger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ typedef scoped_ptr<base::DictionaryValue> DictionaryPtr;
// |policy|.
void MarkRecommendedFieldnames(const base::DictionaryValue& policy,
base::DictionaryValue* result) {
const ListValue* recommended_value = NULL;
const base::ListValue* recommended_value = NULL;
if (!policy.GetListWithoutPathExpansion(kRecommended, &recommended_value))
return;
for (ListValue::const_iterator it = recommended_value->begin();
for (base::ListValue::const_iterator it = recommended_value->begin();
it != recommended_value->end(); ++it) {
std::string entry;
if ((*it)->GetAsString(&entry))
Expand Down
2 changes: 1 addition & 1 deletion chromeos/network/onc/onc_validator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ std::string ValueToString(const base::Value& value) {

// Copied from policy/configuration_policy_handler.cc.
// TODO(pneubeck): move to a common place like base/.
std::string ValueTypeToString(Value::Type type) {
std::string ValueTypeToString(base::Value::Type type) {
static const char* strings[] = {
"null",
"boolean",
Expand Down
2 changes: 1 addition & 1 deletion chromeos/network/shill_property_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ bool ShillPropertyHandler::ManagerPropertyChanged(const std::string& key,
UpdateObserved(ManagedState::MANAGED_TYPE_NETWORK, *vlist);
}
} else if (key == flimflam::kDevicesProperty) {
const ListValue* vlist = GetListValue(key, value);
const base::ListValue* vlist = GetListValue(key, value);
if (vlist) {
listener_->UpdateManagedList(ManagedState::MANAGED_TYPE_DEVICE, *vlist);
UpdateObserved(ManagedState::MANAGED_TYPE_DEVICE, *vlist);
Expand Down
5 changes: 3 additions & 2 deletions google_apis/gaia/gaia_auth_fetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static bool CookiePartsContains(const std::vector<std::string>& parts,
return std::find(parts.begin(), parts.end(), part) != parts.end();
}

bool ExtractOAuth2TokenPairResponse(DictionaryValue* dict,
bool ExtractOAuth2TokenPairResponse(base::DictionaryValue* dict,
std::string* refresh_token,
std::string* access_token,
int* expires_in_secs) {
Expand Down Expand Up @@ -820,7 +820,8 @@ void GaiaAuthFetcher::OnOAuth2TokenPairFetched(
if (status.is_success() && response_code == net::HTTP_OK) {
scoped_ptr<base::Value> value(base::JSONReader::Read(data));
if (value.get() && value->GetType() == base::Value::TYPE_DICTIONARY) {
DictionaryValue* dict = static_cast<DictionaryValue*>(value.get());
base::DictionaryValue* dict =
static_cast<base::DictionaryValue*>(value.get());
success = ExtractOAuth2TokenPairResponse(dict, &refresh_token,
&access_token, &expires_in_secs);
}
Expand Down
8 changes: 4 additions & 4 deletions google_apis/gaia/gaia_oauth_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ void GaiaOAuthClient::Core::HandleResponse(
return;
}

scoped_ptr<DictionaryValue> response_dict;
scoped_ptr<base::DictionaryValue> response_dict;
if (source->GetResponseCode() == net::HTTP_OK) {
std::string data;
source->GetResponseAsString(&data);
scoped_ptr<Value> message_value(base::JSONReader::Read(data));
scoped_ptr<base::Value> message_value(base::JSONReader::Read(data));
if (message_value.get() &&
message_value->IsType(Value::TYPE_DICTIONARY)) {
message_value->IsType(base::Value::TYPE_DICTIONARY)) {
response_dict.reset(
static_cast<DictionaryValue*>(message_value.release()));
static_cast<base::DictionaryValue*>(message_value.release()));
}
}

Expand Down
Loading

0 comments on commit 0c6c1e4

Please sign in to comment.