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

Side by Side 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: dont play with fire 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 1437
1438 void AutofillDialogViews::ModelChanged() { 1438 void AutofillDialogViews::ModelChanged() {
1439 menu_runner_.reset(); 1439 menu_runner_.reset();
1440 1440
1441 for (DetailGroupMap::const_iterator iter = detail_groups_.begin(); 1441 for (DetailGroupMap::const_iterator iter = detail_groups_.begin();
1442 iter != detail_groups_.end(); ++iter) { 1442 iter != detail_groups_.end(); ++iter) {
1443 UpdateDetailsGroupState(iter->second); 1443 UpdateDetailsGroupState(iter->second);
1444 } 1444 }
1445 } 1445 }
1446 1446
1447 TestableAutofillDialogView* AutofillDialogViews::GetTestableView() {
1448 return this;
1449 }
1450
1451 void AutofillDialogViews::OnSignInResize(const gfx::Size& pref_size) { 1447 void AutofillDialogViews::OnSignInResize(const gfx::Size& pref_size) {
1452 sign_in_web_view_->SetPreferredSize(pref_size); 1448 sign_in_web_view_->SetPreferredSize(pref_size);
1453 ContentsPreferredSizeChanged(); 1449 ContentsPreferredSizeChanged();
1454 } 1450 }
1455 1451
1456 void AutofillDialogViews::SubmitForTesting() {
1457 Accept();
1458 }
1459
1460 void AutofillDialogViews::CancelForTesting() {
1461 GetDialogClientView()->CancelWindow();
1462 }
1463
1464 base::string16 AutofillDialogViews::GetTextContentsOfInput(
1465 ServerFieldType type) {
1466 views::Textfield* textfield = TextfieldForType(type);
1467 if (textfield)
1468 return textfield->text();
1469
1470 views::Combobox* combobox = ComboboxForType(type);
1471 if (combobox)
1472 return combobox->model()->GetItemAt(combobox->selected_index());
1473
1474 NOTREACHED();
1475 return base::string16();
1476 }
1477
1478 void AutofillDialogViews::SetTextContentsOfInput(
1479 ServerFieldType type,
1480 const base::string16& contents) {
1481 views::Textfield* textfield = TextfieldForType(type);
1482 if (textfield) {
1483 textfield->SetText(contents);
1484 return;
1485 }
1486
1487 views::Combobox* combobox = ComboboxForType(type);
1488 if (combobox) {
1489 SelectComboboxValueOrSetToDefault(combobox, contents);
1490 return;
1491 }
1492
1493 NOTREACHED();
1494 }
1495
1496 void AutofillDialogViews::SetTextContentsOfSuggestionInput(
1497 DialogSection section,
1498 const base::string16& text) {
1499 GroupForSection(section)->suggested_info->decorated_textfield()->
1500 SetText(text);
1501 }
1502
1503 void AutofillDialogViews::ActivateInput(ServerFieldType type) {
1504 TextfieldEditedOrActivated(TextfieldForType(type), false);
1505 }
1506
1507 gfx::Size AutofillDialogViews::GetSize() const {
1508 return GetWidget() ? GetWidget()->GetRootView()->size() : gfx::Size();
1509 }
1510
1511 content::WebContents* AutofillDialogViews::GetSignInWebContents() {
1512 return sign_in_web_view_->web_contents();
1513 }
1514
1515 bool AutofillDialogViews::IsShowingOverlay() const {
1516 return overlay_view_->visible();
1517 }
1518
1519 gfx::Size AutofillDialogViews::GetPreferredSize() { 1452 gfx::Size AutofillDialogViews::GetPreferredSize() {
1520 if (preferred_size_.IsEmpty()) 1453 if (preferred_size_.IsEmpty())
1521 preferred_size_ = CalculatePreferredSize(false); 1454 preferred_size_ = CalculatePreferredSize(false);
1522 1455
1523 return preferred_size_; 1456 return preferred_size_;
1524 } 1457 }
1525 1458
1526 gfx::Size AutofillDialogViews::GetMinimumSize() { 1459 gfx::Size AutofillDialogViews::GetMinimumSize() {
1527 return CalculatePreferredSize(true); 1460 return CalculatePreferredSize(true);
1528 } 1461 }
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) 2396 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section)
2464 : section(section), 2397 : section(section),
2465 container(NULL), 2398 container(NULL),
2466 manual_input(NULL), 2399 manual_input(NULL),
2467 suggested_info(NULL), 2400 suggested_info(NULL),
2468 suggested_button(NULL) {} 2401 suggested_button(NULL) {}
2469 2402
2470 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} 2403 AutofillDialogViews::DetailsGroup::~DetailsGroup() {}
2471 2404
2472 } // namespace autofill 2405 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698