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

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

Issue 135933003: rAc: split TestableAutofillDialogView implementation into its own class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix stuff, sync Created 6 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
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 f22b37b25249de11e658936762d52a02cb75f571..dc2f2c1a0bf96cb55d5cc70ecbf2704e8f373874 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -1441,78 +1441,11 @@ void AutofillDialogViews::ModelChanged() {
}
}
-TestableAutofillDialogView* AutofillDialogViews::GetTestableView() {
- return this;
-}
-
void AutofillDialogViews::OnSignInResize(const gfx::Size& pref_size) {
sign_in_web_view_->SetPreferredSize(pref_size);
ContentsPreferredSizeChanged();
}
-void AutofillDialogViews::SubmitForTesting() {
- Accept();
-}
-
-void AutofillDialogViews::CancelForTesting() {
- GetDialogClientView()->CancelWindow();
-}
-
-base::string16 AutofillDialogViews::GetTextContentsOfInput(
- ServerFieldType type) {
- views::Textfield* textfield = TextfieldForType(type);
- if (textfield)
- return textfield->text();
-
- views::Combobox* combobox = ComboboxForType(type);
- if (combobox)
- return combobox->model()->GetItemAt(combobox->selected_index());
-
- NOTREACHED();
- return base::string16();
-}
-
-void AutofillDialogViews::SetTextContentsOfInput(
- ServerFieldType type,
- const base::string16& contents) {
- views::Textfield* textfield = TextfieldForType(type);
- if (textfield) {
- textfield->SetText(contents);
- return;
- }
-
- views::Combobox* combobox = ComboboxForType(type);
- if (combobox) {
- SelectComboboxValueOrSetToDefault(combobox, contents);
- return;
- }
-
- NOTREACHED();
-}
-
-void AutofillDialogViews::SetTextContentsOfSuggestionInput(
- DialogSection section,
- const base::string16& text) {
- GroupForSection(section)->suggested_info->decorated_textfield()->
- SetText(text);
-}
-
-void AutofillDialogViews::ActivateInput(ServerFieldType type) {
- InputEditedOrActivated(type, gfx::Rect(), false);
-}
-
-gfx::Size AutofillDialogViews::GetSize() const {
- return GetWidget() ? GetWidget()->GetRootView()->size() : gfx::Size();
-}
-
-content::WebContents* AutofillDialogViews::GetSignInWebContents() {
- return sign_in_web_view_->web_contents();
-}
-
-bool AutofillDialogViews::IsShowingOverlay() const {
- return overlay_view_->visible();
-}
-
gfx::Size AutofillDialogViews::GetPreferredSize() {
if (preferred_size_.IsEmpty())
preferred_size_ = CalculatePreferredSize(false);
@@ -2284,15 +2217,20 @@ void AutofillDialogViews::InputEditedOrActivated(ServerFieldType type,
DCHECK_NE(UNKNOWN_TYPE, type);
DecoratedTextfield* decorated = TextfieldForType(type);
- DetailsGroup* group = decorated ?
- GroupForView(decorated) : GroupForView(ComboboxForType(type));
+ views::Combobox* combobox = ComboboxForType(type);
+ DCHECK_NE(!!combobox, !!decorated);
Dan Beam 2014/01/28 18:04:48 nit: DCHECK_NE(!combobox, !decorated) does the sam
Evan Stade 2014/01/28 18:45:26 easier to read as english imho
groby-ooo-7-16 2014/01/28 20:54:14 If you like English, DCHECK(combobox || decorated)
Evan Stade 2014/01/28 22:05:55 the intended operation is XOR
+ DetailsGroup* group = decorated ? GroupForView(decorated) :
+ GroupForView(combobox);
+ base::string16 text = decorated ?
+ decorated->text() :
+ combobox->model()->GetItemAt(combobox->selected_index());
DCHECK(group);
delegate_->UserEditedOrActivatedInput(group->section,
type,
GetWidget()->GetNativeView(),
bounds,
- GetTextContentsOfInput(type),
+ text,
was_edit);
// If the field is a textfield and is invalid, check if the text is now valid.

Powered by Google App Engine
This is Rietveld 408576698