OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/autofill/autofill_dialog.h" | 5 #include "chrome/browser/autofill/autofill_dialog.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 void AutoFillDialog::OnAutoFillCheckToggled(GtkWidget* widget) { | 266 void AutoFillDialog::OnAutoFillCheckToggled(GtkWidget* widget) { |
267 bool enabled = gtk_toggle_button_get_active( | 267 bool enabled = gtk_toggle_button_get_active( |
268 GTK_TOGGLE_BUTTON(form_autofill_enable_check_)); | 268 GTK_TOGGLE_BUTTON(form_autofill_enable_check_)); |
269 if (enabled) { | 269 if (enabled) { |
270 UserMetrics::RecordAction(UserMetricsAction("Options_FormAutofill_Enable"), | 270 UserMetrics::RecordAction(UserMetricsAction("Options_FormAutofill_Enable"), |
271 profile_); | 271 profile_); |
272 } else { | 272 } else { |
273 UserMetrics::RecordAction(UserMetricsAction("Options_FormAutofill_Disable"), | 273 UserMetrics::RecordAction(UserMetricsAction("Options_FormAutofill_Disable"), |
274 profile_); | 274 profile_); |
275 } | 275 } |
276 enable_form_autofill_.SetValue(enabled); | 276 enable_form_autofill_.SetValueIfNotManaged(enabled); |
277 profile_->GetPrefs()->ScheduleSavePersistentPrefs(); | 277 profile_->GetPrefs()->ScheduleSavePersistentPrefs(); |
278 UpdateWidgetState(); | 278 UpdateWidgetState(); |
279 } | 279 } |
280 | 280 |
281 void AutoFillDialog::OnRowActivated(GtkTreeView* tree_view, | 281 void AutoFillDialog::OnRowActivated(GtkTreeView* tree_view, |
282 GtkTreePath* path, | 282 GtkTreePath* path, |
283 GtkTreeViewColumn* column) { | 283 GtkTreeViewColumn* column) { |
284 if (GetSelectionType() == SELECTION_SINGLE) | 284 if (GetSelectionType() == SELECTION_SINGLE) |
285 OnEdit(NULL); | 285 OnEdit(NULL); |
286 } | 286 } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 gtk_dialog_add_action_widget(GTK_DIALOG(dialog_), link, | 539 gtk_dialog_add_action_widget(GTK_DIALOG(dialog_), link, |
540 kAutoFillDialogAboutLink); | 540 kAutoFillDialogAboutLink); |
541 | 541 |
542 // Setting the link widget to secondary positions the button on the left side | 542 // Setting the link widget to secondary positions the button on the left side |
543 // of the action area (vice versa for RTL layout). | 543 // of the action area (vice versa for RTL layout). |
544 gtk_button_box_set_child_secondary( | 544 gtk_button_box_set_child_secondary( |
545 GTK_BUTTON_BOX(GTK_DIALOG(dialog_)->action_area), link, TRUE); | 545 GTK_BUTTON_BOX(GTK_DIALOG(dialog_)->action_area), link, TRUE); |
546 } | 546 } |
547 | 547 |
548 void AutoFillDialog::UpdateWidgetState() { | 548 void AutoFillDialog::UpdateWidgetState() { |
| 549 gtk_widget_set_sensitive(form_autofill_enable_check_, |
| 550 !enable_form_autofill_.IsManaged()); |
549 if (!personal_data_->IsDataLoaded() || !enable_form_autofill_.GetValue()) { | 551 if (!personal_data_->IsDataLoaded() || !enable_form_autofill_.GetValue()) { |
550 gtk_widget_set_sensitive(add_address_button_, FALSE); | 552 gtk_widget_set_sensitive(add_address_button_, FALSE); |
551 gtk_widget_set_sensitive(add_credit_card_button_, FALSE); | 553 gtk_widget_set_sensitive(add_credit_card_button_, FALSE); |
552 gtk_widget_set_sensitive(edit_button_, FALSE); | 554 gtk_widget_set_sensitive(edit_button_, FALSE); |
553 gtk_widget_set_sensitive(remove_button_, FALSE); | 555 gtk_widget_set_sensitive(remove_button_, FALSE); |
554 gtk_widget_set_sensitive(tree_, FALSE); | 556 gtk_widget_set_sensitive(tree_, FALSE); |
555 } else { | 557 } else { |
556 gtk_widget_set_sensitive(add_address_button_, TRUE); | 558 gtk_widget_set_sensitive(add_address_button_, TRUE); |
557 gtk_widget_set_sensitive(add_credit_card_button_, TRUE); | 559 gtk_widget_set_sensitive(add_credit_card_button_, TRUE); |
558 int selection_type = GetSelectionType(); | 560 int selection_type = GetSelectionType(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 | 659 |
658 void ShowAutoFillDialog(gfx::NativeView parent, | 660 void ShowAutoFillDialog(gfx::NativeView parent, |
659 AutoFillDialogObserver* observer, | 661 AutoFillDialogObserver* observer, |
660 Profile* profile) { | 662 Profile* profile) { |
661 DCHECK(profile); | 663 DCHECK(profile); |
662 | 664 |
663 if (!dialog) | 665 if (!dialog) |
664 dialog = new AutoFillDialog(profile, observer); | 666 dialog = new AutoFillDialog(profile, observer); |
665 dialog->Show(); | 667 dialog->Show(); |
666 } | 668 } |
OLD | NEW |