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

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

Issue 903873002: media: Support simultaneous permission requests from multiple WebContents in ProtectedMediaIdentifi… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed 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
« no previous file with comments | « no previous file | chrome/browser/media/protected_media_identifier_permission_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #if defined(OS_CHROMEOS) 11 #if defined(OS_CHROMEOS)
12 #include <map>
13
12 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h" 15 #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h"
14 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" 16 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h"
15 #endif 17 #endif
16 18
17 class Profile; 19 class Profile;
18 20
19 namespace views { 21 namespace views {
20 class Widget; 22 class Widget;
21 } 23 }
(...skipping 29 matching lines...) Expand all
51 void UpdateTabContext(const PermissionRequestID& id, 53 void UpdateTabContext(const PermissionRequestID& id,
52 const GURL& requesting_frame, 54 const GURL& requesting_frame,
53 bool allowed) override; 55 bool allowed) override;
54 56
55 // Returns whether "Protected content" is enabled. It can be disabled by a 57 // Returns whether "Protected content" is enabled. It can be disabled by a
56 // user in the master switch in content settings, or by the device policy. 58 // user in the master switch in content settings, or by the device policy.
57 bool IsProtectedMediaIdentifierEnabled() const; 59 bool IsProtectedMediaIdentifierEnabled() const;
58 60
59 #if defined(OS_CHROMEOS) 61 #if defined(OS_CHROMEOS)
60 void OnPlatformVerificationResult( 62 void OnPlatformVerificationResult(
63 content::WebContents* web_contents,
61 const PermissionRequestID& id, 64 const PermissionRequestID& id,
62 const GURL& requesting_origin, 65 const GURL& requesting_origin,
63 const GURL& embedding_origin, 66 const GURL& embedding_origin,
64 const BrowserPermissionCallback& callback, 67 const BrowserPermissionCallback& callback,
65 chromeos::attestation::PlatformVerificationFlow::ConsentResponse 68 chromeos::attestation::PlatformVerificationFlow::ConsentResponse
66 response); 69 response);
67 70
68 // ID for the pending permission request. Invalid when no request is pending, 71 // |this| is shared among multiple WebContents, so we could receive multiple
69 // or the request has been canceled. 72 // permission requests. This map tracks all pending requests. Note that we
70 PermissionRequestID pending_id_; 73 // only allow one request per WebContents.
71 74 typedef std::map<content::WebContents*,
72 views::Widget* widget_; 75 std::pair<views::Widget*, PermissionRequestID>>
76 PendingRequestMap;
77 PendingRequestMap pending_requests_;
73 78
74 // Must be the last member, to ensure that it will be 79 // Must be the last member, to ensure that it will be
75 // destroyed first, which will invalidate weak pointers 80 // destroyed first, which will invalidate weak pointers
76 base::WeakPtrFactory<ProtectedMediaIdentifierPermissionContext> weak_factory_; 81 base::WeakPtrFactory<ProtectedMediaIdentifierPermissionContext> weak_factory_;
77 #endif 82 #endif
78 83
79 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext); 84 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext);
80 }; 85 };
81 86
82 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ 87 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/protected_media_identifier_permission_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698