OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/music_manager_private/device_id.h" | 5 #include "chrome/browser/extensions/api/music_manager_private/device_id.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/files/file_enumerator.h" | 11 #include "base/files/file_enumerator.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 const char kDiskByUuidDirectoryName[] = "/dev/disk/by-uuid"; | 17 const char kDiskByUuidDirectoryName[] = "/dev/disk/by-uuid"; |
18 const char* kDeviceNames[] = { "sda1", "hda1", "dm-0" }; | 18 const char* kDeviceNames[] = { |
19 "sda1", "hda1", "dm-0", "xvda1", "sda2", "hda2", "dm-1", "xvda2", | |
Marijn Kruisselbrink
2014/01/06 19:51:30
Would this be more flexible/future proof if instea
rpaquay
2014/01/06 20:47:16
Yes, I'd think if we need another change in this l
| |
20 }; | |
19 | 21 |
20 // Map from device name to disk uuid | 22 // Map from device name to disk uuid |
21 typedef std::map<base::FilePath, base::FilePath> DiskEntries; | 23 typedef std::map<base::FilePath, base::FilePath> DiskEntries; |
22 | 24 |
23 void GetDiskUuid(const extensions::api::DeviceId::IdCallback& callback) { | 25 void GetDiskUuid(const extensions::api::DeviceId::IdCallback& callback) { |
24 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 26 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
25 | 27 |
26 DiskEntries disk_uuids; | 28 DiskEntries disk_uuids; |
27 | 29 |
28 base::FileEnumerator files(base::FilePath(kDiskByUuidDirectoryName), | 30 base::FileEnumerator files(base::FilePath(kDiskByUuidDirectoryName), |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 86 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
85 | 87 |
86 content::BrowserThread::PostTask( | 88 content::BrowserThread::PostTask( |
87 content::BrowserThread::FILE, | 89 content::BrowserThread::FILE, |
88 FROM_HERE, | 90 FROM_HERE, |
89 base::Bind(GetDiskUuid, callback)); | 91 base::Bind(GetDiskUuid, callback)); |
90 } | 92 } |
91 | 93 |
92 } // namespace api | 94 } // namespace api |
93 } // namespace extensions | 95 } // namespace extensions |
OLD | NEW |