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

Unified Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.cc

Issue 12016031: Add 'save details in chrome' checkbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change symbol names Created 7 years, 11 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
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/autofill/autofill_dialog_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
index fad5477f68d4773c93955f2d5e1eeed85b877224..03b3515df0dac95a3b80188eafc611cd734a5860 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -257,6 +257,8 @@ AutofillDialogViews::AutofillDialogViews(AutofillDialogController* controller)
cancel_sign_in_(NULL),
sign_in_webview_(NULL),
main_container_(NULL),
+ button_strip_extra_view_(NULL),
+ save_in_chrome_checkbox_(NULL),
focus_manager_(NULL) {
DCHECK(controller);
detail_groups_.insert(std::make_pair(SECTION_EMAIL,
@@ -315,6 +317,10 @@ bool AutofillDialogViews::UseBillingForShipping() {
return use_billing_for_shipping_->checked();
}
+bool AutofillDialogViews::SaveDetailsLocally() {
+ return save_in_chrome_checkbox_->checked();
+}
+
const content::NavigationController& AutofillDialogViews::ShowSignIn() {
// TODO(abodenha) Also hide Submit and Cancel buttons.
// See http://crbug.com/165193
@@ -372,6 +378,10 @@ bool AutofillDialogViews::IsDialogButtonEnabled(ui::DialogButton button) const {
return true;
}
+views::View* AutofillDialogViews::GetExtraView() {
+ return button_strip_extra_view_;
+}
+
bool AutofillDialogViews::Cancel() {
return true;
}
@@ -388,7 +398,7 @@ void AutofillDialogViews::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (sender == use_billing_for_shipping_) {
UpdateDetailsGroupState(*GroupForSection(SECTION_SHIPPING));
- } else if (sender == cancel_sign_in_) {
+ } else if (sender == cancel_sign_in_) {
controller_->EndSignInFlow();
} else {
// TODO(estade): Should the menu be shown on mouse down?
@@ -467,6 +477,16 @@ void AutofillDialogViews::LinkClicked(views::Link* source, int event_flags) {
}
void AutofillDialogViews::InitChildViews() {
+ button_strip_extra_view_ = new views::View();
+ button_strip_extra_view_->SetLayoutManager(
+ new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
+
+ // TODO(estade): i18n.
+ save_in_chrome_checkbox_ =
+ new views::Checkbox(controller_->SaveLocallyText());
+ button_strip_extra_view_->AddChildView(save_in_chrome_checkbox_);
+ // TODO(estade): add other views, like the Autocheckout progress bar.
+
contents_ = new views::View();
contents_->SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
@@ -714,6 +734,10 @@ void AutofillDialogViews::UpdateDetailsGroupState(const DetailsGroup& group) {
group.manual_input->SetVisible(!show_suggestions);
}
+ // Show or hide the "Save in chrome" checkbox. If nothing is in editing mode,
+ // hide.
+ save_in_chrome_checkbox_->SetVisible(AtLeastOneSectionIsEditing());
+
if (group.container)
group.container->SetForwardMouseEvents(show_suggestions);
@@ -721,6 +745,16 @@ void AutofillDialogViews::UpdateDetailsGroupState(const DetailsGroup& group) {
GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize());
}
+bool AutofillDialogViews::AtLeastOneSectionIsEditing() {
+ for (DetailGroupMap::iterator iter = detail_groups_.begin();
+ iter != detail_groups_.end(); ++iter) {
+ if (iter->second.manual_input && iter->second.manual_input->visible())
+ return true;
+ }
+
+ return false;
+}
+
bool AutofillDialogViews::ValidateForm() {
bool all_valid = true;
for (DetailGroupMap::iterator iter = detail_groups_.begin();
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698