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

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

Issue 881983003: media: Invoke PlatformVerificationDialog from ProtectedMediaIdentifierPermissionContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_
6 #define CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ 6 #define CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_
7 7
8 #include "base/memory/weak_ptr.h"
8 #include "chrome/browser/content_settings/permission_context_base.h" 9 #include "chrome/browser/content_settings/permission_context_base.h"
10 #include "components/content_settings/core/common/permission_request_id.h"
9 11
10 class PermissionRequestID; 12 #if defined(OS_CHROMEOS)
13 #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h"
14 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h"
15 #endif
16
11 class Profile; 17 class Profile;
12 18
19 namespace views {
20 class Widget;
21 }
22
13 namespace content { 23 namespace content {
14 class RenderViewHost; 24 class RenderViewHost;
15 class WebContents; 25 class WebContents;
16 } 26 }
17 27
18 // Manages protected media identifier permissions flow, and delegates UI 28 // Manages protected media identifier permissions flow, and delegates UI
19 // handling via PermissionQueueController. 29 // handling via PermissionQueueController.
20 class ProtectedMediaIdentifierPermissionContext 30 class ProtectedMediaIdentifierPermissionContext
21 : public PermissionContextBase { 31 : public PermissionContextBase {
22 public: 32 public:
23 explicit ProtectedMediaIdentifierPermissionContext(Profile* profile); 33 explicit ProtectedMediaIdentifierPermissionContext(Profile* profile);
24 34
25 // In addition to the base class flow checks that it is only code from 35 // In addition to the base class flow checks that it is only code from
26 // valid iframes. It also adds special logic when called through an extension. 36 // valid iframes. It also adds special logic when called through an extension.
27 void RequestPermission(content::WebContents* web_contents, 37 void RequestPermission(content::WebContents* web_contents,
28 const PermissionRequestID& id, 38 const PermissionRequestID& id,
29 const GURL& requesting_frame_origin, 39 const GURL& requesting_origin,
30 bool user_gesture, 40 bool user_gesture,
31 const BrowserPermissionCallback& callback) override; 41 const BrowserPermissionCallback& callback) override;
32 ContentSetting GetPermissionStatus( 42 ContentSetting GetPermissionStatus(
33 const GURL& requesting_origin, 43 const GURL& requesting_origin,
34 const GURL& embedding_origin) const override; 44 const GURL& embedding_origin) const override;
45 void CancelPermissionRequest(content::WebContents* web_contents,
46 const PermissionRequestID& id) override;
35 47
36 private: 48 private:
37 ~ProtectedMediaIdentifierPermissionContext() override; 49 ~ProtectedMediaIdentifierPermissionContext() override;
38 50
39 void UpdateTabContext(const PermissionRequestID& id, 51 void UpdateTabContext(const PermissionRequestID& id,
40 const GURL& requesting_frame, 52 const GURL& requesting_frame,
41 bool allowed) override; 53 bool allowed) override;
42 54
43 // Returns whether "Protected content" is enabled. It can be disabled by a 55 // Returns whether "Protected content" is enabled. It can be disabled by a
44 // user in the master switch in content settings, or by the device policy. 56 // user in the master switch in content settings, or by the device policy.
45 bool IsProtectedMediaIdentifierEnabled() const; 57 bool IsProtectedMediaIdentifierEnabled() const;
46 58
59 #if defined(OS_CHROMEOS)
60 void OnPlatformVerificationResult(
61 const PermissionRequestID& id,
62 const GURL& requesting_origin,
63 const GURL& embedding_origin,
64 const BrowserPermissionCallback& callback,
65 chromeos::attestation::PlatformVerificationFlow::ConsentResponse
66 response);
67
68 // ID for the pending permission request. Invalid when no request is pending,
69 // or the request has been canceled.
70 PermissionRequestID pending_id_;
71
72 views::Widget* widget_;
73 #endif
74
75 // Must be the last member, to ensure that it will be
76 // destroyed first, which will invalidate weak pointers
Jun Mukai 2015/02/05 02:08:14 I believe the callback won't run during the destru
xhwang 2015/02/05 02:49:35 hmm, can you elaborate? This comment doesn't menti
77 base::WeakPtrFactory<ProtectedMediaIdentifierPermissionContext> weak_factory_;
Jun Mukai 2015/02/05 02:08:14 weak_factory_ is also used chromeos only, so might
xhwang 2015/02/05 02:49:35 Done.
78
47 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext); 79 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext);
48 }; 80 };
49 81
50 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ 82 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698