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

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

Issue 898003002: [Cleanup] Const-correct the profile() method for the EasyUnlockService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()); 90 return user_prefs::UserPrefs::Get(web_contents->GetBrowserContext());
91 } 91 }
92 92
93 const GURL& GetURL(content::WebContents* web_contents) override { 93 const GURL& GetURL(content::WebContents* web_contents) override {
94 const GURL& url = web_contents->GetLastCommittedURL(); 94 const GURL& url = web_contents->GetLastCommittedURL();
95 if (!url.is_valid()) 95 if (!url.is_valid())
96 return web_contents->GetVisibleURL(); 96 return web_contents->GetVisibleURL();
97 return url; 97 return url;
98 } 98 }
99 99
100 user_manager::User* GetUser(content::WebContents* web_contents) override { 100 const user_manager::User* GetUser(
101 content::WebContents* web_contents) override {
101 return ProfileHelper::Get()->GetUserByProfile( 102 return ProfileHelper::Get()->GetUserByProfile(
102 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 103 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
103 } 104 }
104 105
105 HostContentSettingsMap* GetContentSettings( 106 HostContentSettingsMap* GetContentSettings(
106 content::WebContents* web_contents) override { 107 content::WebContents* web_contents) override {
107 return Profile::FromBrowserContext(web_contents->GetBrowserContext())-> 108 return Profile::FromBrowserContext(web_contents->GetBrowserContext())->
108 GetHostContentSettingsMap(); 109 GetHostContentSettingsMap();
109 } 110 }
110 111
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return; 280 return;
280 } else if (consent_response == CONSENT_RESPONSE_ALLOW) { 281 } else if (consent_response == CONSENT_RESPONSE_ALLOW) {
281 content::RecordAction( 282 content::RecordAction(
282 base::UserMetricsAction("PlatformVerificationAccepted")); 283 base::UserMetricsAction("PlatformVerificationAccepted"));
283 VLOG(1) << "Platform verification accepted by user."; 284 VLOG(1) << "Platform verification accepted by user.";
284 } 285 }
285 } 286 }
286 287
287 // At this point all user interaction is complete and we can proceed with the 288 // At this point all user interaction is complete and we can proceed with the
288 // certificate request. 289 // certificate request.
289 user_manager::User* user = delegate_->GetUser(context.web_contents); 290 const user_manager::User* user = delegate_->GetUser(context.web_contents);
290 if (!user) { 291 if (!user) {
291 ReportError(context.callback, INTERNAL_ERROR); 292 ReportError(context.callback, INTERNAL_ERROR);
292 LOG(ERROR) << "Profile does not map to a valid user."; 293 LOG(ERROR) << "Profile does not map to a valid user.";
293 return; 294 return;
294 } 295 }
295 296
296 GetCertificate(context, user->email(), false /* Don't force a new key */); 297 GetCertificate(context, user->email(), false /* Don't force a new key */);
297 } 298 }
298 299
299 void PlatformVerificationFlow::GetCertificate(const ChallengeContext& context, 300 void PlatformVerificationFlow::GetCertificate(const ChallengeContext& context,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 certificate.length())); 505 certificate.length()));
505 if (!x509.get() || x509->valid_expiry().is_null()) { 506 if (!x509.get() || x509->valid_expiry().is_null()) {
506 LOG(WARNING) << "Failed to parse certificate, cannot check expiry."; 507 LOG(WARNING) << "Failed to parse certificate, cannot check expiry.";
507 return false; 508 return false;
508 } 509 }
509 return (base::Time::Now() > x509->valid_expiry()); 510 return (base::Time::Now() > x509->valid_expiry());
510 } 511 }
511 512
512 } // namespace attestation 513 } // namespace attestation
513 } // namespace chromeos 514 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698