Commit 1159e6f2 authored by marja@chromium.org's avatar marja@chromium.org

Tentatively revert 180083

Some autofill browser_tests on linux_chromeos are failing:

http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20%282%29/builds/11359

> [autofill] Hook the sign-in button up to required actions.
> 
> - Actually use the info we're getting from wallet to tell whether a user needs
>   to authenticate further (in this case only in a non-passive way).
> 
> - Add a DialogSignedInState to autofill_dialog_types.h.
> 
> - Add a DialogSignedInState SignedInState() to AutofillDialogController interface
>   and implements AutofillDialogControllerImpl.
> 
> - Adds a UpdateAccountChooser() to AutofillDialogView and implements in
>   AutofillDialogViews.
> 
> - Use SignedInState() from AutofillDialogViews.
> 
> BUG=157270,163508,171528
> R=isherman@chromium.org,sky@chromium.org
> 
> Review URL: https://chromiumcodereview.appspot.com/12094069

TBR=dbeam@chromium.org
Review URL: https://codereview.chromium.org/12091104

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180111 0039d316-1c4b-4281-b951-d872f2087c98
parent 8b75315a
......@@ -10902,9 +10902,6 @@ experiment id: "<ph name="EXPERIMENT_ID">$5<ex>ar1</ex></ph>"
<message name="IDS_AUTOFILL_DIALOG_SITE_WARNING" desc="Text that explains that user data will be sent to the site.">
The following details will be shared with <ph name="SITE">$1<ex>www.shopping.com</ex></ph>
</message>
<message name="IDS_AUTOFILL_DIALOG_VERIFY_CVV" desc="Text explaining that the user needs to enter their credit card's verification code before they can continue their transaction.">
For your security, please verify your card details.
</message>
<message name="IDS_AUTOFILL_DIALOG_SECTION_EMAIL" desc="Label for the email section of the imperative autofill dialog.">
Email address
</message>
......
......@@ -48,11 +48,6 @@ class AutofillDialogController {
virtual string16 SaveLocallyText() const = 0;
virtual string16 ProgressBarText() const = 0;
// State ---------------------------------------------------------------------
// Whether the user is known to be signed in.
virtual DialogSignedInState SignedInState() const = 0;
// Detail inputs -------------------------------------------------------------
// Returns the set of inputs the page has requested which fall under
......
......@@ -270,19 +270,6 @@ string16 AutofillDialogControllerImpl::CancelSignInText() const {
return string16(ASCIIToUTF16("Don't sign in."));
}
DialogSignedInState AutofillDialogControllerImpl::SignedInState() const {
if (!wallet_items_)
return REQUIRES_RESPONSE;
if (HasRequiredAction(wallet::GAIA_AUTH))
return REQUIRES_SIGN_IN;
if (HasRequiredAction(wallet::PASSIVE_GAIA_AUTH))
return REQUIRES_PASSIVE_SIGN_IN;
return SIGNED_IN;
}
string16 AutofillDialogControllerImpl::SaveLocallyText() const {
return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SAVE_LOCALLY_CHECKBOX);
}
......@@ -535,10 +522,37 @@ void AutofillDialogControllerImpl::UpdateProgressBar(double value) {
}
DialogNotification AutofillDialogControllerImpl::CurrentNotification() const {
if (HasRequiredAction(wallet::VERIFY_CVV)) {
return DialogNotification(
DialogNotification::REQUIRED_ACTION,
l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_VERIFY_CVV));
if (wallet_items_ && !wallet_items_->required_actions().empty()) {
switch (wallet_items_->required_actions()[0]) {
case wallet::UNKNOWN_TYPE:
NOTREACHED();
break;
// TODO(dbeam): da real i18nz.
case wallet::SETUP_WALLET:
return DialogNotification(DialogNotification::REQUIRED_ACTION,
ASCIIToUTF16("Set up da walletz"));
case wallet::ACCEPT_TOS:
return DialogNotification(DialogNotification::REQUIRED_ACTION,
ASCIIToUTF16("Accept da ToS"));
case wallet::GAIA_AUTH:
return DialogNotification(DialogNotification::REQUIRED_ACTION,
ASCIIToUTF16("Sign in to da Googlez"));
case wallet::UPDATE_EXPIRATION_DATE:
return DialogNotification(DialogNotification::REQUIRED_ACTION,
ASCIIToUTF16("Update da expiration datez"));
case wallet::UPGRADE_MIN_ADDRESS:
return DialogNotification(DialogNotification::REQUIRED_ACTION,
ASCIIToUTF16("Upgrade da min addrezz"));
case wallet::INVALID_FORM_FIELD:
return DialogNotification(DialogNotification::REQUIRED_ACTION,
ASCIIToUTF16("Da form field is invalid"));
case wallet::VERIFY_CVV:
return DialogNotification(DialogNotification::REQUIRED_ACTION,
ASCIIToUTF16("Verify da CVVz"));
case wallet::PASSIVE_GAIA_AUTH:
return DialogNotification(DialogNotification::REQUIRED_ACTION,
ASCIIToUTF16("Passively sign in to Googlez"));
}
}
if (RequestingCreditCardInfo() && !TransmissionWillBeSecure()) {
......@@ -631,13 +645,8 @@ void AutofillDialogControllerImpl::Observe(
DCHECK_EQ(type, content::NOTIFICATION_NAV_ENTRY_COMMITTED);
content::LoadCommittedDetails* load_details =
content::Details<content::LoadCommittedDetails>(details).ptr();
if (wallet::IsSignInContinueUrl(load_details->entry->GetVirtualURL())) {
if (wallet::IsSignInContinueUrl(load_details->entry->GetVirtualURL()))
EndSignInFlow();
// TODO(dbeam): the fetcher can't handle being called multiple times.
// Address this soon as we will be re-fetching wallet items after every
// required action is resolved.
wallet_client_.GetWalletItems(this);
}
}
////////////////////////////////////////////////////////////////////////////////
......@@ -676,7 +685,6 @@ void AutofillDialogControllerImpl::OnDidGetFullWallet(
void AutofillDialogControllerImpl::OnDidGetWalletItems(
scoped_ptr<wallet::WalletItems> wallet_items) {
wallet_items_ = wallet_items.Pass();
view_->UpdateAccountChooser();
view_->UpdateNotificationArea();
}
......@@ -744,16 +752,6 @@ bool AutofillDialogControllerImpl::TransmissionWillBeSecure() const {
!net::IsCertStatusMinorError(ssl_status_.cert_status);
}
bool AutofillDialogControllerImpl::HasRequiredAction(
wallet::RequiredAction action) const {
if (!wallet_items_)
return false;
const std::vector<wallet::RequiredAction>& actions =
wallet_items_->required_actions();
return std::find(actions.begin(), actions.end(), action) != actions.end();
}
void AutofillDialogControllerImpl::GenerateSuggestionsModels() {
PersonalDataManager* manager = GetManager();
const std::vector<CreditCard*>& cards = manager->credit_cards();
......
......@@ -69,7 +69,6 @@ class AutofillDialogControllerImpl : public AutofillDialogController,
virtual string16 SaveLocallyText() const OVERRIDE;
virtual string16 CancelSignInText() const OVERRIDE;
virtual string16 ProgressBarText() const OVERRIDE;
virtual DialogSignedInState SignedInState() const OVERRIDE;
virtual const DetailInputs& RequestedFieldsForSection(DialogSection section)
const OVERRIDE;
virtual ui::ComboboxModel* ComboboxModelForAutofillType(
......@@ -151,9 +150,6 @@ class AutofillDialogControllerImpl : public AutofillDialogController,
// to the requesting site.
bool TransmissionWillBeSecure() const;
// Convenience method to tell whether we need to address |action|.
bool HasRequiredAction(wallet::RequiredAction action) const;
// Initializes |suggested_email_| et al.
void GenerateSuggestionsModels();
......@@ -201,6 +197,10 @@ class AutofillDialogControllerImpl : public AutofillDialogController,
// Like RequestedFieldsForSection, but returns a pointer.
DetailInputs* MutableRequestedFieldsForSection(DialogSection section);
// Turns a required action into a notification.
DialogNotification RequiredActionNotification(
const std::vector<wallet::RequiredAction>& required_actions) const;
// Hides |popup_controller_|'s popup view, if it exists.
void HidePopup();
......
......@@ -77,13 +77,6 @@ class DialogNotification {
string16 display_text_;
};
enum DialogSignedInState {
REQUIRES_RESPONSE,
REQUIRES_SIGN_IN,
REQUIRES_PASSIVE_SIGN_IN,
SIGNED_IN,
};
typedef std::vector<DetailInput> DetailInputs;
typedef std::map<const DetailInput*, string16> DetailOutputMap;
......
......@@ -28,10 +28,6 @@ class AutofillDialogView {
// Called when a different notification is available.
virtual void UpdateNotificationArea() = 0;
// Called when account details may have changed (user logs in to GAIA, creates
// a new account, etc.).
virtual void UpdateAccountChooser() = 0;
// Called when the contents of a section have changed.
virtual void UpdateSection(DialogSection section) = 0;
......
......@@ -305,7 +305,6 @@ AutofillDialogViews::~AutofillDialogViews() {
void AutofillDialogViews::Show() {
InitChildViews();
UpdateAccountChooser();
UpdateNotificationArea();
// Ownership of |contents_| is handed off by this call. The
......@@ -602,21 +601,12 @@ views::View* AutofillDialogViews::CreateNotificationArea() {
notification_label_->SetAutoColorReadabilityEnabled(false);
notification_label_->SetMultiLine(true);
notification_label_->set_collapse_when_hidden(true);
notification_label_->set_border(
views::Border::CreateEmptyBorder(10, 0, 10, 0));
// TODO(dbeam): talk to msw@ or ainslie@ to make this border match the mocks.
notification_area->AddChildView(notification_label_);
return notification_area;
}
void AutofillDialogViews::UpdateAccountChooser() {
DialogSignedInState state = controller_->SignedInState();
sign_in_link_->SetEnabled(state != REQUIRES_RESPONSE);
sign_in_link_->SetVisible(state != SIGNED_IN);
}
void AutofillDialogViews::UpdateNotificationArea() {
DCHECK(notification_label_);
......
......@@ -64,7 +64,6 @@ class AutofillDialogViews : public AutofillDialogView,
// AutofillDialogView implementation:
virtual void Show() OVERRIDE;
virtual void Hide() OVERRIDE;
virtual void UpdateAccountChooser() OVERRIDE;
virtual void UpdateNotificationArea() OVERRIDE;
virtual void UpdateSection(DialogSection section) OVERRIDE;
virtual void GetUserInput(DialogSection section,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment