| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 if (model_->GetViewState() == TranslateBubbleModel::VIEW_STATE_ERROR) | 182 if (model_->GetViewState() == TranslateBubbleModel::VIEW_STATE_ERROR) |
| 183 model_->ShowError(error_type_); | 183 model_->ShowError(error_type_); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void TranslateBubbleView::ButtonPressed(views::Button* sender, | 186 void TranslateBubbleView::ButtonPressed(views::Button* sender, |
| 187 const ui::Event& event) { | 187 const ui::Event& event) { |
| 188 HandleButtonPressed(static_cast<ButtonID>(sender->id())); | 188 HandleButtonPressed(static_cast<ButtonID>(sender->id())); |
| 189 } | 189 } |
| 190 | 190 |
| 191 views::View* TranslateBubbleView::GetInitiallyFocusedView() { |
| 192 return GetCurrentView()->GetNextFocusableView(); |
| 193 } |
| 194 |
| 191 bool TranslateBubbleView::ShouldShowCloseButton() const { | 195 bool TranslateBubbleView::ShouldShowCloseButton() const { |
| 192 return Use2016Q2UI(); | 196 return Use2016Q2UI(); |
| 193 } | 197 } |
| 194 | 198 |
| 195 void TranslateBubbleView::WindowClosing() { | 199 void TranslateBubbleView::WindowClosing() { |
| 196 // The operations for |model_| are valid only when a WebContents is alive. | 200 // The operations for |model_| are valid only when a WebContents is alive. |
| 197 // TODO(hajimehoshi): TranslateBubbleViewModel(Impl) should not hold a | 201 // TODO(hajimehoshi): TranslateBubbleViewModel(Impl) should not hold a |
| 198 // WebContents as a member variable because the WebContents might be destroyed | 202 // WebContents as a member variable because the WebContents might be destroyed |
| 199 // while the TranslateBubbleViewModel(Impl) is still alive. Instead, | 203 // while the TranslateBubbleViewModel(Impl) is still alive. Instead, |
| 200 // TranslateBubbleViewModel should take a reference of a WebContents at each | 204 // TranslateBubbleViewModel should take a reference of a WebContents at each |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 base::string16 label; | 945 base::string16 label; |
| 942 if (model_->IsPageTranslatedInCurrentLanguages()) | 946 if (model_->IsPageTranslatedInCurrentLanguages()) |
| 943 label = l10n_util::GetStringUTF16(IDS_DONE); | 947 label = l10n_util::GetStringUTF16(IDS_DONE); |
| 944 else | 948 else |
| 945 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); | 949 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); |
| 946 advanced_done_button_->SetText(label); | 950 advanced_done_button_->SetText(label); |
| 947 advanced_done_button_->SizeToPreferredSize(); | 951 advanced_done_button_->SizeToPreferredSize(); |
| 948 if (advanced_view_) | 952 if (advanced_view_) |
| 949 advanced_view_->Layout(); | 953 advanced_view_->Layout(); |
| 950 } | 954 } |
| OLD | NEW |