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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // static | 42 // static |
43 void CameraDetector::StartPresenceCheck(const base::Closure& callback) { | 43 void CameraDetector::StartPresenceCheck(const base::Closure& callback) { |
44 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 44 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
45 if (presence_check_in_progress_) | 45 if (presence_check_in_progress_) |
46 return; | 46 return; |
47 DVLOG(1) << "Starting camera presence check"; | 47 DVLOG(1) << "Starting camera presence check"; |
48 presence_check_in_progress_ = true; | 48 presence_check_in_progress_ = true; |
49 base::PostTaskAndReplyWithResult( | 49 base::PostTaskAndReplyWithResult( |
50 base::CreateTaskRunnerWithTraits( | 50 base::CreateTaskRunnerWithTraits( |
51 base::TaskTraits() | 51 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
52 .MayBlock() | 52 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}) |
53 .WithPriority(base::TaskPriority::BACKGROUND) | |
54 .WithShutdownBehavior( | |
55 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)) | |
56 .get(), | 53 .get(), |
57 FROM_HERE, base::Bind(&CameraDetector::CheckPresence), | 54 FROM_HERE, base::Bind(&CameraDetector::CheckPresence), |
58 base::Bind(&CameraDetector::OnPresenceCheckDone, callback)); | 55 base::Bind(&CameraDetector::OnPresenceCheckDone, callback)); |
59 } | 56 } |
60 | 57 |
61 // static | 58 // static |
62 void CameraDetector::OnPresenceCheckDone(const base::Closure& callback, | 59 void CameraDetector::OnPresenceCheckDone(const base::Closure& callback, |
63 bool present) { | 60 bool present) { |
64 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
65 camera_presence_ = present ? kCameraPresent : kCameraAbsent; | 62 camera_presence_ = present ? kCameraPresent : kCameraAbsent; |
(...skipping 18 matching lines...) Expand all Loading... |
84 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 81 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
85 if (find(caps.begin(), caps.end(), kV4LCaptureCapability) != caps.end()) { | 82 if (find(caps.begin(), caps.end(), kV4LCaptureCapability) != caps.end()) { |
86 return true; | 83 return true; |
87 } | 84 } |
88 } | 85 } |
89 } | 86 } |
90 return false; | 87 return false; |
91 } | 88 } |
92 | 89 |
93 } // namespace chromeos | 90 } // namespace chromeos |
OLD | NEW |