OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_PROXY_H_ |
| 6 #define CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_PROXY_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 |
| 12 #if defined(OS_CHROMEOS) |
| 13 #include "chrome/browser/chromeos/display/output_protection_delegate.h" |
| 14 #endif |
| 15 |
| 16 namespace chrome { |
| 17 |
| 18 // A class to query output protection status and/or enable output protection. |
| 19 // |
| 20 // On ChromeOS, operations on the physical displays are delegated to |
| 21 // OutputProtectionDelegate. On other platforms, physical displays are not |
| 22 // checked. |
| 23 // |
| 24 // On all platforms, in QueryStatusComplete(), this class checks the network |
| 25 // links and adds it to the existing link mask. |
| 26 // |
| 27 // All methods except constructor should be invoked in UI thread. |
| 28 class OutputProtectionProxy { |
| 29 public: |
| 30 typedef base::Callback<void(bool /* success */, |
| 31 uint32_t /* link_mask */, |
| 32 uint32_t /* protection_mask*/)> |
| 33 QueryStatusCallback; |
| 34 typedef base::Callback<void(bool /* success */)> EnableProtectionCallback; |
| 35 |
| 36 OutputProtectionProxy(int render_process_id, int render_frame_id); |
| 37 ~OutputProtectionProxy(); |
| 38 |
| 39 void QueryStatus(const QueryStatusCallback& callback); |
| 40 void EnableProtection(uint32_t desired_method_mask, |
| 41 const EnableProtectionCallback& callback); |
| 42 |
| 43 private: |
| 44 // Callbacks for QueryStatus() and EnableProtection(). |
| 45 void QueryStatusComplete(const QueryStatusCallback& callback, |
| 46 bool success, |
| 47 uint32_t link_mask, |
| 48 uint32_t protection_mask); |
| 49 |
| 50 // Used to lookup the WebContents associated with the render frame. |
| 51 int render_process_id_; |
| 52 int render_frame_id_; |
| 53 |
| 54 #if defined(OS_CHROMEOS) |
| 55 chromeos::OutputProtectionDelegate output_protection_delegate_; |
| 56 #endif |
| 57 |
| 58 base::WeakPtrFactory<OutputProtectionProxy> weak_ptr_factory_; |
| 59 }; |
| 60 |
| 61 } // namespace chrome |
| 62 |
| 63 #endif // CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_PROXY_H_ |
OLD | NEW |