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 5750e341020a1aad74ca3e04a9e388d23e0b32fe..222287af937538d85338c3cfd471fc44c2f13d6f 100644 |
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc |
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc |
@@ -40,9 +40,11 @@ |
#include "chrome/browser/ui/sync/one_click_signin_histogram.h" |
#include "chrome/browser/ui/sync/one_click_signin_infobar_delegate.h" |
#include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
+#include "chrome/common/one_click_signin_messages.h" |
#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/chrome_version_info.h" |
+#include "chrome/common/net/url_util.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/common/url_constants.h" |
#include "content/public/browser/browser_thread.h" |
@@ -58,6 +60,7 @@ |
#include "grit/chromium_strings.h" |
#include "grit/generated_resources.h" |
#include "grit/theme_resources.h" |
+#include "ipc/ipc_message_macros.h" |
#include "net/base/url_util.h" |
#include "net/cookies/cookie_monster.h" |
#include "net/url_request/url_request.h" |
@@ -758,16 +761,29 @@ void OneClickSigninHelper::CleanTransientState() { |
base::Unretained(profile->GetResourceContext()))); |
} |
-void OneClickSigninHelper::DidNavigateAnyFrame( |
- const content::LoadCommittedDetails& details, |
- const content::FrameNavigateParams& params) { |
+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) { |
+ // |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. |
- const content::PasswordForm& form = params.password_form; |
if (form.origin.is_valid() && |
gaia::IsGaiaSignonRealm(GURL(form.signon_realm))) { |
VLOG(1) << "OneClickSigninHelper::DidNavigateAnyFrame: got password"; |
- password_ = UTF16ToUTF8(params.password_form.password_value); |
+ password_ = UTF16ToUTF8(form.password_value); |
} |
+ |
+ return true; |
} |
void OneClickSigninHelper::DidStopLoading( |
@@ -902,11 +918,13 @@ void OneClickSigninHelper::DidStopLoading( |
break; |
} |
- // If this explicit sign in is not from settings page, show the NTP after |
- // sign in completes. In the case of the settings page, it will get closed |
- // by SyncSetupHandler. |
+ // If this explicit sign in is not from settings page/webostre, show the NTP |
Charlie Reis
2013/02/01 19:40:50
nit: webstore
|
+ // after sign in completes. In the case of the settings page, it will get |
+ // closed by SyncSetupHandler. In the case of webstore, it will redirect back |
+ // to webstore. |
if (auto_accept_ == AUTO_ACCEPT_EXPLICIT && |
- source_ != SyncPromoUI::SOURCE_SETTINGS) { |
+ source_ != SyncPromoUI::SOURCE_SETTINGS && |
+ source_ != SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { |
signin_tracker_.reset(new SigninTracker(profile, this)); |
} |