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

Side by Side Diff: chrome/browser/extensions/api/socket/udp_socket.cc

Issue 10919201: Make sure that a given app/extension requests only its own resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improve tests; fix merge conflicts. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/socket/udp_socket.h" 5 #include "chrome/browser/extensions/api/socket/udp_socket.h"
6 6
7 #include "chrome/browser/extensions/api/api_resource.h" 7 #include "chrome/browser/extensions/api/api_resource.h"
8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" 8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h"
9 #include "net/base/ip_endpoint.h" 9 #include "net/base/ip_endpoint.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 #include "net/udp/datagram_socket.h" 11 #include "net/udp/datagram_socket.h"
12 #include "net/udp/udp_client_socket.h" 12 #include "net/udp/udp_client_socket.h"
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 UDPSocket::UDPSocket(ApiResourceEventNotifier* event_notifier) 16 UDPSocket::UDPSocket(const std::string& owner_extension_id,
17 : Socket(event_notifier), 17 ApiResourceEventNotifier* event_notifier)
18 : Socket(owner_extension_id, event_notifier),
18 socket_(net::DatagramSocket::DEFAULT_BIND, 19 socket_(net::DatagramSocket::DEFAULT_BIND,
19 net::RandIntCallback(), 20 net::RandIntCallback(),
20 NULL, 21 NULL,
21 net::NetLog::Source()) { 22 net::NetLog::Source()) {
22 } 23 }
23 24
24 UDPSocket::~UDPSocket() { 25 UDPSocket::~UDPSocket() {
25 if (is_connected_) { 26 if (is_connected_) {
26 Disconnect(); 27 Disconnect();
27 } 28 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 recv_from_callback_.Reset(); 218 recv_from_callback_.Reset();
218 } 219 }
219 220
220 void UDPSocket::OnSendToComplete(int result) { 221 void UDPSocket::OnSendToComplete(int result) {
221 DCHECK(!send_to_callback_.is_null()); 222 DCHECK(!send_to_callback_.is_null());
222 send_to_callback_.Run(result); 223 send_to_callback_.Run(result);
223 send_to_callback_.Reset(); 224 send_to_callback_.Reset();
224 } 225 }
225 226
226 } // namespace extensions 227 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/socket/udp_socket.h ('k') | chrome/browser/extensions/api/socket/udp_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698