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/browser/api/hid/hid_api.h" | 5 #include "extensions/browser/api/hid/hid_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "device/core/device_client.h" | 10 #include "device/core/device_client.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } // namespace | 57 } // namespace |
58 | 58 |
59 namespace extensions { | 59 namespace extensions { |
60 | 60 |
61 HidAsyncApiFunction::HidAsyncApiFunction() | 61 HidAsyncApiFunction::HidAsyncApiFunction() |
62 : device_manager_(NULL), connection_manager_(NULL) {} | 62 : device_manager_(NULL), connection_manager_(NULL) {} |
63 | 63 |
64 HidAsyncApiFunction::~HidAsyncApiFunction() {} | 64 HidAsyncApiFunction::~HidAsyncApiFunction() {} |
65 | 65 |
66 bool HidAsyncApiFunction::PrePrepare() { | 66 bool HidAsyncApiFunction::PrePrepare() { |
67 #if defined(OS_MACOSX) | 67 #if defined(OS_WIN) |
68 // Migration from FILE thread to UI thread. OS X gets it first. | 68 // TODO(reillyg): Migrate Windows backend from FILE thread to UI thread. |
| 69 set_work_thread_id(content::BrowserThread::FILE); |
| 70 #else |
69 set_work_thread_id(content::BrowserThread::UI); | 71 set_work_thread_id(content::BrowserThread::UI); |
70 #else | |
71 // TODO(reillyg): Migrate Linux/CrOS and Windows as well. | |
72 set_work_thread_id(content::BrowserThread::FILE); | |
73 #endif | 72 #endif |
74 device_manager_ = HidDeviceManager::Get(browser_context()); | 73 device_manager_ = HidDeviceManager::Get(browser_context()); |
75 if (!device_manager_) { | 74 if (!device_manager_) { |
76 return false; | 75 return false; |
77 } | 76 } |
78 connection_manager_ = | 77 connection_manager_ = |
79 ApiResourceManager<HidConnectionResource>::Get(browser_context()); | 78 ApiResourceManager<HidConnectionResource>::Get(browser_context()); |
80 if (!connection_manager_) { | 79 if (!connection_manager_) { |
81 return false; | 80 return false; |
82 } | 81 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 343 |
345 void HidSendFeatureReportFunction::OnFinished(bool success) { | 344 void HidSendFeatureReportFunction::OnFinished(bool success) { |
346 if (!success) { | 345 if (!success) { |
347 CompleteWithError(kErrorTransfer); | 346 CompleteWithError(kErrorTransfer); |
348 return; | 347 return; |
349 } | 348 } |
350 AsyncWorkCompleted(); | 349 AsyncWorkCompleted(); |
351 } | 350 } |
352 | 351 |
353 } // namespace extensions | 352 } // namespace extensions |
OLD | NEW |