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

Side by Side Diff: chrome/browser/media/output_protection_proxy.h

Issue 2085063002: media: Add OutputProtectionProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 5 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
(Empty)
1 // Copyright 2016 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_MEDIA_OUTPUT_PROTECTION_PROXY_H_
6 #define CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_PROXY_H_
7
8 #include <stdint.h>
9
10 #include "base/memory/weak_ptr.h"
11 #include "content/public/browser/browser_thread.h"
12
13 #if defined(OS_CHROMEOS)
14 #include "chrome/browser/chromeos/display/output_protection_delegate.h"
15 #endif
16
17 namespace chrome {
18
19 // A class to query output protection status and/or enable output protection.
20 //
21 // On Chrome OS, operations on the physical displays are delegated to
22 // OutputProtectionDelegate. On other platforms, physical displays are not
23 // checked.
24 //
25 // On all platforms, in ProcessQueryStatusResult(), this class checks the
26 // network link and adds it to the existing link mask.
27 //
28 // All methods except constructor should be invoked in UI thread.
29 class OutputProtectionProxy {
30 public:
31 typedef base::Callback<void(bool /* success */,
32 uint32_t /* link_mask */,
33 uint32_t /* protection_mask*/)>
34 QueryStatusCallback;
35 typedef base::Callback<void(bool /* success */)> EnableProtectionCallback;
36
37 OutputProtectionProxy(int render_process_id, int render_frame_id);
38
39 void QueryStatus(const QueryStatusCallback& callback);
40 void EnableProtection(uint32_t desired_method_mask,
41 const EnableProtectionCallback& callback);
42
43 private:
44 // Makes sure this class can only be deleted on the UI thread.
45 friend class base::DeleteHelper<OutputProtectionProxy>;
46 friend struct content::BrowserThread::DeleteOnThread<
47 content::BrowserThread::UI>;
48 ~OutputProtectionProxy();
49
50 // Callbacks for QueryStatus(). It also checks the network link and adds it
51 // to the |link_mask|.
52 void ProcessQueryStatusResult(const QueryStatusCallback& callback,
53 bool success,
54 uint32_t link_mask,
55 uint32_t protection_mask);
56
57 // Used to lookup the WebContents associated with the render frame.
58 int render_process_id_;
59 int render_frame_id_;
60
61 #if defined(OS_CHROMEOS)
62 chromeos::OutputProtectionDelegate output_protection_delegate_;
63 #endif
64
65 base::WeakPtrFactory<OutputProtectionProxy> weak_ptr_factory_;
66 };
67
68 } // namespace chrome
69
70 #endif // CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698