| 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 "chrome/browser/extensions/api/hid/hid_api.h" | 5 #include "chrome/browser/extensions/api/hid/hid_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/api/api_resource_manager.h" | 10 #include "chrome/browser/extensions/api/api_resource_manager.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 namespace extensions { | 42 namespace extensions { |
| 43 | 43 |
| 44 HidAsyncApiFunction::HidAsyncApiFunction() | 44 HidAsyncApiFunction::HidAsyncApiFunction() |
| 45 : device_manager_(NULL), connection_manager_(NULL) {} | 45 : device_manager_(NULL), connection_manager_(NULL) {} |
| 46 | 46 |
| 47 HidAsyncApiFunction::~HidAsyncApiFunction() {} | 47 HidAsyncApiFunction::~HidAsyncApiFunction() {} |
| 48 | 48 |
| 49 bool HidAsyncApiFunction::PrePrepare() { | 49 bool HidAsyncApiFunction::PrePrepare() { |
| 50 device_manager_ = HidDeviceManager::Get(context()); | 50 device_manager_ = HidDeviceManager::Get(browser_context()); |
| 51 DCHECK(device_manager_); | 51 DCHECK(device_manager_); |
| 52 connection_manager_ = | 52 connection_manager_ = |
| 53 ApiResourceManager<HidConnectionResource>::Get(context()); | 53 ApiResourceManager<HidConnectionResource>::Get(browser_context()); |
| 54 DCHECK(connection_manager_); | 54 DCHECK(connection_manager_); |
| 55 set_work_thread_id(content::BrowserThread::FILE); | 55 set_work_thread_id(content::BrowserThread::FILE); |
| 56 return true; | 56 return true; |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool HidAsyncApiFunction::Respond() { | 59 bool HidAsyncApiFunction::Respond() { |
| 60 return error_.empty(); | 60 return error_.empty(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 HidConnectionResource* HidAsyncApiFunction::GetHidConnectionResource( | 63 HidConnectionResource* HidAsyncApiFunction::GetHidConnectionResource( |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 void HidSendFeatureReportFunction::OnFinished(bool success, size_t bytes) { | 288 void HidSendFeatureReportFunction::OnFinished(bool success, size_t bytes) { |
| 289 if (!success) { | 289 if (!success) { |
| 290 CompleteWithError(kErrorTransfer); | 290 CompleteWithError(kErrorTransfer); |
| 291 return; | 291 return; |
| 292 } | 292 } |
| 293 AsyncWorkCompleted(); | 293 AsyncWorkCompleted(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace extensions | 296 } // namespace extensions |
| OLD | NEW |