| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // static | 148 // static |
| 149 TranslateBubbleView* TranslateBubbleView::GetCurrentBubble() { | 149 TranslateBubbleView* TranslateBubbleView::GetCurrentBubble() { |
| 150 return translate_bubble_view_; | 150 return translate_bubble_view_; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void TranslateBubbleView::CloseBubble() { | 153 void TranslateBubbleView::CloseBubble() { |
| 154 mouse_handler_.reset(); | 154 mouse_handler_.reset(); |
| 155 LocationBarBubbleDelegateView::CloseBubble(); | 155 LocationBarBubbleDelegateView::CloseBubble(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 int TranslateBubbleView::GetDialogButtons() const { |
| 159 // TODO(estade): this should be using GetDialogButtons(). |
| 160 return ui::DIALOG_BUTTON_NONE; |
| 161 } |
| 162 |
| 158 void TranslateBubbleView::Init() { | 163 void TranslateBubbleView::Init() { |
| 159 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 164 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
| 160 | 165 |
| 161 should_always_translate_ = model_->ShouldAlwaysTranslate(); | 166 should_always_translate_ = model_->ShouldAlwaysTranslate(); |
| 162 if (Use2016Q2UI() && !is_in_incognito_window_) { | 167 if (Use2016Q2UI() && !is_in_incognito_window_) { |
| 163 should_always_translate_ = | 168 should_always_translate_ = |
| 164 model_->ShouldAlwaysTranslateBeCheckedByDefault(); | 169 model_->ShouldAlwaysTranslateBeCheckedByDefault(); |
| 165 } | 170 } |
| 166 | 171 |
| 167 before_translate_view_ = CreateViewBeforeTranslate(); | 172 before_translate_view_ = CreateViewBeforeTranslate(); |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 advanced_done_button_ = | 916 advanced_done_button_ = |
| 912 Use2016Q2UI() ? views::MdTextButton::CreateSecondaryUiBlueButton( | 917 Use2016Q2UI() ? views::MdTextButton::CreateSecondaryUiBlueButton( |
| 913 this, l10n_util::GetStringUTF16(IDS_DONE)) | 918 this, l10n_util::GetStringUTF16(IDS_DONE)) |
| 914 : views::MdTextButton::CreateSecondaryUiButton( | 919 : views::MdTextButton::CreateSecondaryUiButton( |
| 915 this, l10n_util::GetStringUTF16(IDS_DONE)); | 920 this, l10n_util::GetStringUTF16(IDS_DONE)); |
| 916 advanced_done_button_->set_id(BUTTON_ID_DONE); | 921 advanced_done_button_->set_id(BUTTON_ID_DONE); |
| 917 advanced_done_button_->SetIsDefault(true); | 922 advanced_done_button_->SetIsDefault(true); |
| 918 advanced_cancel_button_ = views::MdTextButton::CreateSecondaryUiButton( | 923 advanced_cancel_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| 919 this, l10n_util::GetStringUTF16(IDS_CANCEL)); | 924 this, l10n_util::GetStringUTF16(IDS_CANCEL)); |
| 920 advanced_cancel_button_->set_id(BUTTON_ID_CANCEL); | 925 advanced_cancel_button_->set_id(BUTTON_ID_CANCEL); |
| 921 // TODO(estade): this should be using GetDialogButtons(). | |
| 922 layout->AddView(advanced_done_button_); | 926 layout->AddView(advanced_done_button_); |
| 923 layout->AddView(advanced_cancel_button_); | 927 layout->AddView(advanced_cancel_button_); |
| 924 | 928 |
| 925 UpdateAdvancedView(); | 929 UpdateAdvancedView(); |
| 926 | 930 |
| 927 return view; | 931 return view; |
| 928 } | 932 } |
| 929 | 933 |
| 930 views::Checkbox* TranslateBubbleView::GetAlwaysTranslateCheckbox() { | 934 views::Checkbox* TranslateBubbleView::GetAlwaysTranslateCheckbox() { |
| 931 if (model_->GetViewState() == TranslateBubbleModel::VIEW_STATE_ADVANCED) { | 935 if (model_->GetViewState() == TranslateBubbleModel::VIEW_STATE_ADVANCED) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 base::string16 label; | 981 base::string16 label; |
| 978 if (model_->IsPageTranslatedInCurrentLanguages()) | 982 if (model_->IsPageTranslatedInCurrentLanguages()) |
| 979 label = l10n_util::GetStringUTF16(IDS_DONE); | 983 label = l10n_util::GetStringUTF16(IDS_DONE); |
| 980 else | 984 else |
| 981 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); | 985 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); |
| 982 advanced_done_button_->SetText(label); | 986 advanced_done_button_->SetText(label); |
| 983 advanced_done_button_->SizeToPreferredSize(); | 987 advanced_done_button_->SizeToPreferredSize(); |
| 984 if (advanced_view_) | 988 if (advanced_view_) |
| 985 advanced_view_->Layout(); | 989 advanced_view_->Layout(); |
| 986 } | 990 } |
| OLD | NEW |