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

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: Update 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 */)> EnableProtectionCallback;
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 EnableProtection(uint32_t desired_method_mask,
37 const EnableProtectionCallback& callback); 39 const EnableProtectionCallback& callback);
38 40
41 // Display content protection controller interface.
42 class Controller {
43 public:
44 Controller();
45 virtual ~Controller();
46 virtual bool Init() = 0;
47 virtual void QueryStatus(int64_t display_id,
48 const QueryStatusCallback& callback) = 0;
49 virtual void EnableProtection(int64_t display_id,
50 uint32_t desired_method_mask,
51 const EnableProtectionCallback& callback) = 0;
52
53 private:
54 DISALLOW_COPY_AND_ASSIGN(Controller);
55 };
56
39 private: 57 private:
40 display::DisplayConfigurator::ContentProtectionClientId GetClientId(); 58 bool InitializeControllerIfNecessary();
41 59 void QueryStatusComplete(const QueryStatusCallback& callback,
42 void QueryStatusComplete( 60 bool success,
43 const QueryStatusCallback& callback, 61 uint32_t link_mask,
44 const display::DisplayConfigurator::QueryProtectionResponse& response); 62 uint32_t protection_mask);
45 void EnableProtectionComplete(const EnableProtectionCallback& callback, 63 void EnableProtectionComplete(const EnableProtectionCallback& callback,
46 bool success); 64 bool success);
47 65
48 // Used to lookup the WebContents associated with the render frame. 66 // Used to lookup the WebContents associated with the render frame.
49 int render_process_id_; 67 int render_process_id_;
50 int render_frame_id_; 68 int render_frame_id_;
51 69
52 // Native window being observed. 70 // Native window being observed.
53 aura::Window* window_; 71 aura::Window* window_;
54 72
55 display::DisplayConfigurator::ContentProtectionClientId client_id_;
56
57 // The display id which the renderer currently uses. 73 // The display id which the renderer currently uses.
58 int64_t display_id_; 74 int64_t display_id_;
59 75
60 // The last desired method mask. Will enable this mask on new display if 76 // The last desired method mask. Will enable this mask on new display if
61 // renderer changes display. 77 // renderer changes display.
62 uint32_t desired_method_mask_; 78 uint32_t desired_method_mask_;
63 79
80 // The display content protection controller.
81 std::unique_ptr<Controller> controller_;
82
64 base::WeakPtrFactory<OutputProtectionDelegate> weak_ptr_factory_; 83 base::WeakPtrFactory<OutputProtectionDelegate> weak_ptr_factory_;
84
85 DISALLOW_COPY_AND_ASSIGN(OutputProtectionDelegate);
65 }; 86 };
66 87
67 } // namespace chromeos 88 } // namespace chromeos
68 89
69 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_ 90 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_OUTPUT_PROTECTION_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698