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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 | 521 |
522 void AutofillDialogViews::AccountChooser::OnMenuButtonClicked( | 522 void AutofillDialogViews::AccountChooser::OnMenuButtonClicked( |
523 views::View* source, | 523 views::View* source, |
524 const gfx::Point& point) { | 524 const gfx::Point& point) { |
525 DCHECK_EQ(menu_button_, source); | 525 DCHECK_EQ(menu_button_, source); |
526 | 526 |
527 ui::MenuModel* model = delegate_->MenuModelForAccountChooser(); | 527 ui::MenuModel* model = delegate_->MenuModelForAccountChooser(); |
528 if (!model) | 528 if (!model) |
529 return; | 529 return; |
530 | 530 |
531 menu_runner_.reset(new views::MenuRunner(model)); | 531 menu_runner_.reset(new views::MenuRunner(model, 0)); |
532 if (menu_runner_->RunMenuAt(source->GetWidget(), | 532 if (menu_runner_->RunMenuAt(source->GetWidget(), |
533 NULL, | 533 NULL, |
534 source->GetBoundsInScreen(), | 534 source->GetBoundsInScreen(), |
535 views::MENU_ANCHOR_TOPRIGHT, | 535 views::MENU_ANCHOR_TOPRIGHT, |
536 ui::MENU_SOURCE_NONE, | 536 ui::MENU_SOURCE_NONE) == |
537 0) == views::MenuRunner::MENU_DELETED) { | 537 views::MenuRunner::MENU_DELETED) { |
538 return; | 538 return; |
539 } | 539 } |
540 } | 540 } |
541 | 541 |
542 views::View* AutofillDialogViews::GetLoadingShieldForTesting() { | 542 views::View* AutofillDialogViews::GetLoadingShieldForTesting() { |
543 return loading_shield_; | 543 return loading_shield_; |
544 } | 544 } |
545 | 545 |
546 views::WebView* AutofillDialogViews::GetSignInWebViewForTesting() { | 546 views::WebView* AutofillDialogViews::GetSignInWebViewForTesting() { |
547 return sign_in_web_view_; | 547 return sign_in_web_view_; |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 if (source == iter->second.suggested_button) { | 1726 if (source == iter->second.suggested_button) { |
1727 group = &iter->second; | 1727 group = &iter->second; |
1728 break; | 1728 break; |
1729 } | 1729 } |
1730 } | 1730 } |
1731 DCHECK(group); | 1731 DCHECK(group); |
1732 | 1732 |
1733 if (!group->suggested_button->visible()) | 1733 if (!group->suggested_button->visible()) |
1734 return; | 1734 return; |
1735 | 1735 |
1736 menu_runner_.reset(new views::MenuRunner( | 1736 menu_runner_.reset( |
1737 delegate_->MenuModelForSection(group->section))); | 1737 new views::MenuRunner(delegate_->MenuModelForSection(group->section), 0)); |
1738 | 1738 |
1739 group->container->SetActive(true); | 1739 group->container->SetActive(true); |
1740 views::Button::ButtonState state = group->suggested_button->state(); | 1740 views::Button::ButtonState state = group->suggested_button->state(); |
1741 group->suggested_button->SetState(views::Button::STATE_PRESSED); | 1741 group->suggested_button->SetState(views::Button::STATE_PRESSED); |
1742 | 1742 |
1743 gfx::Rect screen_bounds = source->GetBoundsInScreen(); | 1743 gfx::Rect screen_bounds = source->GetBoundsInScreen(); |
1744 screen_bounds.Inset(source->GetInsets()); | 1744 screen_bounds.Inset(source->GetInsets()); |
1745 if (menu_runner_->RunMenuAt(source->GetWidget(), | 1745 if (menu_runner_->RunMenuAt(source->GetWidget(), |
1746 NULL, | 1746 NULL, |
1747 screen_bounds, | 1747 screen_bounds, |
1748 views::MENU_ANCHOR_TOPRIGHT, | 1748 views::MENU_ANCHOR_TOPRIGHT, |
1749 ui::MENU_SOURCE_NONE, | 1749 ui::MENU_SOURCE_NONE) == |
1750 0) == views::MenuRunner::MENU_DELETED) { | 1750 views::MenuRunner::MENU_DELETED) { |
1751 return; | 1751 return; |
1752 } | 1752 } |
1753 | 1753 |
1754 group->container->SetActive(false); | 1754 group->container->SetActive(false); |
1755 group->suggested_button->SetState(state); | 1755 group->suggested_button->SetState(state); |
1756 } | 1756 } |
1757 | 1757 |
1758 gfx::Size AutofillDialogViews::CalculatePreferredSize( | 1758 gfx::Size AutofillDialogViews::CalculatePreferredSize( |
1759 bool get_minimum_size) const { | 1759 bool get_minimum_size) const { |
1760 gfx::Insets insets = GetInsets(); | 1760 gfx::Insets insets = GetInsets(); |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 2501 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
2502 : section(section), | 2502 : section(section), |
2503 container(NULL), | 2503 container(NULL), |
2504 manual_input(NULL), | 2504 manual_input(NULL), |
2505 suggested_info(NULL), | 2505 suggested_info(NULL), |
2506 suggested_button(NULL) {} | 2506 suggested_button(NULL) {} |
2507 | 2507 |
2508 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 2508 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
2509 | 2509 |
2510 } // namespace autofill | 2510 } // namespace autofill |
OLD | NEW |