| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 advanced_done_button_(NULL), | 359 advanced_done_button_(NULL), |
| 360 denial_menu_button_(NULL), | 360 denial_menu_button_(NULL), |
| 361 model_(std::move(model)), | 361 model_(std::move(model)), |
| 362 error_type_(error_type), | 362 error_type_(error_type), |
| 363 is_in_incognito_window_( | 363 is_in_incognito_window_( |
| 364 web_contents && web_contents->GetBrowserContext()->IsOffTheRecord()), | 364 web_contents && web_contents->GetBrowserContext()->IsOffTheRecord()), |
| 365 should_always_translate_(false) { | 365 should_always_translate_(false) { |
| 366 translate_bubble_view_ = this; | 366 translate_bubble_view_ = this; |
| 367 if (web_contents) // web_contents can be null in unit_tests. | 367 if (web_contents) // web_contents can be null in unit_tests. |
| 368 mouse_handler_.reset(new WebContentMouseHandler(this, web_contents)); | 368 mouse_handler_.reset(new WebContentMouseHandler(this, web_contents)); |
| 369 RecordDialogCreation(chrome::DialogIdentifier::TRANSLATE); | 369 chrome::RecordDialogCreation(chrome::DialogIdentifier::TRANSLATE); |
| 370 } | 370 } |
| 371 | 371 |
| 372 views::View* TranslateBubbleView::GetCurrentView() const { | 372 views::View* TranslateBubbleView::GetCurrentView() const { |
| 373 switch (model_->GetViewState()) { | 373 switch (model_->GetViewState()) { |
| 374 case TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE: | 374 case TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE: |
| 375 return before_translate_view_; | 375 return before_translate_view_; |
| 376 case TranslateBubbleModel::VIEW_STATE_TRANSLATING: | 376 case TranslateBubbleModel::VIEW_STATE_TRANSLATING: |
| 377 return translating_view_; | 377 return translating_view_; |
| 378 case TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE: | 378 case TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE: |
| 379 return after_translate_view_; | 379 return after_translate_view_; |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 base::string16 label; | 946 base::string16 label; |
| 947 if (model_->IsPageTranslatedInCurrentLanguages()) | 947 if (model_->IsPageTranslatedInCurrentLanguages()) |
| 948 label = l10n_util::GetStringUTF16(IDS_DONE); | 948 label = l10n_util::GetStringUTF16(IDS_DONE); |
| 949 else | 949 else |
| 950 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); | 950 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); |
| 951 advanced_done_button_->SetText(label); | 951 advanced_done_button_->SetText(label); |
| 952 advanced_done_button_->SizeToPreferredSize(); | 952 advanced_done_button_->SizeToPreferredSize(); |
| 953 if (advanced_view_) | 953 if (advanced_view_) |
| 954 advanced_view_->Layout(); | 954 advanced_view_->Layout(); |
| 955 } | 955 } |
| OLD | NEW |