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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 if (accelerator.key_code() == ui::VKEY_RETURN) { | 234 if (accelerator.key_code() == ui::VKEY_RETURN) { |
235 HandleButtonPressed(BUTTON_ID_DONE); | 235 HandleButtonPressed(BUTTON_ID_DONE); |
236 return true; | 236 return true; |
237 } | 237 } |
238 break; | 238 break; |
239 } | 239 } |
240 } | 240 } |
241 return BubbleDialogDelegateView::AcceleratorPressed(accelerator); | 241 return BubbleDialogDelegateView::AcceleratorPressed(accelerator); |
242 } | 242 } |
243 | 243 |
244 gfx::Size TranslateBubbleView::GetPreferredSize() const { | 244 gfx::Size TranslateBubbleView::GetUnsnappedPreferredSize() const { |
245 int width = 0; | 245 int width = 0; |
Peter Kasting
2017/03/30 00:35:36
Isn't this the case you said could just be elimina
| |
246 for (int i = 0; i < child_count(); i++) { | 246 for (int i = 0; i < child_count(); i++) { |
247 const views::View* child = child_at(i); | 247 const views::View* child = child_at(i); |
248 width = std::max(width, child->GetPreferredSize().width()); | 248 width = std::max(width, child->GetPreferredSize().width()); |
249 } | 249 } |
250 int height = GetCurrentView()->GetPreferredSize().height(); | 250 int height = GetCurrentView()->GetPreferredSize().height(); |
251 return gfx::Size(width, height); | 251 return gfx::Size(width, height); |
252 } | 252 } |
253 | 253 |
254 void TranslateBubbleView::OnPerformAction(views::Combobox* combobox) { | 254 void TranslateBubbleView::OnPerformAction(views::Combobox* combobox) { |
255 HandleComboboxPerformAction(static_cast<ComboboxID>(combobox->id())); | 255 HandleComboboxPerformAction(static_cast<ComboboxID>(combobox->id())); |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
941 base::string16 label; | 941 base::string16 label; |
942 if (model_->IsPageTranslatedInCurrentLanguages()) | 942 if (model_->IsPageTranslatedInCurrentLanguages()) |
943 label = l10n_util::GetStringUTF16(IDS_DONE); | 943 label = l10n_util::GetStringUTF16(IDS_DONE); |
944 else | 944 else |
945 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); | 945 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); |
946 advanced_done_button_->SetText(label); | 946 advanced_done_button_->SetText(label); |
947 advanced_done_button_->SizeToPreferredSize(); | 947 advanced_done_button_->SizeToPreferredSize(); |
948 if (advanced_view_) | 948 if (advanced_view_) |
949 advanced_view_->Layout(); | 949 advanced_view_->Layout(); |
950 } | 950 } |
OLD | NEW |