| OLD | NEW |
| 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_api.h" | 5 #include "chrome/browser/extensions/api/usb/usb_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "chrome/browser/extensions/api/usb/usb_device_resource.h" | 12 #include "chrome/browser/extensions/api/usb/usb_device_resource.h" |
| 13 #include "chrome/browser/profiles/profile.h" | |
| 14 #include "chrome/browser/usb/usb_device_handle.h" | 13 #include "chrome/browser/usb/usb_device_handle.h" |
| 15 #include "chrome/browser/usb/usb_service.h" | 14 #include "chrome/browser/usb/usb_service.h" |
| 16 #include "chrome/common/extensions/api/usb.h" | 15 #include "chrome/common/extensions/api/usb.h" |
| 17 #include "chrome/common/extensions/permissions/usb_device_permission.h" | 16 #include "chrome/common/extensions/permissions/usb_device_permission.h" |
| 18 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
| 19 #include "extensions/common/permissions/permissions_data.h" | 18 #include "extensions/common/permissions/permissions_data.h" |
| 20 | 19 |
| 21 namespace usb = extensions::api::usb; | 20 namespace usb = extensions::api::usb; |
| 22 namespace BulkTransfer = usb::BulkTransfer; | 21 namespace BulkTransfer = usb::BulkTransfer; |
| 23 namespace ClaimInterface = usb::ClaimInterface; | 22 namespace ClaimInterface = usb::ClaimInterface; |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 namespace extensions { | 388 namespace extensions { |
| 390 | 389 |
| 391 UsbAsyncApiFunction::UsbAsyncApiFunction() | 390 UsbAsyncApiFunction::UsbAsyncApiFunction() |
| 392 : manager_(NULL) { | 391 : manager_(NULL) { |
| 393 } | 392 } |
| 394 | 393 |
| 395 UsbAsyncApiFunction::~UsbAsyncApiFunction() { | 394 UsbAsyncApiFunction::~UsbAsyncApiFunction() { |
| 396 } | 395 } |
| 397 | 396 |
| 398 bool UsbAsyncApiFunction::PrePrepare() { | 397 bool UsbAsyncApiFunction::PrePrepare() { |
| 399 manager_ = ApiResourceManager<UsbDeviceResource>::Get(GetProfile()); | 398 manager_ = ApiResourceManager<UsbDeviceResource>::Get(browser_context()); |
| 400 set_work_thread_id(BrowserThread::FILE); | 399 set_work_thread_id(BrowserThread::FILE); |
| 401 return manager_ != NULL; | 400 return manager_ != NULL; |
| 402 } | 401 } |
| 403 | 402 |
| 404 bool UsbAsyncApiFunction::Respond() { | 403 bool UsbAsyncApiFunction::Respond() { |
| 405 return error_.empty(); | 404 return error_.empty(); |
| 406 } | 405 } |
| 407 | 406 |
| 408 scoped_refptr<UsbDevice> | 407 scoped_refptr<UsbDevice> |
| 409 UsbAsyncApiFunction::GetDeviceOrOrCompleteWithError( | 408 UsbAsyncApiFunction::GetDeviceOrOrCompleteWithError( |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 SetResult(new base::FundamentalValue(false)); | 1170 SetResult(new base::FundamentalValue(false)); |
| 1172 CompleteWithError(kErrorResetDevice); | 1171 CompleteWithError(kErrorResetDevice); |
| 1173 return; | 1172 return; |
| 1174 } | 1173 } |
| 1175 | 1174 |
| 1176 SetResult(new base::FundamentalValue(true)); | 1175 SetResult(new base::FundamentalValue(true)); |
| 1177 AsyncWorkCompleted(); | 1176 AsyncWorkCompleted(); |
| 1178 } | 1177 } |
| 1179 | 1178 |
| 1180 } // namespace extensions | 1179 } // namespace extensions |
| OLD | NEW |