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

Side by Side Diff: chrome/browser/chromeos/attestation/platform_verification_flow.cc

Issue 881983003: media: Invoke PlatformVerificationDialog from ProtectedMediaIdentifierPermissionContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" 5 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 namespace attestation { 72 namespace attestation {
73 73
74 // A default implementation of the Delegate interface. 74 // A default implementation of the Delegate interface.
75 class DefaultDelegate : public PlatformVerificationFlow::Delegate { 75 class DefaultDelegate : public PlatformVerificationFlow::Delegate {
76 public: 76 public:
77 DefaultDelegate() {} 77 DefaultDelegate() {}
78 ~DefaultDelegate() override {} 78 ~DefaultDelegate() override {}
79 79
80 void ShowConsentPrompt( 80 void ShowConsentPrompt(
81 content::WebContents* web_contents, 81 content::WebContents* web_contents,
82 const GURL& requesting_origin,
82 const PlatformVerificationFlow::Delegate::ConsentCallback& callback) 83 const PlatformVerificationFlow::Delegate::ConsentCallback& callback)
83 override { 84 override {
84 PlatformVerificationDialog::ShowDialog(web_contents, callback); 85 PlatformVerificationDialog::ShowDialog(web_contents, requesting_origin,
86 callback);
85 } 87 }
86 88
87 PrefService* GetPrefs(content::WebContents* web_contents) override { 89 PrefService* GetPrefs(content::WebContents* web_contents) override {
88 return user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()); 90 return user_prefs::UserPrefs::Get(web_contents->GetBrowserContext());
89 } 91 }
90 92
91 const GURL& GetURL(content::WebContents* web_contents) override { 93 const GURL& GetURL(content::WebContents* web_contents) override {
92 const GURL& url = web_contents->GetLastCommittedURL(); 94 const GURL& url = web_contents->GetLastCommittedURL();
93 if (!url.is_valid()) 95 if (!url.is_valid())
94 return web_contents->GetVisibleURL(); 96 return web_contents->GetVisibleURL();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 !pref_service->GetBoolean(prefs::kRAConsentFirstTime) || 230 !pref_service->GetBoolean(prefs::kRAConsentFirstTime) ||
229 // Consent required if consent has never been given for this domain. 231 // Consent required if consent has never been given for this domain.
230 !GetDomainPref(delegate_->GetContentSettings(context.web_contents), 232 !GetDomainPref(delegate_->GetContentSettings(context.web_contents),
231 delegate_->GetURL(context.web_contents), 233 delegate_->GetURL(context.web_contents),
232 NULL)); 234 NULL));
233 Delegate::ConsentCallback consent_callback = base::Bind( 235 Delegate::ConsentCallback consent_callback = base::Bind(
234 &PlatformVerificationFlow::OnConsentResponse, 236 &PlatformVerificationFlow::OnConsentResponse,
235 this, 237 this,
236 context, 238 context,
237 consent_required); 239 consent_required);
238 if (consent_required) 240 if (consent_required) {
239 delegate_->ShowConsentPrompt(context.web_contents, consent_callback); 241 delegate_->ShowConsentPrompt(
240 else 242 context.web_contents,
243 context.web_contents->GetLastCommittedURL().GetOrigin(),
ddorwin 2015/02/05 02:23:24 This is the old path and will be removed when pref
xhwang 2015/02/05 02:49:34 Yes, this is not secure. But it'll be removed soon
244 consent_callback);
245 } else {
241 consent_callback.Run(CONSENT_RESPONSE_NONE); 246 consent_callback.Run(CONSENT_RESPONSE_NONE);
247 }
242 } 248 }
243 249
244 void PlatformVerificationFlow::RegisterProfilePrefs( 250 void PlatformVerificationFlow::RegisterProfilePrefs(
245 user_prefs::PrefRegistrySyncable* prefs) { 251 user_prefs::PrefRegistrySyncable* prefs) {
246 prefs->RegisterBooleanPref(prefs::kRAConsentFirstTime, 252 prefs->RegisterBooleanPref(prefs::kRAConsentFirstTime,
247 false, 253 false,
248 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 254 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
249 } 255 }
250 256
251 void PlatformVerificationFlow::OnConsentResponse( 257 void PlatformVerificationFlow::OnConsentResponse(
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 certificate.length())); 502 certificate.length()));
497 if (!x509.get() || x509->valid_expiry().is_null()) { 503 if (!x509.get() || x509->valid_expiry().is_null()) {
498 LOG(WARNING) << "Failed to parse certificate, cannot check expiry."; 504 LOG(WARNING) << "Failed to parse certificate, cannot check expiry.";
499 return false; 505 return false;
500 } 506 }
501 return (base::Time::Now() > x509->valid_expiry()); 507 return (base::Time::Now() > x509->valid_expiry());
502 } 508 }
503 509
504 } // namespace attestation 510 } // namespace attestation
505 } // namespace chromeos 511 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698