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

Side by Side Diff: chrome/browser/extensions/api/usb/usb_device_resource.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/usb/usb_device_resource.h" 5 #include "chrome/browser/extensions/api/usb/usb_device_resource.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 NOTREACHED(); 148 NOTREACHED();
149 return ""; 149 return "";
150 } 150 }
151 151
152 } // namespace 152 } // namespace
153 153
154 namespace extensions { 154 namespace extensions {
155 155
156 UsbDeviceResource::UsbDeviceResource(ApiResourceEventNotifier* notifier, 156 UsbDeviceResource::UsbDeviceResource(const std::string& owner_extension_id,
157 ApiResourceEventNotifier* notifier,
157 UsbDevice* device) 158 UsbDevice* device)
158 : ApiResource(notifier), device_(device) {} 159 : ApiResource(owner_extension_id, notifier), device_(device) {}
159 160
160 UsbDeviceResource::~UsbDeviceResource() { 161 UsbDeviceResource::~UsbDeviceResource() {
161 Close(); 162 Close();
162 } 163 }
163 164
164 void UsbDeviceResource::Close() { 165 void UsbDeviceResource::Close() {
165 device_->Close(); 166 device_->Close();
166 } 167 }
167 168
168 void UsbDeviceResource::ControlTransfer(const ControlTransferInfo& transfer) { 169 void UsbDeviceResource::ControlTransfer(const ControlTransferInfo& transfer) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 UsbTransferStatus status) { 245 UsbTransferStatus status) {
245 if (buffer) { 246 if (buffer) {
246 base::BinaryValue* const response_buffer = 247 base::BinaryValue* const response_buffer =
247 base::BinaryValue::CreateWithCopiedBuffer(buffer->data(), length); 248 base::BinaryValue::CreateWithCopiedBuffer(buffer->data(), length);
248 event_notifier()->OnTransferComplete(status, 249 event_notifier()->OnTransferComplete(status,
249 ConvertTransferStatusToErrorString(status), response_buffer); 250 ConvertTransferStatusToErrorString(status), response_buffer);
250 } 251 }
251 } 252 }
252 253
253 } // namespace extensions 254 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/usb/usb_device_resource.h ('k') | chrome/browser/extensions/extension_function_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698