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

Side by Side Diff: chrome/browser/chromeos/login/camera_detector.cc

Issue 10855002: Change the type of file_type parameter to int, as the parameter actually takes or-ed bitmasks, (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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
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/chromeos/login/camera_detector.h" 5 #include "chrome/browser/chromeos/login/camera_detector.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
52 52
53 bool present = false; 53 bool present = false;
54 54
55 system::UdevInfoProvider* udev_info = system::UdevInfoProvider::GetInstance(); 55 system::UdevInfoProvider* udev_info = system::UdevInfoProvider::GetInstance();
56 // We do a quick check using udev database because opening each /dev/videoX 56 // We do a quick check using udev database because opening each /dev/videoX
57 // device may trigger costly device initialization. 57 // device may trigger costly device initialization.
58 using file_util::FileEnumerator; 58 using file_util::FileEnumerator;
59 FileEnumerator file_enum( 59 FileEnumerator file_enum(
60 FilePath(kV4LSubsystemDir), 60 FilePath(kV4LSubsystemDir),
61 false, // Don't recurse. 61 false, // Don't recurse.
jar (doing other things) 2012/08/06 18:27:02 nit: suggest putting line 61 onto end of line 60.
Haruki Sato 2012/08/06 23:22:18 Done.
62 static_cast<FileEnumerator::FileType>( 62 (FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS));
jar (doing other things) 2012/08/06 18:27:02 nit: suggest romoving parens around this arg.
Haruki Sato 2012/08/06 23:22:18 Done.
63 FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS));
64 for (FilePath path = file_enum.Next(); !path.empty(); 63 for (FilePath path = file_enum.Next(); !path.empty();
65 path = file_enum.Next()) { 64 path = file_enum.Next()) {
66 std::string v4l_capabilities; 65 std::string v4l_capabilities;
67 if (udev_info->QueryDeviceProperty(path.value(), kV4LCapabilities, 66 if (udev_info->QueryDeviceProperty(path.value(), kV4LCapabilities,
68 &v4l_capabilities)) { 67 &v4l_capabilities)) {
69 std::vector<std::string> caps; 68 std::vector<std::string> caps;
70 base::SplitString(v4l_capabilities, kV4LCapabilitiesDelim, &caps); 69 base::SplitString(v4l_capabilities, kV4LCapabilitiesDelim, &caps);
71 if (find(caps.begin(), caps.end(), kV4LCaptureCapability) != caps.end()) { 70 if (find(caps.begin(), caps.end(), kV4LCaptureCapability) != caps.end()) {
72 present = true; 71 present = true;
73 break; 72 break;
74 } 73 }
75 } 74 }
76 } 75 }
77 76
78 camera_presence_ = present ? kCameraPresent : kCameraAbsent; 77 camera_presence_ = present ? kCameraPresent : kCameraAbsent;
79 presence_check_in_progress_ = false; 78 presence_check_in_progress_ = false;
80 79
81 DVLOG(1) << "Camera presence state: " << camera_presence_; 80 DVLOG(1) << "Camera presence state: " << camera_presence_;
82 } 81 }
83 82
84 } // namespace chromeos 83 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698