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

Side by Side Diff: chrome/browser/extensions/api/usb/usb_api.h

Issue 18593002: Usb backend refactor step 2: Separate Usb Device Handle and Usb Device (deprecate) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
9 10
10 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/extensions/api/api_function.h" 12 #include "chrome/browser/extensions/api/api_function.h"
12 #include "chrome/browser/extensions/api/api_resource_manager.h" 13 #include "chrome/browser/extensions/api/api_resource_manager.h"
13 #include "chrome/browser/usb/usb_device.h" 14 #include "chrome/browser/usb/usb_device.h"
14 #include "chrome/common/extensions/api/usb.h" 15 #include "chrome/common/extensions/api/usb.h"
15 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
16 17
17 class UsbDevice; 18 class UsbDevice;
18 19
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 64
64 static void SetDeviceForTest(UsbDevice* device); 65 static void SetDeviceForTest(UsbDevice* device);
65 66
66 protected: 67 protected:
67 virtual ~UsbFindDevicesFunction(); 68 virtual ~UsbFindDevicesFunction();
68 69
69 virtual bool Prepare() OVERRIDE; 70 virtual bool Prepare() OVERRIDE;
70 virtual void AsyncWorkStart() OVERRIDE; 71 virtual void AsyncWorkStart() OVERRIDE;
71 72
72 private: 73 private:
74 void OpenDevices();
73 void OnCompleted(); 75 void OnCompleted();
74 76
75 scoped_ptr<base::ListValue> result_; 77 scoped_ptr<base::ListValue> result_;
78 std::vector<int> device_ids_;
76 std::vector<scoped_refptr<UsbDevice> > devices_; 79 std::vector<scoped_refptr<UsbDevice> > devices_;
80 UsbService* service_;
77 scoped_ptr<extensions::api::usb::FindDevices::Params> parameters_; 81 scoped_ptr<extensions::api::usb::FindDevices::Params> parameters_;
78 }; 82 };
79 83
80 class UsbListInterfacesFunction : public UsbAsyncApiFunction { 84 class UsbListInterfacesFunction : public UsbAsyncApiFunction {
81 public: 85 public:
82 DECLARE_EXTENSION_FUNCTION("usb.listInterfaces", USB_LISTINTERFACES) 86 DECLARE_EXTENSION_FUNCTION("usb.listInterfaces", USB_LISTINTERFACES)
83 87
84 UsbListInterfacesFunction(); 88 UsbListInterfacesFunction();
85 89
86 protected: 90 protected:
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 protected: 258 protected:
255 virtual ~UsbResetDeviceFunction(); 259 virtual ~UsbResetDeviceFunction();
256 260
257 virtual bool Prepare() OVERRIDE; 261 virtual bool Prepare() OVERRIDE;
258 virtual void AsyncWorkStart() OVERRIDE; 262 virtual void AsyncWorkStart() OVERRIDE;
259 263
260 private: 264 private:
261 // FILE thread. 265 // FILE thread.
262 void OnStartResest(UsbDeviceResource* resource); 266 void OnStartResest(UsbDeviceResource* resource);
263 void OnCompletedFileThread(bool success); 267 void OnCompletedFileThread(bool success);
268 void OnClosed();
264 269
265 // IO thread. 270 // IO thread.
266 void OnCompleted(bool success); 271 void OnCompleted(bool success);
267 void OnError(); 272 void OnError();
268 273
269 scoped_ptr<extensions::api::usb::ResetDevice::Params> parameters_; 274 scoped_ptr<extensions::api::usb::ResetDevice::Params> parameters_;
270 }; 275 };
271 } // namespace extensions 276 } // namespace extensions
272 277
273 #endif // CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ 278 #endif // CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698