Chromium Code Reviews| Index: chrome/browser/chromeos/display/output_protection_delegate.h |
| diff --git a/chrome/browser/chromeos/display/output_protection_delegate.h b/chrome/browser/chromeos/display/output_protection_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..04ec478e99ce93a86f103a88aa02b54fbbb7f252 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/display/output_protection_delegate.h |
| @@ -0,0 +1,67 @@ |
| +// Copyright 2013 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. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_ |
| +#define CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "ui/aura/window.h" |
| +#include "ui/aura/window_observer.h" |
| +#include "ui/display/chromeos/display_configurator.h" |
| + |
| +namespace chromeos { |
| + |
| +// Output protection delegate. All methods except constructor should be |
|
Jun Mukai
2015/05/19 04:10:31
"Output protection delegate" is simply repeating t
xhwang
2015/05/19 05:29:44
Done.
|
| +// invoked in UI thread. |
| +class OutputProtectionDelegate : public aura::WindowObserver { |
| + public: |
| + typedef base::Callback<void(bool /* success */, |
| + uint32_t /* link_mask */, |
| + uint32_t /* protection_mask*/)> |
| + QueryStatusCallback; |
| + typedef base::Callback<void(bool /* success */)> EnableProtectionCallback; |
| + |
| + OutputProtectionDelegate(int render_process_id, int render_frame_id); |
| + ~OutputProtectionDelegate() override; |
| + |
| + // aura::WindowObserver overrides. |
| + void OnWindowHierarchyChanged( |
| + const aura::WindowObserver::HierarchyChangeParams& params) override; |
| + void OnWindowDestroying(aura::Window* window) override; |
| + |
| + void QueryStatus(const QueryStatusCallback& callback); |
| + void EnableProtection(uint32_t desired_method_mask, |
| + const EnableProtectionCallback& callback); |
| + |
| + private: |
| + ui::DisplayConfigurator::ContentProtectionClientId GetClientId(); |
| + |
| + void QueryStatusComplete( |
| + const QueryStatusCallback& callback, |
| + const ui::DisplayConfigurator::QueryProtectionResponse& response); |
| + void EnableProtectionComplete(const EnableProtectionCallback& callback, |
| + bool success); |
| + |
| + // Used to lookup the WebContents associated with the render frame. |
| + int render_process_id_; |
| + int render_frame_id_; |
| + |
| + // Native window being observed. |
| + aura::Window* window_; |
| + |
| + ui::DisplayConfigurator::ContentProtectionClientId client_id_; |
| + |
| + // The display id which the renderer currently uses. |
| + int64 display_id_; |
| + |
| + // The last desired method mask. Will enable this mask on new display if |
| + // renderer changes display. |
| + uint32_t desired_method_mask_; |
| + |
| + base::WeakPtrFactory<OutputProtectionDelegate> weak_ptr_factory_; |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_ |