| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/autofill/autofill_dialog_views.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 | 1439 |
| 1440 void AutofillDialogViews::SubmitForTesting() { | 1440 void AutofillDialogViews::SubmitForTesting() { |
| 1441 Accept(); | 1441 Accept(); |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 void AutofillDialogViews::CancelForTesting() { | 1444 void AutofillDialogViews::CancelForTesting() { |
| 1445 GetDialogClientView()->CancelWindow(); | 1445 GetDialogClientView()->CancelWindow(); |
| 1446 } | 1446 } |
| 1447 | 1447 |
| 1448 base::string16 AutofillDialogViews::GetTextContentsOfInput( | 1448 base::string16 AutofillDialogViews::GetTextContentsOfInput( |
| 1449 const DetailInput& input) { | 1449 ServerFieldType type) { |
| 1450 views::Textfield* textfield = TextfieldForType(input.type); | 1450 views::Textfield* textfield = TextfieldForType(type); |
| 1451 if (textfield) | 1451 if (textfield) |
| 1452 return textfield->text(); | 1452 return textfield->text(); |
| 1453 | 1453 |
| 1454 views::Combobox* combobox = ComboboxForType(input.type); | 1454 views::Combobox* combobox = ComboboxForType(type); |
| 1455 if (combobox) | 1455 if (combobox) |
| 1456 return combobox->model()->GetItemAt(combobox->selected_index()); | 1456 return combobox->model()->GetItemAt(combobox->selected_index()); |
| 1457 | 1457 |
| 1458 NOTREACHED(); | 1458 NOTREACHED(); |
| 1459 return base::string16(); | 1459 return base::string16(); |
| 1460 } | 1460 } |
| 1461 | 1461 |
| 1462 void AutofillDialogViews::SetTextContentsOfInput( | 1462 void AutofillDialogViews::SetTextContentsOfInput( |
| 1463 const DetailInput& input, | 1463 ServerFieldType type, |
| 1464 const base::string16& contents) { | 1464 const base::string16& contents) { |
| 1465 views::Textfield* textfield = TextfieldForType(input.type); | 1465 views::Textfield* textfield = TextfieldForType(type); |
| 1466 if (textfield) { | 1466 if (textfield) { |
| 1467 textfield->SetText(contents); | 1467 textfield->SetText(contents); |
| 1468 return; | 1468 return; |
| 1469 } | 1469 } |
| 1470 | 1470 |
| 1471 views::Combobox* combobox = ComboboxForType(input.type); | 1471 views::Combobox* combobox = ComboboxForType(type); |
| 1472 if (combobox) { | 1472 if (combobox) { |
| 1473 SelectComboboxValueOrSetToDefault(combobox, input.initial_value); | 1473 SelectComboboxValueOrSetToDefault(combobox, contents); |
| 1474 return; | 1474 return; |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 NOTREACHED(); | 1477 NOTREACHED(); |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 void AutofillDialogViews::SetTextContentsOfSuggestionInput( | 1480 void AutofillDialogViews::SetTextContentsOfSuggestionInput( |
| 1481 DialogSection section, | 1481 DialogSection section, |
| 1482 const base::string16& text) { | 1482 const base::string16& text) { |
| 1483 GroupForSection(section)->suggested_info->decorated_textfield()-> | 1483 GroupForSection(section)->suggested_info->decorated_textfield()-> |
| 1484 SetText(text); | 1484 SetText(text); |
| 1485 } | 1485 } |
| 1486 | 1486 |
| 1487 void AutofillDialogViews::ActivateInput(const DetailInput& input) { | 1487 void AutofillDialogViews::ActivateInput(ServerFieldType type) { |
| 1488 TextfieldEditedOrActivated(TextfieldForType(input.type), false); | 1488 TextfieldEditedOrActivated(TextfieldForType(type), false); |
| 1489 } | 1489 } |
| 1490 | 1490 |
| 1491 gfx::Size AutofillDialogViews::GetSize() const { | 1491 gfx::Size AutofillDialogViews::GetSize() const { |
| 1492 return GetWidget() ? GetWidget()->GetRootView()->size() : gfx::Size(); | 1492 return GetWidget() ? GetWidget()->GetRootView()->size() : gfx::Size(); |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 content::WebContents* AutofillDialogViews::GetSignInWebContents() { | 1495 content::WebContents* AutofillDialogViews::GetSignInWebContents() { |
| 1496 return sign_in_web_view_->web_contents(); | 1496 return sign_in_web_view_->web_contents(); |
| 1497 } | 1497 } |
| 1498 | 1498 |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 2451 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
| 2452 : section(section), | 2452 : section(section), |
| 2453 container(NULL), | 2453 container(NULL), |
| 2454 manual_input(NULL), | 2454 manual_input(NULL), |
| 2455 suggested_info(NULL), | 2455 suggested_info(NULL), |
| 2456 suggested_button(NULL) {} | 2456 suggested_button(NULL) {} |
| 2457 | 2457 |
| 2458 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 2458 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
| 2459 | 2459 |
| 2460 } // namespace autofill | 2460 } // namespace autofill |
| OLD | NEW |