1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_DRM_DEVICE_HANDLE_H_
6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_DEVICE_HANDLE_H_
7 
8 #include "base/files/file_path.h"
9 #include "base/files/scoped_file.h"
10 #include "base/macros.h"
11 
12 namespace base {
13 class FilePath;
14 }
15 
16 namespace ui {
17 
18 class DrmDeviceHandle {
19  public:
20   DrmDeviceHandle();
21   ~DrmDeviceHandle();
22 
fd()23   int fd() const { return file_.get(); }
sys_path()24   const base::FilePath& sys_path() { return sys_path_; }
has_atomic_capabilities()25   bool has_atomic_capabilities() const { return has_atomic_capabilities_; }
26 
27   bool Initialize(const base::FilePath& dev_path,
28                   const base::FilePath& sys_path);
29 
30   bool IsValid() const;
31   base::ScopedFD PassFD();
32 
33  private:
34   base::FilePath sys_path_;
35   base::ScopedFD file_;
36   bool has_atomic_capabilities_ = false;
37 
38   DISALLOW_COPY_AND_ASSIGN(DrmDeviceHandle);
39 };
40 
41 }  // namespace ui
42 
43 #endif  // UI_OZONE_PLATFORM_DRM_HOST_DRM_DEVICE_HANDLE_H_
44