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