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

Unified Diff: chrome/browser/ui/sync/one_click_signin_helper.cc

Issue 19705013: [password autofill] Remove references to PasswordForm from RenderViewImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 years, 5 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/ui/sync/one_click_signin_helper.cc
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc
index 4c001eedb943e4842acd6c687fdbabe67cf66d3f..37e45a1882d7724f62f3357a758f0da95a36eda7 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc
@@ -53,7 +53,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/net/url_util.h"
-#include "chrome/common/one_click_signin_messages.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
@@ -551,7 +550,8 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(OneClickSigninHelper);
// static
const int OneClickSigninHelper::kMaxNavigationsSince = 10;
-OneClickSigninHelper::OneClickSigninHelper(content::WebContents* web_contents)
+OneClickSigninHelper::OneClickSigninHelper(content::WebContents* web_contents,
+ PasswordManager* password_manager)
: content::WebContentsObserver(web_contents),
showing_signin_(false),
auto_accept_(AUTO_ACCEPT_NONE),
@@ -561,6 +561,8 @@ OneClickSigninHelper::OneClickSigninHelper(content::WebContents* web_contents)
untrusted_navigations_since_signin_visit_(0),
untrusted_confirmation_required_(false),
do_not_clear_pending_email_(false) {
+ if (password_manager)
+ password_manager->AddSubmissionObserver(this);
}
OneClickSigninHelper::~OneClickSigninHelper() {
@@ -576,6 +578,16 @@ OneClickSigninHelper::~OneClickSigninHelper() {
}
// static
+void OneClickSigninHelper::CreateForWebContentsWithPasswordManager(
+ content::WebContents* contents,
+ PasswordManager* password_manager) {
+ if (!FromWebContents(contents)) {
+ contents->SetUserData(UserDataKey(),
+ new OneClickSigninHelper(contents, password_manager));
+ }
+}
+
+// static
bool OneClickSigninHelper::CanOffer(content::WebContents* web_contents,
CanOfferFor can_offer_for,
const std::string& email,
@@ -985,29 +997,17 @@ void OneClickSigninHelper::CleanTransientState() {
}
}
-bool OneClickSigninHelper::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(OneClickSigninHelper, message)
- IPC_MESSAGE_HANDLER(OneClickSigninHostMsg_FormSubmitted, OnFormSubmitted)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
-
- return handled;
-}
-
-bool OneClickSigninHelper::OnFormSubmitted(const content::PasswordForm& form) {
+void OneClickSigninHelper::PasswordSubmitted(
+ const content::PasswordForm& form) {
// |password_| used to be set in DidNavigateAnyFrame, this is too late because
// it is not executed until the end of redirect chains and password may
// get lost if one of the redirects requires context swap.
// We only need to scrape the password for Gaia logins.
- if (form.origin.is_valid() &&
- gaia::IsGaiaSignonRealm(GURL(form.signon_realm))) {
+ if (gaia::IsGaiaSignonRealm(GURL(form.signon_realm))) {
VLOG(1) << "OneClickSigninHelper::DidNavigateAnyFrame: got password";
password_ = UTF16ToUTF8(form.password_value);
}
-
- return true;
}
void OneClickSigninHelper::SetDoNotClearPendingEmailForTesting() {

Powered by Google App Engine
This is Rietveld 408576698