| 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 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 namespace user_prefs { | 26 namespace user_prefs { |
| 27 class PrefRegistrySyncable; | 27 class PrefRegistrySyncable; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace chromeos { | 30 namespace chromeos { |
| 31 | 31 |
| 32 class CryptohomeClient; | 32 class CryptohomeClient; |
| 33 class UserManager; | 33 class UserManager; |
| 34 | 34 |
| 35 namespace system { | |
| 36 class StatisticsProvider; | |
| 37 } | |
| 38 | |
| 39 namespace attestation { | 35 namespace attestation { |
| 40 | 36 |
| 41 class AttestationFlow; | 37 class AttestationFlow; |
| 42 | 38 |
| 43 // This class allows platform verification for the content protection use case. | 39 // This class allows platform verification for the content protection use case. |
| 44 // All methods must only be called on the UI thread. Example: | 40 // All methods must only be called on the UI thread. Example: |
| 45 // PlatformVerificationFlow verifier; | 41 // PlatformVerificationFlow verifier; |
| 46 // PlatformVerificationFlow::Callback callback = base::Bind(&MyCallback); | 42 // PlatformVerificationFlow::Callback callback = base::Bind(&MyCallback); |
| 47 // verifier.ChallengePlatformKey(my_web_contents, "my_id", "some_challenge", | 43 // verifier.ChallengePlatformKey(my_web_contents, "my_id", "some_challenge", |
| 48 // callback); | 44 // callback); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // A constructor that uses the default implementation of all dependencies | 101 // A constructor that uses the default implementation of all dependencies |
| 106 // including Delegate. | 102 // including Delegate. |
| 107 PlatformVerificationFlow(); | 103 PlatformVerificationFlow(); |
| 108 | 104 |
| 109 // An alternate constructor which specifies dependent objects explicitly. | 105 // An alternate constructor which specifies dependent objects explicitly. |
| 110 // This is useful in testing. The caller retains ownership of all pointers. | 106 // This is useful in testing. The caller retains ownership of all pointers. |
| 111 PlatformVerificationFlow(AttestationFlow* attestation_flow, | 107 PlatformVerificationFlow(AttestationFlow* attestation_flow, |
| 112 cryptohome::AsyncMethodCaller* async_caller, | 108 cryptohome::AsyncMethodCaller* async_caller, |
| 113 CryptohomeClient* cryptohome_client, | 109 CryptohomeClient* cryptohome_client, |
| 114 UserManager* user_manager, | 110 UserManager* user_manager, |
| 115 system::StatisticsProvider* statistics_provider, | |
| 116 Delegate* delegate); | 111 Delegate* delegate); |
| 117 | 112 |
| 118 virtual ~PlatformVerificationFlow(); | 113 virtual ~PlatformVerificationFlow(); |
| 119 | 114 |
| 120 // Invokes an asynchronous operation to challenge a platform key. Any user | 115 // Invokes an asynchronous operation to challenge a platform key. Any user |
| 121 // interaction will be associated with |web_contents|. The |service_id| is an | 116 // interaction will be associated with |web_contents|. The |service_id| is an |
| 122 // arbitrary value but it should uniquely identify the origin of the request | 117 // arbitrary value but it should uniquely identify the origin of the request |
| 123 // and should not be determined by that origin; its purpose is to prevent | 118 // and should not be determined by that origin; its purpose is to prevent |
| 124 // collusion between multiple services. The |challenge| is also an arbitrary | 119 // collusion between multiple services. The |challenge| is also an arbitrary |
| 125 // value but it should be time sensitive or associated to some kind of session | 120 // value but it should be time sensitive or associated to some kind of session |
| 126 // because its purpose is to prevent certificate replay. The |callback| will | 121 // because its purpose is to prevent certificate replay. The |callback| will |
| 127 // be called when the operation completes. The duration of the operation can | 122 // be called when the operation completes. The duration of the operation can |
| 128 // vary depending on system state, hardware capabilities, and interaction with | 123 // vary depending on system state, hardware capabilities, and interaction with |
| 129 // the user. | 124 // the user. |
| 130 void ChallengePlatformKey(content::WebContents* web_contents, | 125 void ChallengePlatformKey(content::WebContents* web_contents, |
| 131 const std::string& service_id, | 126 const std::string& service_id, |
| 132 const std::string& challenge, | 127 const std::string& challenge, |
| 133 const ChallengeCallback& callback); | 128 const ChallengeCallback& callback); |
| 134 | 129 |
| 135 // Performs a quick check to see if platform verification is reasonably | |
| 136 // expected to succeed. The result of the check will be sent to the given | |
| 137 // |callback|. If the |result| is true, then platform verification is | |
| 138 // expected to succeed. However, this result is not authoritative either true | |
| 139 // or false. If an error occurs, |result| will be false. | |
| 140 void CheckPlatformState(const base::Callback<void(bool result)>& callback); | |
| 141 | |
| 142 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* prefs); | 130 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* prefs); |
| 143 | 131 |
| 144 void set_testing_prefs(PrefService* testing_prefs) { | 132 void set_testing_prefs(PrefService* testing_prefs) { |
| 145 testing_prefs_ = testing_prefs; | 133 testing_prefs_ = testing_prefs; |
| 146 } | 134 } |
| 147 | 135 |
| 148 void set_testing_url(const GURL& testing_url) { | 136 void set_testing_url(const GURL& testing_url) { |
| 149 testing_url_ = testing_url; | 137 testing_url_ = testing_url; |
| 150 } | 138 } |
| 151 | 139 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // | 223 // |
| 236 // Precondition: A valid PrefService must be available via GetPrefs(). | 224 // Precondition: A valid PrefService must be available via GetPrefs(). |
| 237 void RecordDomainConsent(content::WebContents* web_contents, | 225 void RecordDomainConsent(content::WebContents* web_contents, |
| 238 bool allow_domain); | 226 bool allow_domain); |
| 239 | 227 |
| 240 AttestationFlow* attestation_flow_; | 228 AttestationFlow* attestation_flow_; |
| 241 scoped_ptr<AttestationFlow> default_attestation_flow_; | 229 scoped_ptr<AttestationFlow> default_attestation_flow_; |
| 242 cryptohome::AsyncMethodCaller* async_caller_; | 230 cryptohome::AsyncMethodCaller* async_caller_; |
| 243 CryptohomeClient* cryptohome_client_; | 231 CryptohomeClient* cryptohome_client_; |
| 244 UserManager* user_manager_; | 232 UserManager* user_manager_; |
| 245 system::StatisticsProvider* statistics_provider_; | |
| 246 Delegate* delegate_; | 233 Delegate* delegate_; |
| 247 scoped_ptr<Delegate> default_delegate_; | 234 scoped_ptr<Delegate> default_delegate_; |
| 248 PrefService* testing_prefs_; | 235 PrefService* testing_prefs_; |
| 249 GURL testing_url_; | 236 GURL testing_url_; |
| 250 | 237 |
| 251 // Note: This should remain the last member so it'll be destroyed and | 238 // Note: This should remain the last member so it'll be destroyed and |
| 252 // invalidate the weak pointers before any other members are destroyed. | 239 // invalidate the weak pointers before any other members are destroyed. |
| 253 base::WeakPtrFactory<PlatformVerificationFlow> weak_factory_; | 240 base::WeakPtrFactory<PlatformVerificationFlow> weak_factory_; |
| 254 | 241 |
| 255 DISALLOW_COPY_AND_ASSIGN(PlatformVerificationFlow); | 242 DISALLOW_COPY_AND_ASSIGN(PlatformVerificationFlow); |
| 256 }; | 243 }; |
| 257 | 244 |
| 258 } // namespace attestation | 245 } // namespace attestation |
| 259 } // namespace chromeos | 246 } // namespace chromeos |
| 260 | 247 |
| 261 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ | 248 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ |
| OLD | NEW |