Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 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_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/memory/weak_ptr.h" | |
| 9 #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.
| |
| 10 #include "ui/aura/window.h" | |
| 11 #include "ui/aura/window_observer.h" | |
| 12 #include "ui/display/chromeos/display_configurator.h" | |
| 13 | |
| 14 namespace chromeos { | |
| 15 | |
| 16 // Output protection delegate. All methods except constructor should be | |
| 17 // invoked in UI thread. | |
| 18 class OutputProtectionDelegate : public aura::WindowObserver { | |
| 19 public: | |
| 20 typedef base::Callback<void(bool /* success */, | |
| 21 uint32_t /* link_mask */, | |
| 22 uint32_t /* protection_mask*/)> | |
| 23 QueryStatusCallback; | |
| 24 typedef base::Callback<void(bool /* success */)> EnableProtectionCallback; | |
| 25 | |
| 26 OutputProtectionDelegate(int render_process_id, int render_frame_id); | |
| 27 ~OutputProtectionDelegate() override; | |
| 28 | |
| 29 // aura::WindowObserver overrides. | |
| 30 void OnWindowHierarchyChanged( | |
| 31 const aura::WindowObserver::HierarchyChangeParams& params) override; | |
| 32 void OnWindowDestroying(aura::Window* window) override; | |
| 33 | |
| 34 void QueryStatus(const QueryStatusCallback& callback); | |
| 35 void EnableProtection(uint32_t desired_method_mask, | |
| 36 const EnableProtectionCallback& callback); | |
| 37 | |
| 38 private: | |
| 39 ui::DisplayConfigurator::ContentProtectionClientId GetClientId(); | |
| 40 | |
| 41 void QueryStatusComplete( | |
| 42 const QueryStatusCallback& callback, | |
| 43 const ui::DisplayConfigurator::QueryProtectionResponse& response); | |
| 44 void EnableProtectionComplete(const EnableProtectionCallback& callback, | |
| 45 bool success); | |
| 46 | |
| 47 // 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.
| |
| 48 int render_process_id_; | |
| 49 int render_frame_id_; | |
| 50 | |
| 51 // Native window being observed. | |
| 52 aura::Window* window_; | |
| 53 | |
| 54 ui::DisplayConfigurator::ContentProtectionClientId client_id_; | |
| 55 | |
| 56 // The display id which the renderer currently uses. | |
| 57 int64 display_id_; | |
| 58 | |
| 59 // The last desired method mask. Will enable this mask on new display if | |
| 60 // renderer changes display. | |
| 61 uint32_t desired_method_mask_; | |
| 62 | |
| 63 base::WeakPtrFactory<OutputProtectionDelegate> weak_ptr_factory_; | |
| 64 }; | |
| 65 | |
| 66 } // namespace chromeos | |
| 67 | |
| 68 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_ | |
| OLD | NEW |