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 "platform_verification_flow.h" | 5 #include "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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual ~DefaultDelegate() {} | 78 virtual ~DefaultDelegate() {} |
79 | 79 |
80 virtual void ShowConsentPrompt( | 80 virtual void ShowConsentPrompt( |
81 content::WebContents* web_contents, | 81 content::WebContents* web_contents, |
82 const PlatformVerificationFlow::Delegate::ConsentCallback& callback) | 82 const PlatformVerificationFlow::Delegate::ConsentCallback& callback) |
83 OVERRIDE { | 83 override { |
84 PlatformVerificationDialog::ShowDialog(web_contents, callback); | 84 PlatformVerificationDialog::ShowDialog(web_contents, callback); |
85 } | 85 } |
86 | 86 |
87 virtual PrefService* GetPrefs(content::WebContents* web_contents) OVERRIDE { | 87 virtual PrefService* GetPrefs(content::WebContents* web_contents) override { |
88 return user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()); | 88 return user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()); |
89 } | 89 } |
90 | 90 |
91 virtual const GURL& GetURL(content::WebContents* web_contents) OVERRIDE { | 91 virtual const GURL& GetURL(content::WebContents* web_contents) override { |
92 const GURL& url = web_contents->GetLastCommittedURL(); | 92 const GURL& url = web_contents->GetLastCommittedURL(); |
93 if (!url.is_valid()) | 93 if (!url.is_valid()) |
94 return web_contents->GetVisibleURL(); | 94 return web_contents->GetVisibleURL(); |
95 return url; | 95 return url; |
96 } | 96 } |
97 | 97 |
98 virtual user_manager::User* GetUser( | 98 virtual user_manager::User* GetUser( |
99 content::WebContents* web_contents) OVERRIDE { | 99 content::WebContents* web_contents) override { |
100 return ProfileHelper::Get()->GetUserByProfile( | 100 return ProfileHelper::Get()->GetUserByProfile( |
101 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 101 Profile::FromBrowserContext(web_contents->GetBrowserContext())); |
102 } | 102 } |
103 | 103 |
104 virtual HostContentSettingsMap* GetContentSettings( | 104 virtual HostContentSettingsMap* GetContentSettings( |
105 content::WebContents* web_contents) OVERRIDE { | 105 content::WebContents* web_contents) override { |
106 return Profile::FromBrowserContext(web_contents->GetBrowserContext())-> | 106 return Profile::FromBrowserContext(web_contents->GetBrowserContext())-> |
107 GetHostContentSettingsMap(); | 107 GetHostContentSettingsMap(); |
108 } | 108 } |
109 | 109 |
110 virtual bool IsGuestOrIncognito(content::WebContents* web_contents) OVERRIDE { | 110 virtual bool IsGuestOrIncognito(content::WebContents* web_contents) override { |
111 Profile* profile = | 111 Profile* profile = |
112 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 112 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
113 return (profile->IsOffTheRecord() || profile->IsGuestSession()); | 113 return (profile->IsOffTheRecord() || profile->IsGuestSession()); |
114 } | 114 } |
115 | 115 |
116 private: | 116 private: |
117 DISALLOW_COPY_AND_ASSIGN(DefaultDelegate); | 117 DISALLOW_COPY_AND_ASSIGN(DefaultDelegate); |
118 }; | 118 }; |
119 | 119 |
120 PlatformVerificationFlow::ChallengeContext::ChallengeContext( | 120 PlatformVerificationFlow::ChallengeContext::ChallengeContext( |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 certificate.length())); | 497 certificate.length())); |
498 if (!x509.get() || x509->valid_expiry().is_null()) { | 498 if (!x509.get() || x509->valid_expiry().is_null()) { |
499 LOG(WARNING) << "Failed to parse certificate, cannot check expiry."; | 499 LOG(WARNING) << "Failed to parse certificate, cannot check expiry."; |
500 return false; | 500 return false; |
501 } | 501 } |
502 return (base::Time::Now() > x509->valid_expiry()); | 502 return (base::Time::Now() > x509->valid_expiry()); |
503 } | 503 } |
504 | 504 |
505 } // namespace attestation | 505 } // namespace attestation |
506 } // namespace chromeos | 506 } // namespace chromeos |
OLD | NEW |