Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(791)

Side by Side Diff: chrome/browser/chromeos/display/output_protection_delegate.h

Issue 2675743002: PPAPI: Make output protection API work with mus+ash (Closed)
Patch Set: Addressed review issues Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_
6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_ 6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
11
12 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
11 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
12 #include "ui/aura/window_observer.h" 15 #include "ui/aura/window_observer.h"
13 #include "ui/display/manager/chromeos/display_configurator.h"
14 16
15 namespace chromeos { 17 namespace chromeos {
16 18
17 // A class to query output protection status and/or enable output protection. 19 // A class to query output protection status and/or enable output protection.
18 // All methods except constructor should be invoked in UI thread. 20 // All methods except constructor should be invoked in UI thread.
19 class OutputProtectionDelegate : public aura::WindowObserver { 21 class OutputProtectionDelegate : public aura::WindowObserver {
20 public: 22 public:
21 typedef base::Callback<void(bool /* success */, 23 typedef base::Callback<void(bool /* success */,
22 uint32_t /* link_mask */, 24 uint32_t /* link_mask */,
23 uint32_t /* protection_mask*/)> 25 uint32_t /* protection_mask*/)>
24 QueryStatusCallback; 26 QueryStatusCallback;
25 typedef base::Callback<void(bool /* success */)> EnableProtectionCallback; 27 typedef base::Callback<void(bool /* success */)> SetProtectionCallback;
26 28
27 OutputProtectionDelegate(int render_process_id, int render_frame_id); 29 OutputProtectionDelegate(int render_process_id, int render_frame_id);
28 ~OutputProtectionDelegate() override; 30 ~OutputProtectionDelegate() override;
29 31
30 // aura::WindowObserver overrides. 32 // aura::WindowObserver overrides.
31 void OnWindowHierarchyChanged( 33 void OnWindowHierarchyChanged(
32 const aura::WindowObserver::HierarchyChangeParams& params) override; 34 const aura::WindowObserver::HierarchyChangeParams& params) override;
33 void OnWindowDestroying(aura::Window* window) override; 35 void OnWindowDestroying(aura::Window* window) override;
34 36
35 void QueryStatus(const QueryStatusCallback& callback); 37 void QueryStatus(const QueryStatusCallback& callback);
36 void EnableProtection(uint32_t desired_method_mask, 38 void SetProtection(uint32_t desired_method_mask,
37 const EnableProtectionCallback& callback); 39 const SetProtectionCallback& callback);
40
41 // Display content protection controller interface.
42 class Controller {
43 public:
44 Controller();
45 virtual ~Controller();
46 virtual void QueryStatus(int64_t display_id,
47 const QueryStatusCallback& callback) = 0;
48 virtual void SetProtection(int64_t display_id,
49 uint32_t desired_method_mask,
50 const SetProtectionCallback& callback) = 0;
51
52 private:
53 DISALLOW_COPY_AND_ASSIGN(Controller);
54 };
38 55
39 private: 56 private:
40 display::DisplayConfigurator::ContentProtectionClientId GetClientId(); 57 bool InitializeControllerIfNecessary();
41
42 void QueryStatusComplete(
43 const QueryStatusCallback& callback,
44 const display::DisplayConfigurator::QueryProtectionResponse& response);
45 void EnableProtectionComplete(const EnableProtectionCallback& callback,
46 bool success);
47 58
48 // Used to lookup the WebContents associated with the render frame. 59 // Used to lookup the WebContents associated with the render frame.
49 int render_process_id_; 60 int render_process_id_;
50 int render_frame_id_; 61 int render_frame_id_;
51 62
52 // Native window being observed. 63 // Native window being observed.
53 aura::Window* window_; 64 aura::Window* window_;
54 65
55 display::DisplayConfigurator::ContentProtectionClientId client_id_;
56
57 // The display id which the renderer currently uses. 66 // The display id which the renderer currently uses.
58 int64_t display_id_; 67 int64_t display_id_;
59 68
60 // The last desired method mask. Will enable this mask on new display if 69 // The last desired method mask. Will enable this mask on new display if
61 // renderer changes display. 70 // renderer changes display.
62 uint32_t desired_method_mask_; 71 uint32_t desired_method_mask_;
63 72
73 // The display content protection controller.
74 std::unique_ptr<Controller> controller_;
75
64 base::WeakPtrFactory<OutputProtectionDelegate> weak_ptr_factory_; 76 base::WeakPtrFactory<OutputProtectionDelegate> weak_ptr_factory_;
77
78 DISALLOW_COPY_AND_ASSIGN(OutputProtectionDelegate);
65 }; 79 };
66 80
67 } // namespace chromeos 81 } // namespace chromeos
68 82
69 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_ 83 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698