| 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_macros.h" | 13 #include "base/metrics/histogram_macros.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/profiles/profile_helper.h" | 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 18 #include "chrome/browser/chromeos/settings/cros_settings.h" | 18 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 19 #include "chrome/browser/permissions/permission_manager.h" | 19 #include "chrome/browser/permissions/permission_manager.h" |
| 20 #include "chrome/browser/permissions/permission_result.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chromeos/attestation/attestation.pb.h" | 22 #include "chromeos/attestation/attestation.pb.h" |
| 22 #include "chromeos/attestation/attestation_flow.h" | 23 #include "chromeos/attestation/attestation_flow.h" |
| 23 #include "chromeos/chromeos_switches.h" | 24 #include "chromeos/chromeos_switches.h" |
| 24 #include "chromeos/cryptohome/async_method_caller.h" | 25 #include "chromeos/cryptohome/async_method_caller.h" |
| 25 #include "chromeos/cryptohome/cryptohome_parameters.h" | 26 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 26 #include "chromeos/dbus/cryptohome_client.h" | 27 #include "chromeos/dbus/cryptohome_client.h" |
| 27 #include "chromeos/dbus/dbus_thread_manager.h" | 28 #include "chromeos/dbus/dbus_thread_manager.h" |
| 28 #include "components/content_settings/core/browser/host_content_settings_map.h" | 29 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 29 #include "components/content_settings/core/common/content_settings_pattern.h" | 30 #include "components/content_settings/core/common/content_settings_pattern.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 106 Profile::FromBrowserContext(web_contents->GetBrowserContext())); |
| 106 } | 107 } |
| 107 | 108 |
| 108 bool IsPermittedByUser(content::WebContents* web_contents) override { | 109 bool IsPermittedByUser(content::WebContents* web_contents) override { |
| 109 // TODO(xhwang): Using delegate_->GetURL() here is not right. The platform | 110 // TODO(xhwang): Using delegate_->GetURL() here is not right. The platform |
| 110 // verification may be requested by a frame from a different origin. This | 111 // verification may be requested by a frame from a different origin. This |
| 111 // will be solved when http://crbug.com/454847 is fixed. | 112 // will be solved when http://crbug.com/454847 is fixed. |
| 112 const GURL& requesting_origin = GetURL(web_contents).GetOrigin(); | 113 const GURL& requesting_origin = GetURL(web_contents).GetOrigin(); |
| 113 | 114 |
| 114 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); | 115 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); |
| 115 blink::mojom::PermissionStatus status = | 116 ContentSetting content_setting = |
| 116 PermissionManager::Get( | 117 PermissionManager::Get( |
| 117 Profile::FromBrowserContext(web_contents->GetBrowserContext())) | 118 Profile::FromBrowserContext(web_contents->GetBrowserContext())) |
| 118 ->GetPermissionStatus( | 119 ->GetPermissionStatus( |
| 119 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, | 120 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, |
| 120 requesting_origin, embedding_origin); | 121 requesting_origin, embedding_origin) |
| 122 .content_setting; |
| 121 | 123 |
| 122 return status == blink::mojom::PermissionStatus::GRANTED; | 124 return content_setting == CONTENT_SETTING_ALLOW; |
| 123 } | 125 } |
| 124 | 126 |
| 125 bool IsInSupportedMode(content::WebContents* web_contents) override { | 127 bool IsInSupportedMode(content::WebContents* web_contents) override { |
| 126 Profile* profile = | 128 Profile* profile = |
| 127 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 129 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 128 if (profile->IsOffTheRecord() || profile->IsGuestSession()) | 130 if (profile->IsOffTheRecord() || profile->IsGuestSession()) |
| 129 return false; | 131 return false; |
| 130 | 132 |
| 131 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 133 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 132 return !command_line->HasSwitch(chromeos::switches::kSystemDevMode) || | 134 return !command_line->HasSwitch(chromeos::switches::kSystemDevMode) || |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (!operation_success) { | 430 if (!operation_success) { |
| 429 LOG(WARNING) << "PlatformVerificationFlow: Failed to renew platform " | 431 LOG(WARNING) << "PlatformVerificationFlow: Failed to renew platform " |
| 430 "certificate."; | 432 "certificate."; |
| 431 return; | 433 return; |
| 432 } | 434 } |
| 433 VLOG(1) << "Certificate successfully renewed."; | 435 VLOG(1) << "Certificate successfully renewed."; |
| 434 } | 436 } |
| 435 | 437 |
| 436 } // namespace attestation | 438 } // namespace attestation |
| 437 } // namespace chromeos | 439 } // namespace chromeos |
| OLD | NEW |