OLD | NEW |
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/chromeos/camera_detector.h" | 5 #include "chrome/browser/chromeos/camera_detector.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // We do a quick check using udev database because opening each /dev/videoX | 68 // We do a quick check using udev database because opening each /dev/videoX |
69 // device may trigger costly device initialization. | 69 // device may trigger costly device initialization. |
70 base::FileEnumerator file_enum( | 70 base::FileEnumerator file_enum( |
71 base::FilePath(kV4LSubsystemDir), false /* not recursive */, | 71 base::FilePath(kV4LSubsystemDir), false /* not recursive */, |
72 base::FileEnumerator::FILES | base::FileEnumerator::SHOW_SYM_LINKS); | 72 base::FileEnumerator::FILES | base::FileEnumerator::SHOW_SYM_LINKS); |
73 for (base::FilePath path = file_enum.Next(); !path.empty(); | 73 for (base::FilePath path = file_enum.Next(); !path.empty(); |
74 path = file_enum.Next()) { | 74 path = file_enum.Next()) { |
75 std::string v4l_capabilities; | 75 std::string v4l_capabilities; |
76 if (storage_monitor::GetUdevDevicePropertyValueByPath( | 76 if (storage_monitor::GetUdevDevicePropertyValueByPath( |
77 path, kV4LCapabilities, &v4l_capabilities)) { | 77 path, kV4LCapabilities, &v4l_capabilities)) { |
78 std::vector<std::string> caps; | 78 std::vector<std::string> caps = base::SplitString( |
79 base::SplitString(v4l_capabilities, kV4LCapabilitiesDelim, &caps); | 79 v4l_capabilities, std::string(1, kV4LCapabilitiesDelim), |
| 80 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
80 if (find(caps.begin(), caps.end(), kV4LCaptureCapability) != caps.end()) { | 81 if (find(caps.begin(), caps.end(), kV4LCaptureCapability) != caps.end()) { |
81 return true; | 82 return true; |
82 } | 83 } |
83 } | 84 } |
84 } | 85 } |
85 return false; | 86 return false; |
86 } | 87 } |
87 | 88 |
88 } // namespace chromeos | 89 } // namespace chromeos |
OLD | NEW |