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

Unified Diff: chrome/browser/extensions/api/socket/socket_api.cc

Issue 22885002: c/b/extensions, json_schema_compiler: Do not use Value::Create*. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed C-style casts. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/socket/socket_api.cc
diff --git a/chrome/browser/extensions/api/socket/socket_api.cc b/chrome/browser/extensions/api/socket/socket_api.cc
index 6a43ce7095d7a44204d36a9d375bdbf2b46e30ca..83f1e4ed51a888aaecb1f5067ed0409367e5b740 100644
--- a/chrome/browser/extensions/api/socket/socket_api.cc
+++ b/chrome/browser/extensions/api/socket/socket_api.cc
@@ -186,7 +186,7 @@ void SocketConnectFunction::AsyncWorkStart() {
socket_ = GetSocket(socket_id_);
if (!socket_) {
error_ = kSocketNotFoundError;
- SetResult(Value::CreateIntegerValue(-1));
+ SetResult(new base::FundamentalValue(-1));
AsyncWorkCompleted();
return;
}
@@ -209,7 +209,7 @@ void SocketConnectFunction::AsyncWorkStart() {
if (!PermissionsData::CheckAPIPermissionWithParam(
GetExtension(), APIPermission::kSocket, &param)) {
error_ = kPermissionError;
- SetResult(Value::CreateIntegerValue(-1));
+ SetResult(new base::FundamentalValue(-1));
AsyncWorkCompleted();
return;
}
@@ -221,7 +221,7 @@ void SocketConnectFunction::AfterDnsLookup(int lookup_result) {
if (lookup_result == net::OK) {
StartConnect();
} else {
- SetResult(Value::CreateIntegerValue(lookup_result));
+ SetResult(new base::FundamentalValue(lookup_result));
AsyncWorkCompleted();
}
}
@@ -232,7 +232,7 @@ void SocketConnectFunction::StartConnect() {
}
void SocketConnectFunction::OnConnect(int result) {
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
AsyncWorkCompleted();
}
@@ -263,7 +263,7 @@ void SocketBindFunction::Work() {
if (!socket) {
error_ = kSocketNotFoundError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
@@ -275,17 +275,17 @@ void SocketBindFunction::Work() {
APIPermission::kSocket,
&param)) {
error_ = kPermissionError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
} else if (socket->GetSocketType() == Socket::TYPE_TCP) {
error_ = kTCPSocketBindError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
result = socket->Bind(address_, port_);
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
}
SocketListenFunction::SocketListenFunction() {}
@@ -310,7 +310,7 @@ void SocketListenFunction::Work() {
APIPermission::kSocket,
&param)) {
error_ = kPermissionError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
@@ -323,7 +323,7 @@ void SocketListenFunction::Work() {
error_ = kSocketNotFoundError;
}
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
}
SocketAcceptFunction::SocketAcceptFunction() {}
@@ -504,7 +504,7 @@ void SocketSendToFunction::AsyncWorkStart() {
socket_ = GetSocket(socket_id_);
if (!socket_) {
error_ = kSocketNotFoundError;
- SetResult(Value::CreateIntegerValue(-1));
+ SetResult(new base::FundamentalValue(-1));
AsyncWorkCompleted();
return;
}
@@ -517,7 +517,7 @@ void SocketSendToFunction::AsyncWorkStart() {
APIPermission::kSocket,
&param)) {
error_ = kPermissionError;
- SetResult(Value::CreateIntegerValue(-1));
+ SetResult(new base::FundamentalValue(-1));
AsyncWorkCompleted();
return;
}
@@ -530,7 +530,7 @@ void SocketSendToFunction::AfterDnsLookup(int lookup_result) {
if (lookup_result == net::OK) {
StartSendTo();
} else {
- SetResult(Value::CreateIntegerValue(lookup_result));
+ SetResult(new base::FundamentalValue(lookup_result));
AsyncWorkCompleted();
}
}
@@ -569,7 +569,7 @@ void SocketSetKeepAliveFunction::Work() {
} else {
error_ = kSocketNotFoundError;
}
- SetResult(Value::CreateBooleanValue(result));
+ SetResult(new base::FundamentalValue(result));
}
SocketSetNoDelayFunction::SocketSetNoDelayFunction() {}
@@ -589,7 +589,7 @@ void SocketSetNoDelayFunction::Work() {
result = socket->SetNoDelay(params_->no_delay);
else
error_ = kSocketNotFoundError;
- SetResult(Value::CreateBooleanValue(result));
+ SetResult(new base::FundamentalValue(result));
}
SocketGetInfoFunction::SocketGetInfoFunction() {}
@@ -701,13 +701,13 @@ void SocketJoinGroupFunction::Work() {
Socket* socket = GetSocket(params_->socket_id);
if (!socket) {
error_ = kSocketNotFoundError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
if (socket->GetSocketType() != Socket::TYPE_UDP) {
error_ = kMulticastSocketTypeError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
@@ -719,7 +719,7 @@ void SocketJoinGroupFunction::Work() {
if (!PermissionsData::CheckAPIPermissionWithParam(
GetExtension(), APIPermission::kSocket, &param)) {
error_ = kPermissionError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
@@ -727,7 +727,7 @@ void SocketJoinGroupFunction::Work() {
if (result != 0) {
error_ = net::ErrorToString(result);
}
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
}
SocketLeaveGroupFunction::SocketLeaveGroupFunction() {}
@@ -746,13 +746,13 @@ void SocketLeaveGroupFunction::Work() {
if (!socket) {
error_ = kSocketNotFoundError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
if (socket->GetSocketType() != Socket::TYPE_UDP) {
error_ = kMulticastSocketTypeError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
@@ -764,14 +764,14 @@ void SocketLeaveGroupFunction::Work() {
APIPermission::kSocket,
&param)) {
error_ = kPermissionError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
result = static_cast<UDPSocket*>(socket)->LeaveGroup(params_->address);
if (result != 0)
error_ = net::ErrorToString(result);
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
}
SocketSetMulticastTimeToLiveFunction::SocketSetMulticastTimeToLiveFunction() {}
@@ -788,13 +788,13 @@ void SocketSetMulticastTimeToLiveFunction::Work() {
Socket* socket = GetSocket(params_->socket_id);
if (!socket) {
error_ = kSocketNotFoundError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
if (socket->GetSocketType() != Socket::TYPE_UDP) {
error_ = kMulticastSocketTypeError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
@@ -802,7 +802,7 @@ void SocketSetMulticastTimeToLiveFunction::Work() {
params_->ttl);
if (result != 0)
error_ = net::ErrorToString(result);
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
}
SocketSetMulticastLoopbackModeFunction::
@@ -822,13 +822,13 @@ void SocketSetMulticastLoopbackModeFunction::Work() {
Socket* socket = GetSocket(params_->socket_id);
if (!socket) {
error_ = kSocketNotFoundError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
if (socket->GetSocketType() != Socket::TYPE_UDP) {
error_ = kMulticastSocketTypeError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
@@ -836,7 +836,7 @@ void SocketSetMulticastLoopbackModeFunction::Work() {
SetMulticastLoopbackMode(params_->enabled);
if (result != 0)
error_ = net::ErrorToString(result);
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
}
SocketGetJoinedGroupsFunction::SocketGetJoinedGroupsFunction() {}
@@ -854,13 +854,13 @@ void SocketGetJoinedGroupsFunction::Work() {
Socket* socket = GetSocket(params_->socket_id);
if (!socket) {
error_ = kSocketNotFoundError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
if (socket->GetSocketType() != Socket::TYPE_UDP) {
error_ = kMulticastSocketTypeError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}
@@ -873,7 +873,7 @@ void SocketGetJoinedGroupsFunction::Work() {
APIPermission::kSocket,
&param)) {
error_ = kPermissionError;
- SetResult(Value::CreateIntegerValue(result));
+ SetResult(new base::FundamentalValue(result));
return;
}

Powered by Google App Engine
This is Rietveld 408576698