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