blob: 525d857945563e9f21fa7a83742bfd59e745e3d0 [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <stdint.h>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "ui/display/display_export.h"
#include "ui/display/types/display_constants.h"
namespace ui {
class DisplayLayoutManager;
class NativeDisplayDelegate;
class DISPLAY_EXPORT QueryContentProtectionTask {
struct Response {
bool success = false;
uint32_t link_mask = 0;
uint32_t enabled = 0;
uint32_t unfulfilled = 0;
typedef base::Callback<void(Response)> ResponseCallback;
QueryContentProtectionTask(DisplayLayoutManager* layout_manager,
NativeDisplayDelegate* native_display_delegate,
int64_t display_id,
const ResponseCallback& callback);
void Run();
// Callback for NativeDisplayDelegate::GetHDCPState()
void OnHDCPStateUpdate(bool success, HDCPState state);
DisplayLayoutManager* layout_manager_; // Not owned.
NativeDisplayDelegate* native_display_delegate_; // Not owned.
// Display ID for the query.
int64_t display_id_;
// Called at the end of the query to signal completion.
ResponseCallback callback_;
Response response_;
// Tracks the number of NativeDisplayDelegate requests sent but not answered
// yet.
size_t pending_requests_;
base::WeakPtrFactory<QueryContentProtectionTask> weak_ptr_factory_;
} // namespace ui