| OLD | NEW |
| 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 Loading... |
| 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>> PendingRequestMap; |
| 76 PendingRequestMap pending_requests_; |
| 73 | 77 |
| 74 // Must be the last member, to ensure that it will be | 78 // Must be the last member, to ensure that it will be |
| 75 // destroyed first, which will invalidate weak pointers | 79 // destroyed first, which will invalidate weak pointers |
| 76 base::WeakPtrFactory<ProtectedMediaIdentifierPermissionContext> weak_factory_; | 80 base::WeakPtrFactory<ProtectedMediaIdentifierPermissionContext> weak_factory_; |
| 77 #endif | 81 #endif |
| 78 | 82 |
| 79 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext); | 83 DISALLOW_COPY_AND_ASSIGN(ProtectedMediaIdentifierPermissionContext); |
| 80 }; | 84 }; |
| 81 | 85 |
| 82 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ | 86 #endif // CHROME_BROWSER_MEDIA_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_CONTEXT_H_ |
| OLD | NEW |