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

Unified Diff: chrome/browser/chromeos/attestation/platform_verification_flow.h

Issue 31043008: Changed platform verification user consent logic to be per-domain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/attestation/platform_verification_flow.h
diff --git a/chrome/browser/chromeos/attestation/platform_verification_flow.h b/chrome/browser/chromeos/attestation/platform_verification_flow.h
index 64f36274649b2ccc83f0daca72071a6823745d3e..4758973d9f395cc54d5a6a054b15cb4861eaf4bc 100644
--- a/chrome/browser/chromeos/attestation/platform_verification_flow.h
+++ b/chrome/browser/chromeos/attestation/platform_verification_flow.h
@@ -55,17 +55,10 @@ class PlatformVerificationFlow {
POLICY_REJECTED, // The operation is not allowed by policy/settings.
};
- enum ConsentType {
- CONSENT_TYPE_NONE, // No consent necessary.
- CONSENT_TYPE_ATTESTATION, // Consent to use attestation.
- CONSENT_TYPE_ALWAYS, // Consent because 'Always Ask' was requested.
- };
-
enum ConsentResponse {
CONSENT_RESPONSE_NONE,
CONSENT_RESPONSE_ALLOW,
CONSENT_RESPONSE_DENY,
- CONSENT_RESPONSE_ALWAYS_ASK,
};
// An interface which allows settings and UI to be abstracted for testing
@@ -78,10 +71,9 @@ class PlatformVerificationFlow {
// consent request of the specified |type|.
typedef base::Callback<void(ConsentResponse response)> ConsentCallback;
- // Invokes consent UI of the given |type| within the context of
- // |web_contents| and calls |callback| when the user responds.
- virtual void ShowConsentPrompt(ConsentType type,
- content::WebContents* web_contents,
+ // Invokes consent UI within the context of |web_contents| and calls
+ // |callback| when the user responds.
+ virtual void ShowConsentPrompt(content::WebContents* web_contents,
const ConsentCallback& callback) = 0;
};
@@ -151,14 +143,15 @@ class PlatformVerificationFlow {
// A callback called when the user has given their consent response. All
// parameters are the same as in ChallengePlatformKey except for the
- // additional |consent_type| and |consent_response| which indicate the consent
- // type and user response, respectively. If the response indicates that the
- // operation should proceed, this method invokes a certificate request.
+ // additional |consent_required| and |consent_response| which indicate that
+ // user interaction was required and the user response, respectively. If the
+ // response indicates that the operation should proceed, this method invokes a
+ // certificate request.
void OnConsentResponse(content::WebContents* web_contents,
const std::string& service_id,
const std::string& challenge,
const ChallengeCallback& callback,
- ConsentType consent_type,
+ bool consent_required,
ConsentResponse consent_response);
// A callback called when an attestation certificate request operation
@@ -192,9 +185,10 @@ class PlatformVerificationFlow {
// If no prefs are associated with |web_contents| then NULL is returned.
PrefService* GetPrefs(content::WebContents* web_contents);
- // Gets the URL associated with the given |web_contents|. If a URL as been
- // set explicitly using set_testing_url(), then this value is always returned.
- const GURL& GetURL(content::WebContents* web_contents);
+ // Gets the web origin URL spec associated with |web_contents|. If a URL has
+ // been set explicitly using set_testing_url(), then this value is used
+ // instead. If the origin URL is not valid, the empty string is returned.
+ std::string GetURLSpec(content::WebContents* web_contents);
// Gets the user associated with the given |web_contents|. NULL may be
// returned. If |web_contents| is NULL (e.g. during testing), then the
@@ -205,18 +199,9 @@ class PlatformVerificationFlow {
// have attestation for content protection explicitly disabled.
bool IsAttestationEnabled(content::WebContents* web_contents);
- // Checks whether this is the first use on this device for the user associated
- // with |web_contents|.
- bool IsFirstUse(content::WebContents* web_contents);
-
- // Checks if settings indicate that consent is required for the web origin
- // represented by |web_contents| because the user requested to be prompted.
- bool IsAlwaysAskRequired(content::WebContents* web_contents);
-
// Updates user settings for the profile associated with |web_contents| based
// on the |consent_response| to the request of type |consent_type|.
bool UpdateSettings(content::WebContents* web_contents,
- ConsentType consent_type,
ConsentResponse consent_response);
// Finds the domain-specific consent pref for the domain associated with
@@ -224,13 +209,16 @@ class PlatformVerificationFlow {
// |pref_value| if it is not NULL.
//
// Precondition: A valid PrefService must be available via GetPrefs().
- bool GetDomainPref(content::WebContents* web_contents, bool* pref_value);
+ bool GetDomainPref(PrefService* pref_service,
+ const std::string& url_spec,
+ bool* pref_value);
// Records the domain-specific consent pref for the domain associated with
// |web_contents|. The pref will be set to |allow_domain|.
//
// Precondition: A valid PrefService must be available via GetPrefs().
- void RecordDomainConsent(content::WebContents* web_contents,
+ void RecordDomainConsent(PrefService* pref_service,
+ const std::string& url_spec,
bool allow_domain);
AttestationFlow* attestation_flow_;

Powered by Google App Engine
This is Rietveld 408576698