| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "extensions/common/api/sockets/sockets_manifest_permission.h" | 5 #include "extensions/common/api/sockets/sockets_manifest_permission.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 sockets.udp.reset(new Sockets::Udp()); | 195 sockets.udp.reset(new Sockets::Udp()); |
| 196 SetHostPatterns(sockets.udp->bind, this, SocketPermissionRequest::UDP_BIND); | 196 SetHostPatterns(sockets.udp->bind, this, SocketPermissionRequest::UDP_BIND); |
| 197 SetHostPatterns( | 197 SetHostPatterns( |
| 198 sockets.udp->send, this, SocketPermissionRequest::UDP_SEND_TO); | 198 sockets.udp->send, this, SocketPermissionRequest::UDP_SEND_TO); |
| 199 SetHostPatterns(sockets.udp->multicast_membership, | 199 SetHostPatterns(sockets.udp->multicast_membership, |
| 200 this, | 200 this, |
| 201 SocketPermissionRequest::UDP_MULTICAST_MEMBERSHIP); | 201 SocketPermissionRequest::UDP_MULTICAST_MEMBERSHIP); |
| 202 if (sockets.udp->bind->as_strings->size() == 0 && | 202 if (sockets.udp->bind->as_strings->size() == 0 && |
| 203 sockets.udp->send->as_strings->size() == 0 && | 203 sockets.udp->send->as_strings->size() == 0 && |
| 204 sockets.udp->multicast_membership->as_strings->size() == 0) { | 204 sockets.udp->multicast_membership->as_strings->size() == 0) { |
| 205 sockets.udp.reset(NULL); | 205 sockets.udp.reset(nullptr); |
| 206 } | 206 } |
| 207 | 207 |
| 208 sockets.tcp.reset(new Sockets::Tcp()); | 208 sockets.tcp.reset(new Sockets::Tcp()); |
| 209 SetHostPatterns( | 209 SetHostPatterns( |
| 210 sockets.tcp->connect, this, SocketPermissionRequest::TCP_CONNECT); | 210 sockets.tcp->connect, this, SocketPermissionRequest::TCP_CONNECT); |
| 211 if (sockets.tcp->connect->as_strings->size() == 0) { | 211 if (sockets.tcp->connect->as_strings->size() == 0) { |
| 212 sockets.tcp.reset(NULL); | 212 sockets.tcp.reset(nullptr); |
| 213 } | 213 } |
| 214 | 214 |
| 215 sockets.tcp_server.reset(new Sockets::TcpServer()); | 215 sockets.tcp_server.reset(new Sockets::TcpServer()); |
| 216 SetHostPatterns( | 216 SetHostPatterns( |
| 217 sockets.tcp_server->listen, this, SocketPermissionRequest::TCP_LISTEN); | 217 sockets.tcp_server->listen, this, SocketPermissionRequest::TCP_LISTEN); |
| 218 if (sockets.tcp_server->listen->as_strings->size() == 0) { | 218 if (sockets.tcp_server->listen->as_strings->size() == 0) { |
| 219 sockets.tcp_server.reset(NULL); | 219 sockets.tcp_server.reset(nullptr); |
| 220 } | 220 } |
| 221 | 221 |
| 222 return scoped_ptr<base::Value>(sockets.ToValue().release()).Pass(); | 222 return scoped_ptr<base::Value>(sockets.ToValue().release()).Pass(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 ManifestPermission* SocketsManifestPermission::Diff( | 225 ManifestPermission* SocketsManifestPermission::Diff( |
| 226 const ManifestPermission* rhs) const { | 226 const ManifestPermission* rhs) const { |
| 227 const SocketsManifestPermission* other = | 227 const SocketsManifestPermission* other = |
| 228 static_cast<const SocketsManifestPermission*>(rhs); | 228 static_cast<const SocketsManifestPermission*>(rhs); |
| 229 | 229 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 if (it->pattern().type == SocketPermissionRequest::NETWORK_STATE) { | 331 if (it->pattern().type == SocketPermissionRequest::NETWORK_STATE) { |
| 332 messages.push_back( | 332 messages.push_back( |
| 333 PermissionMessage(PermissionMessage::kNetworkState, | 333 PermissionMessage(PermissionMessage::kNetworkState, |
| 334 l10n_util::GetStringUTF16( | 334 l10n_util::GetStringUTF16( |
| 335 IDS_EXTENSION_PROMPT_WARNING_NETWORK_STATE))); | 335 IDS_EXTENSION_PROMPT_WARNING_NETWORK_STATE))); |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 | 339 |
| 340 } // namespace extensions | 340 } // namespace extensions |
| OLD | NEW |