| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/translate/translate_bubble_view.h" | 5 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 layout->StartRow(0, COLUMN_SET_ID_MESSAGE); | 620 layout->StartRow(0, COLUMN_SET_ID_MESSAGE); |
| 621 layout->SkipColumns(1); | 621 layout->SkipColumns(1); |
| 622 before_always_translate_checkbox_ = new views::Checkbox( | 622 before_always_translate_checkbox_ = new views::Checkbox( |
| 623 l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ALWAYS_DO_THIS)); | 623 l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ALWAYS_DO_THIS)); |
| 624 before_always_translate_checkbox_->set_id(BUTTON_ID_ALWAYS_TRANSLATE); | 624 before_always_translate_checkbox_->set_id(BUTTON_ID_ALWAYS_TRANSLATE); |
| 625 before_always_translate_checkbox_->set_listener(this); | 625 before_always_translate_checkbox_->set_listener(this); |
| 626 layout->AddView(before_always_translate_checkbox_); | 626 layout->AddView(before_always_translate_checkbox_); |
| 627 } | 627 } |
| 628 | 628 |
| 629 layout->AddPaddingRow(0, provider->GetDistanceMetric( | 629 layout->AddPaddingRow(0, provider->GetDistanceMetric( |
| 630 DISTANCE_UNRELATED_CONTROL_VERTICAL)); | 630 views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
| 631 | 631 |
| 632 layout->StartRow(0, COLUMN_SET_ID_CONTENT); | 632 layout->StartRow(0, COLUMN_SET_ID_CONTENT); |
| 633 views::LabelButton* accept_button = | 633 views::LabelButton* accept_button = |
| 634 Use2016Q2UI() | 634 Use2016Q2UI() |
| 635 ? views::MdTextButton::CreateSecondaryUiBlueButton( | 635 ? views::MdTextButton::CreateSecondaryUiBlueButton( |
| 636 this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT)) | 636 this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT)) |
| 637 : views::MdTextButton::CreateSecondaryUiButton( | 637 : views::MdTextButton::CreateSecondaryUiButton( |
| 638 this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT)); | 638 this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT)); |
| 639 accept_button->set_id(BUTTON_ID_TRANSLATE); | 639 accept_button->set_id(BUTTON_ID_TRANSLATE); |
| 640 layout->AddView(accept_button); | 640 layout->AddView(accept_button); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT); | 699 cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT); |
| 700 cs->AddPaddingColumn(1, 0); | 700 cs->AddPaddingColumn(1, 0); |
| 701 cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 701 cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
| 702 GridLayout::USE_PREF, 0, 0); | 702 GridLayout::USE_PREF, 0, 0); |
| 703 | 703 |
| 704 layout->StartRow(0, COLUMN_SET_ID_MESSAGE); | 704 layout->StartRow(0, COLUMN_SET_ID_MESSAGE); |
| 705 if (Use2016Q2UI()) | 705 if (Use2016Q2UI()) |
| 706 AddIconToLayout(layout); | 706 AddIconToLayout(layout); |
| 707 layout->AddView(label); | 707 layout->AddView(label); |
| 708 | 708 |
| 709 layout->AddPaddingRow( | 709 layout->AddPaddingRow(0, provider->GetDistanceMetric( |
| 710 0, provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_VERTICAL)); | 710 views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
| 711 | 711 |
| 712 layout->StartRow(0, COLUMN_SET_ID_CONTENT); | 712 layout->StartRow(0, COLUMN_SET_ID_CONTENT); |
| 713 views::LabelButton* revert_button = | 713 views::LabelButton* revert_button = |
| 714 views::MdTextButton::CreateSecondaryUiButton( | 714 views::MdTextButton::CreateSecondaryUiButton( |
| 715 this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_REVERT)); | 715 this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_REVERT)); |
| 716 revert_button->set_id(BUTTON_ID_SHOW_ORIGINAL); | 716 revert_button->set_id(BUTTON_ID_SHOW_ORIGINAL); |
| 717 revert_button->SetEnabled(false); | 717 revert_button->SetEnabled(false); |
| 718 layout->AddView(revert_button); | 718 layout->AddView(revert_button); |
| 719 | 719 |
| 720 return view; | 720 return view; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT); | 752 cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT); |
| 753 cs->AddPaddingColumn(1, 0); | 753 cs->AddPaddingColumn(1, 0); |
| 754 cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 754 cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
| 755 GridLayout::USE_PREF, 0, 0); | 755 GridLayout::USE_PREF, 0, 0); |
| 756 | 756 |
| 757 layout->StartRow(0, COLUMN_SET_ID_MESSAGE); | 757 layout->StartRow(0, COLUMN_SET_ID_MESSAGE); |
| 758 layout->AddView(label); | 758 layout->AddView(label); |
| 759 layout->AddView( | 759 layout->AddView( |
| 760 CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED, LINK_ID_ADVANCED)); | 760 CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED, LINK_ID_ADVANCED)); |
| 761 | 761 |
| 762 layout->AddPaddingRow( | 762 layout->AddPaddingRow(0, provider->GetDistanceMetric( |
| 763 0, provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_VERTICAL)); | 763 views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
| 764 | 764 |
| 765 layout->StartRow(0, COLUMN_SET_ID_CONTENT); | 765 layout->StartRow(0, COLUMN_SET_ID_CONTENT); |
| 766 views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( | 766 views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( |
| 767 this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_REVERT)); | 767 this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_REVERT)); |
| 768 button->set_id(BUTTON_ID_SHOW_ORIGINAL); | 768 button->set_id(BUTTON_ID_SHOW_ORIGINAL); |
| 769 layout->AddView(button); | 769 layout->AddView(button); |
| 770 | 770 |
| 771 return view; | 771 return view; |
| 772 } | 772 } |
| 773 | 773 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 803 cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT); | 803 cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT); |
| 804 cs->AddPaddingColumn(1, 0); | 804 cs->AddPaddingColumn(1, 0); |
| 805 cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 805 cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
| 806 GridLayout::USE_PREF, 0, 0); | 806 GridLayout::USE_PREF, 0, 0); |
| 807 | 807 |
| 808 layout->StartRow(0, COLUMN_SET_ID_MESSAGE); | 808 layout->StartRow(0, COLUMN_SET_ID_MESSAGE); |
| 809 layout->AddView(label); | 809 layout->AddView(label); |
| 810 layout->AddView( | 810 layout->AddView( |
| 811 CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED, LINK_ID_ADVANCED)); | 811 CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED, LINK_ID_ADVANCED)); |
| 812 | 812 |
| 813 layout->AddPaddingRow( | 813 layout->AddPaddingRow(0, provider->GetDistanceMetric( |
| 814 0, provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_VERTICAL)); | 814 views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
| 815 | 815 |
| 816 layout->StartRow(0, COLUMN_SET_ID_CONTENT); | 816 layout->StartRow(0, COLUMN_SET_ID_CONTENT); |
| 817 views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( | 817 views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( |
| 818 this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRY_AGAIN)); | 818 this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRY_AGAIN)); |
| 819 button->set_id(BUTTON_ID_TRY_AGAIN); | 819 button->set_id(BUTTON_ID_TRY_AGAIN); |
| 820 layout->AddView(button); | 820 layout->AddView(button); |
| 821 | 821 |
| 822 return view; | 822 return view; |
| 823 } | 823 } |
| 824 | 824 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 layout->AddView(target_language_label); | 902 layout->AddView(target_language_label); |
| 903 layout->AddView(target_language_combobox_); | 903 layout->AddView(target_language_combobox_); |
| 904 | 904 |
| 905 if (!is_in_incognito_window_) { | 905 if (!is_in_incognito_window_) { |
| 906 layout->AddPaddingRow(0, vertical_spacing); | 906 layout->AddPaddingRow(0, vertical_spacing); |
| 907 layout->StartRow(0, COLUMN_SET_ID_LANGUAGES); | 907 layout->StartRow(0, COLUMN_SET_ID_LANGUAGES); |
| 908 layout->SkipColumns(1); | 908 layout->SkipColumns(1); |
| 909 layout->AddView(advanced_always_translate_checkbox_); | 909 layout->AddView(advanced_always_translate_checkbox_); |
| 910 } | 910 } |
| 911 | 911 |
| 912 layout->AddPaddingRow( | 912 layout->AddPaddingRow(0, provider->GetDistanceMetric( |
| 913 0, provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_VERTICAL)); | 913 views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
| 914 | 914 |
| 915 layout->StartRow(0, COLUMN_SET_ID_BUTTONS); | 915 layout->StartRow(0, COLUMN_SET_ID_BUTTONS); |
| 916 // TODO(estade): this should use CreateExtraView(). | 916 // TODO(estade): this should use CreateExtraView(). |
| 917 layout->AddView(CreateLink(this, IDS_TRANSLATE_BUBBLE_LANGUAGE_SETTINGS, | 917 layout->AddView(CreateLink(this, IDS_TRANSLATE_BUBBLE_LANGUAGE_SETTINGS, |
| 918 LINK_ID_LANGUAGE_SETTINGS)); | 918 LINK_ID_LANGUAGE_SETTINGS)); |
| 919 advanced_done_button_ = | 919 advanced_done_button_ = |
| 920 Use2016Q2UI() ? views::MdTextButton::CreateSecondaryUiBlueButton( | 920 Use2016Q2UI() ? views::MdTextButton::CreateSecondaryUiBlueButton( |
| 921 this, l10n_util::GetStringUTF16(IDS_DONE)) | 921 this, l10n_util::GetStringUTF16(IDS_DONE)) |
| 922 : views::MdTextButton::CreateSecondaryUiButton( | 922 : views::MdTextButton::CreateSecondaryUiButton( |
| 923 this, l10n_util::GetStringUTF16(IDS_DONE)); | 923 this, l10n_util::GetStringUTF16(IDS_DONE)); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 base::string16 label; | 984 base::string16 label; |
| 985 if (model_->IsPageTranslatedInCurrentLanguages()) | 985 if (model_->IsPageTranslatedInCurrentLanguages()) |
| 986 label = l10n_util::GetStringUTF16(IDS_DONE); | 986 label = l10n_util::GetStringUTF16(IDS_DONE); |
| 987 else | 987 else |
| 988 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); | 988 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); |
| 989 advanced_done_button_->SetText(label); | 989 advanced_done_button_->SetText(label); |
| 990 advanced_done_button_->SizeToPreferredSize(); | 990 advanced_done_button_->SizeToPreferredSize(); |
| 991 if (advanced_view_) | 991 if (advanced_view_) |
| 992 advanced_view_->Layout(); | 992 advanced_view_->Layout(); |
| 993 } | 993 } |
| OLD | NEW |