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..a201b884971c10b473aa89da39463a916214ddac |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/display/output_protection_delegate.h |
| @@ -0,0 +1,68 @@ |
| +// 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 "content/public/browser/render_frame_host.h" |
|
kcwu
2015/05/16 12:45:43
move to .cc?
xhwang
2015/05/18 18:30:44
Done.
|
| +#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 |
| +// 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 this PP_Instance. |
|
kcwu
2015/05/16 12:45:43
s/this PP_Instance/the render frame/
xhwang
2015/05/18 18:30:44
Done.
|
| + 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_ |