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

Unified Diff: components/password_manager/core/browser/login_model.h

Issue 1421013003: [Merge in M47] Do not involve PasswordManagerDriver in filling HTTP-auth forms; also check realm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2526
Patch Set: Created 5 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: components/password_manager/core/browser/login_model.h
diff --git a/components/password_manager/core/browser/login_model.h b/components/password_manager/core/browser/login_model.h
index 04019261528429e0f8bcf26db67a5112d2e31dc3..612d45ae1226b5b82f2b0bc3a7c74cd3e7506a2a 100644
--- a/components/password_manager/core/browser/login_model.h
+++ b/components/password_manager/core/browser/login_model.h
@@ -5,34 +5,67 @@
#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_MODEL_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_MODEL_H_
+#include <string>
+
+#include "base/macros.h"
#include "base/strings/string16.h"
+#include "components/autofill/core/common/password_form.h"
namespace password_manager {
-// Simple Model & Observer interfaces for a LoginView to facilitate exchanging
-// information.
+// A base class for the http-auth UI to communicate with the provider of stored
+// credentials.
class LoginModelObserver {
public:
- // Called by the model when a username,password pair has been identified
- // as a match for the pending login prompt.
- virtual void OnAutofillDataAvailable(const base::string16& username,
- const base::string16& password) = 0;
+ LoginModelObserver();
+
+ // Called by the model when |credentials| has been identified as a match for
+ // the pending login prompt. Checks that the realm matches, and passes
+ // |credentials| to OnAutofillDataAvailableInternal.
+ void OnAutofillDataAvailable(const autofill::PasswordForm& credentials);
virtual void OnLoginModelDestroying() = 0;
+ // To be called by the model during AddObserverAndDeliverCredentials.
+ void set_signon_realm(const std::string& signon_realm) {
+ signon_realm_ = signon_realm;
+ }
+
protected:
- virtual ~LoginModelObserver() {}
+ virtual ~LoginModelObserver();
+
+ virtual void OnAutofillDataAvailableInternal(
+ const base::string16& username,
+ const base::string16& password) = 0;
+
+ private:
+ // Signon realm for which this observer wishes to receive credentials.
+ std::string signon_realm_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoginModelObserver);
};
+// Corresponding Model interface to be inherited by the provider of stored
+// passwords.
class LoginModel {
public:
- // Add an observer interested in the data from the model.
- virtual void AddObserver(LoginModelObserver* observer) = 0;
+ LoginModel();
+
+ // Add an observer interested in the data from the model. Also, requests that
+ // the model sends a callback to |observer| with stored credentials for
+ // |observed_form|.
+ virtual void AddObserverAndDeliverCredentials(
+ LoginModelObserver* observer,
+ const autofill::PasswordForm& observed_form) = 0;
+
// Remove an observer from the model.
virtual void RemoveObserver(LoginModelObserver* observer) = 0;
protected:
- virtual ~LoginModel() {}
+ virtual ~LoginModel();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LoginModel);
};
} // namespace password_manager
« no previous file with comments | « components/password_manager/core/browser/BUILD.gn ('k') | components/password_manager/core/browser/login_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698