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" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 base::FileEnumerator files(base::FilePath(kDiskByUuidDirectoryName), | 28 base::FileEnumerator files(base::FilePath(kDiskByUuidDirectoryName), |
29 false, // Recursive. | 29 false, // Recursive. |
30 base::FileEnumerator::FILES); | 30 base::FileEnumerator::FILES); |
31 do { | 31 do { |
32 base::FilePath file_path = files.Next(); | 32 base::FilePath file_path = files.Next(); |
33 if (file_path.empty()) | 33 if (file_path.empty()) |
34 break; | 34 break; |
35 | 35 |
36 base::FilePath target_path; | 36 base::FilePath target_path; |
37 if (!file_util::ReadSymbolicLink(file_path, &target_path)) | 37 if (!base::ReadSymbolicLink(file_path, &target_path)) |
38 continue; | 38 continue; |
39 | 39 |
40 base::FilePath device_name = target_path.BaseName(); | 40 base::FilePath device_name = target_path.BaseName(); |
41 base::FilePath disk_uuid = file_path.BaseName(); | 41 base::FilePath disk_uuid = file_path.BaseName(); |
42 disk_uuids[device_name] = disk_uuid; | 42 disk_uuids[device_name] = disk_uuid; |
43 } while (true); | 43 } while (true); |
44 | 44 |
45 // Look for first device name matching an entry of |kDeviceNames|. | 45 // Look for first device name matching an entry of |kDeviceNames|. |
46 std::string result; | 46 std::string result; |
47 for (size_t i = 0; i < arraysize(kDeviceNames); i++) { | 47 for (size_t i = 0; i < arraysize(kDeviceNames); i++) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 84 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
85 | 85 |
86 content::BrowserThread::PostTask( | 86 content::BrowserThread::PostTask( |
87 content::BrowserThread::FILE, | 87 content::BrowserThread::FILE, |
88 FROM_HERE, | 88 FROM_HERE, |
89 base::Bind(GetDiskUuid, callback)); | 89 base::Bind(GetDiskUuid, callback)); |
90 } | 90 } |
91 | 91 |
92 } // namespace api | 92 } // namespace api |
93 } // namespace extensions | 93 } // namespace extensions |
OLD | NEW |