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 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" | 5 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" | 16 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" |
17 #include "chrome/browser/chromeos/attestation/attestation_signed_data.pb.h" | 17 #include "chrome/browser/chromeos/attestation/attestation_signed_data.pb.h" |
18 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
19 #include "chrome/browser/chromeos/settings/cros_settings.h" | 19 #include "chrome/browser/chromeos/settings/cros_settings.h" |
20 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 20 #include "chrome/browser/permissions/permission_context_base.h" |
21 #include "chrome/browser/media/protected_media_identifier_permission_context_fac tory.h" | 21 #include "chrome/browser/permissions/permission_manager.h" |
22 #include "chrome/browser/permissions/permission_manager_factory.h" | |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chromeos/attestation/attestation_flow.h" | 24 #include "chromeos/attestation/attestation_flow.h" |
24 #include "chromeos/chromeos_switches.h" | 25 #include "chromeos/chromeos_switches.h" |
25 #include "chromeos/cryptohome/async_method_caller.h" | 26 #include "chromeos/cryptohome/async_method_caller.h" |
26 #include "chromeos/cryptohome/cryptohome_parameters.h" | 27 #include "chromeos/cryptohome/cryptohome_parameters.h" |
27 #include "chromeos/dbus/cryptohome_client.h" | 28 #include "chromeos/dbus/cryptohome_client.h" |
28 #include "chromeos/dbus/dbus_thread_manager.h" | 29 #include "chromeos/dbus/dbus_thread_manager.h" |
29 #include "components/content_settings/core/browser/host_content_settings_map.h" | 30 #include "components/content_settings/core/browser/host_content_settings_map.h" |
30 #include "components/content_settings/core/common/content_settings_pattern.h" | 31 #include "components/content_settings/core/common/content_settings_pattern.h" |
31 #include "components/user_manager/user.h" | 32 #include "components/user_manager/user.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 return url; | 99 return url; |
99 } | 100 } |
100 | 101 |
101 const user_manager::User* GetUser( | 102 const user_manager::User* GetUser( |
102 content::WebContents* web_contents) override { | 103 content::WebContents* web_contents) override { |
103 return ProfileHelper::Get()->GetUserByProfile( | 104 return ProfileHelper::Get()->GetUserByProfile( |
104 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 105 Profile::FromBrowserContext(web_contents->GetBrowserContext())); |
105 } | 106 } |
106 | 107 |
107 bool IsPermittedByUser(content::WebContents* web_contents) override { | 108 bool IsPermittedByUser(content::WebContents* web_contents) override { |
108 ProtectedMediaIdentifierPermissionContext* permission_context = | 109 PermissionContextBase* permission_context = |
109 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( | 110 PermissionManagerFactory::GetForProfile( |
110 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 111 Profile::FromBrowserContext(web_contents->GetBrowserContext())) |
112 ->GetPermissionContext( | |
113 content::PermissionType::PROTECTED_MEDIA_IDENTIFIER); | |
mlamouri (slow - plz ping)
2016/04/11 14:06:05
I think you could greatly improve that by doing:
raymes
2016/04/12 07:44:54
Done. I considered this but wasn't sure whether to
| |
111 | 114 |
112 // TODO(xhwang): Using delegate_->GetURL() here is not right. The platform | 115 // TODO(xhwang): Using delegate_->GetURL() here is not right. The platform |
113 // verification may be requested by a frame from a different origin. This | 116 // verification may be requested by a frame from a different origin. This |
114 // will be solved when http://crbug.com/454847 is fixed. | 117 // will be solved when http://crbug.com/454847 is fixed. |
115 const GURL& requesting_origin = GetURL(web_contents).GetOrigin(); | 118 const GURL& requesting_origin = GetURL(web_contents).GetOrigin(); |
116 | 119 |
117 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); | 120 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); |
118 | 121 |
119 ContentSetting content_setting = permission_context->GetPermissionStatus( | 122 ContentSetting content_setting = permission_context->GetPermissionStatus( |
120 requesting_origin, embedding_origin); | 123 requesting_origin, embedding_origin); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 if (!operation_success) { | 425 if (!operation_success) { |
423 LOG(WARNING) << "PlatformVerificationFlow: Failed to renew platform " | 426 LOG(WARNING) << "PlatformVerificationFlow: Failed to renew platform " |
424 "certificate."; | 427 "certificate."; |
425 return; | 428 return; |
426 } | 429 } |
427 VLOG(1) << "Certificate successfully renewed."; | 430 VLOG(1) << "Certificate successfully renewed."; |
428 } | 431 } |
429 | 432 |
430 } // namespace attestation | 433 } // namespace attestation |
431 } // namespace chromeos | 434 } // namespace chromeos |
OLD | NEW |