Chromium Code Reviews| 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 5ee7a1af773297d1686ca7169beeca8c3b48def5..5e59257e41079033aef8bf06373d3e20f17f9948 100644 |
| --- a/chrome/browser/ui/sync/one_click_signin_helper.cc |
| +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc |
| @@ -40,6 +40,7 @@ |
| #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" |
| @@ -59,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/cookies/cookie_monster.h" |
| #include "net/url_request/url_request.h" |
| #include "ui/base/l10n/l10n_util.h" |
| @@ -757,16 +759,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; |
|
Roger Tawa OOO till Jul 10th
2013/01/31 13:27:16
If a message is not handled here, should the base
guohui
2013/01/31 16:44:02
The base class WebContentsObserver just returns fa
|
| +} |
| + |
| +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( |
| @@ -901,11 +916,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 |
| + // 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)); |
| } |