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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 12225095: Interactive autofill: Adds footnote view to accept legal documents in the UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 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/autofill/autofill_dialog_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index 0f687368e28d1f41b877715f4ed5d7108d737e58..58d6349862d577cdb63693890bfee9053f3c3e69 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -21,6 +21,8 @@
#include "chrome/browser/autofill/wallet/wallet_service_url.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/common/form_data.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
@@ -34,6 +36,7 @@
#include "net/base/cert_status_flags.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/base/window_open_disposition.h"
namespace autofill {
@@ -270,6 +273,57 @@ string16 AutofillDialogControllerImpl::CancelSignInText() const {
return string16(ASCIIToUTF16("Don't sign in."));
}
+string16 AutofillDialogControllerImpl::SaveLocallyText() const {
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SAVE_LOCALLY_CHECKBOX);
+}
+
+string16 AutofillDialogControllerImpl::ProgressBarText() const {
+ return l10n_util::GetStringUTF16(
+ IDS_AUTOFILL_DIALOG_AUTOCHECKOUT_PROGRESS_BAR);
+}
+
+std::vector<string16> AutofillDialogControllerImpl::FootnoteLinkParts() const {
+ if (!wallet_items_ || wallet_items_->legal_documents().empty())
+ return std::vector<string16>();
+
+ const std::vector<wallet::WalletItems::LegalDocument*>& documents =
+ wallet_items_->legal_documents();
+ DCHECK_LE(documents.size(), 2U);
+
+ const bool new_user = HasRequiredAction(wallet::SETUP_WALLET);
+
+ string16 text;
+ switch (documents.size()) {
+ case 1U:
+ text = l10n_util::GetStringFUTF16(
+ new_user ? IDS_AUTOFILL_DIALOG_LEGAL_LINKS_NEW_2 :
+ IDS_AUTOFILL_DIALOG_LEGAL_LINKS_UPDATED_2,
+ documents[0]->display_name(),
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PRIVACY_NOTICE));
+ break;
+ case 2U:
+ text = l10n_util::GetStringFUTF16(
+ new_user ? IDS_AUTOFILL_DIALOG_LEGAL_LINKS_NEW_3 :
+ IDS_AUTOFILL_DIALOG_LEGAL_LINKS_UPDATED_3,
+ documents[0]->display_name(),
+ documents[1]->display_name(),
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PRIVACY_NOTICE));
+ break;
+ }
+ TrimWhitespace(text, TRIM_ALL, &text);
+
+ std::vector<string16> parts;
+ base::SplitStringDontTrim(text, '|', &parts);
+ DCHECK_EQ(1U, parts.size() % 2);
+
+ return parts;
+}
+
+string16 AutofillDialogControllerImpl::AcceptFootnoteLinksText() const {
+ return l10n_util::GetStringUTF16(HasRequiredAction(wallet::SETUP_WALLET) ?
+ IDS_AUTOFILL_DIALOG_ACCEPT_NEW : IDS_AUTOFILL_DIALOG_ACCEPT_UPDATE);
+}
+
DialogSignedInState AutofillDialogControllerImpl::SignedInState() const {
if (!wallet_items_)
return REQUIRES_RESPONSE;
@@ -283,13 +337,27 @@ DialogSignedInState AutofillDialogControllerImpl::SignedInState() const {
return SIGNED_IN;
}
-string16 AutofillDialogControllerImpl::SaveLocallyText() const {
- return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SAVE_LOCALLY_CHECKBOX);
-}
+DialogNotification AutofillDialogControllerImpl::CurrentNotification() const {
+ if (HasRequiredAction(wallet::VERIFY_CVV)) {
+ return DialogNotification(
+ DialogNotification::REQUIRED_ACTION,
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_VERIFY_CVV));
+ }
-string16 AutofillDialogControllerImpl::ProgressBarText() const {
- return l10n_util::GetStringUTF16(
- IDS_AUTOFILL_DIALOG_AUTOCHECKOUT_PROGRESS_BAR);
+ if (RequestingCreditCardInfo() && !TransmissionWillBeSecure()) {
+ return DialogNotification(
+ DialogNotification::SECURITY_WARNING,
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECURITY_WARNING));
+ }
+
+ if (!invoked_from_same_origin_) {
+ return DialogNotification(
+ DialogNotification::SECURITY_WARNING,
+ l10n_util::GetStringFUTF16(
+ IDS_AUTOFILL_DIALOG_SITE_WARNING, UTF8ToUTF16(source_url_.host())));
+ }
+
+ return DialogNotification();
}
const DetailInputs& AutofillDialogControllerImpl::RequestedFieldsForSection(
@@ -514,6 +582,45 @@ void AutofillDialogControllerImpl::FocusMoved() {
HidePopup();
}
+Profile* AutofillDialogControllerImpl::profile() {
+ return profile_;
+}
+
+content::WebContents* AutofillDialogControllerImpl::web_contents() {
+ return contents_;
+}
+
+void AutofillDialogControllerImpl::StartSignInFlow() {
+ DCHECK(registrar_.IsEmpty());
+
+ content::Source<content::NavigationController> source(
+ &view_->ShowSignIn());
+ registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source);
+}
+
+void AutofillDialogControllerImpl::EndSignInFlow() {
+ DCHECK(!registrar_.IsEmpty());
+ registrar_.RemoveAll();
+ view_->HideSignIn();
+}
+
+void AutofillDialogControllerImpl::LegalDocumentLinkClicked(size_t index) {
+ DCHECK(wallet_items_);
+ DCHECK_LE(index, wallet_items_->legal_documents().size());
+
+ GURL url(index == wallet_items_->legal_documents().size() ?
+ GURL(wallet::kPrivacyNoticeUrl) :
+ wallet_items_->legal_documents()[index]->GetUrl());
+#if defined(OS_ANDROID)
+ NOTIMPLEMENTED() << " open: " << url.spec();
Evan Stade 2013/02/12 01:36:54 NOTIMPLEMENTED is annoying, you should not use it.
+#else
+ Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
+ chrome::NavigateParams params(browser, url, content::PAGE_TRANSITION_LINK);
+ params.disposition = NEW_FOREGROUND_TAB;
+ chrome::Navigate(&params);
+#endif
+}
+
void AutofillDialogControllerImpl::ViewClosed(DialogAction action) {
if (action == ACTION_SUBMIT) {
FillOutputForSection(SECTION_EMAIL);
@@ -537,55 +644,6 @@ void AutofillDialogControllerImpl::ViewClosed(DialogAction action) {
delete this;
}
-void AutofillDialogControllerImpl::UpdateProgressBar(double value) {
- view_->UpdateProgressBar(value);
-}
-
-DialogNotification AutofillDialogControllerImpl::CurrentNotification() const {
- if (HasRequiredAction(wallet::VERIFY_CVV)) {
- return DialogNotification(
- DialogNotification::REQUIRED_ACTION,
- l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_VERIFY_CVV));
- }
-
- if (RequestingCreditCardInfo() && !TransmissionWillBeSecure()) {
- return DialogNotification(
- DialogNotification::SECURITY_WARNING,
- l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SECURITY_WARNING));
- }
-
- if (!invoked_from_same_origin_) {
- return DialogNotification(
- DialogNotification::SECURITY_WARNING,
- l10n_util::GetStringFUTF16(
- IDS_AUTOFILL_DIALOG_SITE_WARNING, UTF8ToUTF16(source_url_.host())));
- }
-
- return DialogNotification();
-}
-
-void AutofillDialogControllerImpl::StartSignInFlow() {
- DCHECK(registrar_.IsEmpty());
-
- content::Source<content::NavigationController> source(
- &view_->ShowSignIn());
- registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source);
-}
-
-void AutofillDialogControllerImpl::EndSignInFlow() {
- DCHECK(!registrar_.IsEmpty());
- registrar_.RemoveAll();
- view_->HideSignIn();
-}
-
-Profile* AutofillDialogControllerImpl::profile() {
- return profile_;
-}
-
-content::WebContents* AutofillDialogControllerImpl::web_contents() {
- return contents_;
-}
-
////////////////////////////////////////////////////////////////////////////////
// AutofillPopupDelegate
@@ -687,6 +745,7 @@ void AutofillDialogControllerImpl::OnDidGetWalletItems(
wallet_items_ = wallet_items.Pass();
view_->UpdateAccountChooser();
view_->UpdateNotificationArea();
+ view_->UpdateFootnote();
}
void AutofillDialogControllerImpl::OnDidSaveAddress(
@@ -726,6 +785,10 @@ void AutofillDialogControllerImpl::OnNetworkError(int response_code) {
////////////////////////////////////////////////////////////////////////////////
+void AutofillDialogControllerImpl::UpdateProgressBar(double value) {
+ view_->UpdateProgressBar(value);
+}
+
bool AutofillDialogControllerImpl::HandleKeyPressEventInInput(
const content::NativeWebKeyboardEvent& event) {
if (popup_controller_)
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_impl.h ('k') | chrome/browser/ui/autofill/autofill_dialog_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698