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

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

Issue 1153873003: Add way for PermissionContext to be automatically restricted to secure origins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@midi_permission_sysex
Patch Set: Created 5 years, 7 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 "chrome/browser/content_settings/permission_context_base.h" 8 #include "chrome/browser/content_settings/permission_context_base.h"
9 #include "components/content_settings/core/common/permission_request_id.h" 9 #include "components/content_settings/core/common/permission_request_id.h"
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 const GURL& embedding_origin) const override; 50 const GURL& embedding_origin) const override;
51 void CancelPermissionRequest(content::WebContents* web_contents, 51 void CancelPermissionRequest(content::WebContents* web_contents,
52 const PermissionRequestID& id) override; 52 const PermissionRequestID& id) override;
53 53
54 private: 54 private:
55 ~ProtectedMediaIdentifierPermissionContext() override; 55 ~ProtectedMediaIdentifierPermissionContext() override;
56 56
57 void UpdateTabContext(const PermissionRequestID& id, 57 void UpdateTabContext(const PermissionRequestID& id,
58 const GURL& requesting_frame, 58 const GURL& requesting_frame,
59 bool allowed) override; 59 bool allowed) override;
60 bool RestrictToSecureOrigins() const override;
60 61
61 // Returns whether "Protected content" is enabled based on factors other 62 // Returns whether "Protected content" is enabled based on factors other
62 // than the protected media identifier content setting itself. For example, 63 // than the protected media identifier content setting itself. For example,
63 // it can be disabled by a master switch in content settings, in incognito or 64 // it can be disabled by a master switch in content settings, in incognito or
64 // guest mode, or by the device policy. 65 // guest mode, or by the device policy.
65 bool IsProtectedMediaIdentifierEnabled() const; 66 bool IsProtectedMediaIdentifierEnabled() const;
66 67
68
ddorwin 2015/05/26 17:31:31 nit: extra line.
mlamouri (slow - plz ping) 2015/05/29 14:35:15 Done.
67 #if defined(OS_CHROMEOS) 69 #if defined(OS_CHROMEOS)
68 void OnPlatformVerificationConsentResponse( 70 void OnPlatformVerificationConsentResponse(
69 content::WebContents* web_contents, 71 content::WebContents* web_contents,
70 const PermissionRequestID& id, 72 const PermissionRequestID& id,
71 const GURL& requesting_origin, 73 const GURL& requesting_origin,
72 const GURL& embedding_origin, 74 const GURL& embedding_origin,
73 const BrowserPermissionCallback& callback, 75 const BrowserPermissionCallback& callback,
74 chromeos::attestation::PlatformVerificationDialog::ConsentResponse 76 chromeos::attestation::PlatformVerificationDialog::ConsentResponse
75 response); 77 response);
76 78
77 // |this| is shared among multiple WebContents, so we could receive multiple 79 // |this| is shared among multiple WebContents, so we could receive multiple
78 // permission requests. This map tracks all pending requests. Note that we 80 // permission requests. This map tracks all pending requests. Note that we
79 // only allow one request per WebContents. 81 // only allow one request per WebContents.
80 typedef std::map<content::WebContents*, 82 typedef std::map<content::WebContents*,
81 std::pair<views::Widget*, PermissionRequestID>> 83 std::pair<views::Widget*, PermissionRequestID>>
82 PendingRequestMap; 84 PendingRequestMap;
83 PendingRequestMap pending_requests_; 85 PendingRequestMap pending_requests_;
84 86
85 // Must be the last member, to ensure that it will be 87 // Must be the last member, to ensure that it will be
86 // destroyed first, which will invalidate weak pointers 88 // destroyed first, which will invalidate weak pointers
87 base::WeakPtrFactory<ProtectedMediaIdentifierPermissionContext> weak_factory_; 89 base::WeakPtrFactory<ProtectedMediaIdentifierPermissionContext> weak_factory_;
88 #endif 90 #endif
89 91
90 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext); 92 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext);
91 }; 93 };
92 94
93 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ 95 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698