| OLD | NEW | 
 | (Empty) | 
|   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_DISPLAY_CHROMEOS_QUERY_CONTENT_PROTECTION_TASK_H_ |  | 
|   6 #define UI_DISPLAY_CHROMEOS_QUERY_CONTENT_PROTECTION_TASK_H_ |  | 
|   7  |  | 
|   8 #include <stddef.h> |  | 
|   9 #include <stdint.h> |  | 
|  10  |  | 
|  11 #include "base/callback.h" |  | 
|  12 #include "base/macros.h" |  | 
|  13 #include "base/memory/weak_ptr.h" |  | 
|  14 #include "ui/display/display_export.h" |  | 
|  15 #include "ui/display/types/display_constants.h" |  | 
|  16  |  | 
|  17 namespace ui { |  | 
|  18  |  | 
|  19 class DisplayLayoutManager; |  | 
|  20 class NativeDisplayDelegate; |  | 
|  21  |  | 
|  22 class DISPLAY_EXPORT QueryContentProtectionTask { |  | 
|  23  public: |  | 
|  24   struct Response { |  | 
|  25     bool success = false; |  | 
|  26     uint32_t link_mask = 0; |  | 
|  27     uint32_t enabled = 0; |  | 
|  28     uint32_t unfulfilled = 0; |  | 
|  29   }; |  | 
|  30  |  | 
|  31   typedef base::Callback<void(Response)> ResponseCallback; |  | 
|  32  |  | 
|  33   QueryContentProtectionTask(DisplayLayoutManager* layout_manager, |  | 
|  34                              NativeDisplayDelegate* native_display_delegate, |  | 
|  35                              int64_t display_id, |  | 
|  36                              const ResponseCallback& callback); |  | 
|  37   ~QueryContentProtectionTask(); |  | 
|  38  |  | 
|  39   void Run(); |  | 
|  40  |  | 
|  41  private: |  | 
|  42   // Callback for NativeDisplayDelegate::GetHDCPState() |  | 
|  43   void OnHDCPStateUpdate(bool success, HDCPState state); |  | 
|  44  |  | 
|  45   DisplayLayoutManager* layout_manager_;  // Not owned. |  | 
|  46  |  | 
|  47   NativeDisplayDelegate* native_display_delegate_;  // Not owned. |  | 
|  48  |  | 
|  49   // Display ID for the query. |  | 
|  50   int64_t display_id_; |  | 
|  51  |  | 
|  52   // Called at the end of the query to signal completion. |  | 
|  53   ResponseCallback callback_; |  | 
|  54  |  | 
|  55   Response response_; |  | 
|  56  |  | 
|  57   // Tracks the number of NativeDisplayDelegate requests sent but not answered |  | 
|  58   // yet. |  | 
|  59   size_t pending_requests_; |  | 
|  60  |  | 
|  61   base::WeakPtrFactory<QueryContentProtectionTask> weak_ptr_factory_; |  | 
|  62  |  | 
|  63   DISALLOW_COPY_AND_ASSIGN(QueryContentProtectionTask); |  | 
|  64 }; |  | 
|  65  |  | 
|  66 }  // namespace ui |  | 
|  67  |  | 
|  68 #endif  // UI_DISPLAY_CHROMEOS_QUERY_CONTENT_PROTECTION_TASK_H_ |  | 
| OLD | NEW |