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

Side by Side Diff: components/usb_service/usb_service.cc

Issue 236203019: Move UsbService to its own component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move usb_service component symbols into usb_service namespace Created 6 years, 8 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
« no previous file with comments | « components/usb_service/usb_service.h ('k') | components/usb_service/usb_service_export.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/usb/usb_service.h" 5 #include "components/usb_service/usb_service.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "chrome/browser/usb/usb_context.h" 12 #include "components/usb_service/usb_context.h"
13 #include "chrome/browser/usb/usb_device.h" 13 #include "components/usb_service/usb_device.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "third_party/libusb/src/libusb/libusb.h" 15 #include "third_party/libusb/src/libusb/libusb.h"
16 16
17 namespace usb_service {
18
17 namespace { 19 namespace {
18 20
19 base::LazyInstance<scoped_ptr<UsbService> >::Leaky g_usb_service_instance = 21 base::LazyInstance<scoped_ptr<UsbService> >::Leaky g_usb_service_instance =
20 LAZY_INSTANCE_INITIALIZER; 22 LAZY_INSTANCE_INITIALIZER;
21 23
22 } // namespace 24 } // namespace
23 25
24 // static 26 // static
25 UsbService* UsbService::GetInstance() { 27 UsbService* UsbService::GetInstance() {
26 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 28 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 115
114 // Remove disconnected devices from devices_. 116 // Remove disconnected devices from devices_.
115 for (size_t i = 0; i < disconnected_devices.size(); ++i) { 117 for (size_t i = 0; i < disconnected_devices.size(); ++i) {
116 // UsbDevice will be destroyed after this. The corresponding 118 // UsbDevice will be destroyed after this. The corresponding
117 // PlatformUsbDevice will be unref'ed during this process. 119 // PlatformUsbDevice will be unref'ed during this process.
118 devices_.erase(disconnected_devices[i]); 120 devices_.erase(disconnected_devices[i]);
119 } 121 }
120 122
121 libusb_free_device_list(platform_devices, true); 123 libusb_free_device_list(platform_devices, true);
122 } 124 }
125
126 } // namespace usb_service
OLDNEW
« no previous file with comments | « components/usb_service/usb_service.h ('k') | components/usb_service/usb_service_export.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698