| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 TranslateBubbleView::~TranslateBubbleView() { | 70 TranslateBubbleView::~TranslateBubbleView() { |
| 71 // A child view could refer to a model which is owned by this class when | 71 // A child view could refer to a model which is owned by this class when |
| 72 // the child view is destructed. For example, |source_language_combobx_model_| | 72 // the child view is destructed. For example, |source_language_combobx_model_| |
| 73 // is referred by Combobox's destructor. Before destroying the models, | 73 // is referred by Combobox's destructor. Before destroying the models, |
| 74 // removing the child views is needed. | 74 // removing the child views is needed. |
| 75 RemoveAllChildViews(true); | 75 RemoveAllChildViews(true); |
| 76 } | 76 } |
| 77 | 77 |
| 78 // static | 78 // static |
| 79 void TranslateBubbleView::ShowBubble( | 79 void TranslateBubbleView::ShowBubble( |
| 80 views::View* anchor_view, | 80 views::WidgetObserverView* anchor_view, |
| 81 content::WebContents* web_contents, | 81 content::WebContents* web_contents, |
| 82 translate::TranslateStep step, | 82 translate::TranslateStep step, |
| 83 translate::TranslateErrors::Type error_type, | 83 translate::TranslateErrors::Type error_type, |
| 84 DisplayReason reason) { | 84 DisplayReason reason) { |
| 85 if (translate_bubble_view_) { | 85 if (translate_bubble_view_) { |
| 86 // When the user reads the advanced setting panel, the bubble should not be | 86 // When the user reads the advanced setting panel, the bubble should not be |
| 87 // changed because they are focusing on the bubble. | 87 // changed because they are focusing on the bubble. |
| 88 if (translate_bubble_view_->web_contents() == web_contents && | 88 if (translate_bubble_view_->web_contents() == web_contents && |
| 89 translate_bubble_view_->model()->GetViewState() == | 89 translate_bubble_view_->model()->GetViewState() == |
| 90 TranslateBubbleModel::VIEW_STATE_ADVANCED) { | 90 TranslateBubbleModel::VIEW_STATE_ADVANCED) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 void TranslateBubbleView::WebContentsDestroyed() { | 236 void TranslateBubbleView::WebContentsDestroyed() { |
| 237 GetWidget()->CloseNow(); | 237 GetWidget()->CloseNow(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 TranslateBubbleModel::ViewState TranslateBubbleView::GetViewState() const { | 240 TranslateBubbleModel::ViewState TranslateBubbleView::GetViewState() const { |
| 241 return model_->GetViewState(); | 241 return model_->GetViewState(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 TranslateBubbleView::TranslateBubbleView( | 244 TranslateBubbleView::TranslateBubbleView( |
| 245 views::View* anchor_view, | 245 views::WidgetObserverView* anchor_view, |
| 246 scoped_ptr<TranslateBubbleModel> model, | 246 scoped_ptr<TranslateBubbleModel> model, |
| 247 translate::TranslateErrors::Type error_type, | 247 translate::TranslateErrors::Type error_type, |
| 248 content::WebContents* web_contents) | 248 content::WebContents* web_contents) |
| 249 : LocationBarBubbleDelegateView(anchor_view, web_contents), | 249 : LocationBarBubbleDelegateView(anchor_view, web_contents), |
| 250 WebContentsObserver(web_contents), | 250 WebContentsObserver(web_contents), |
| 251 before_translate_view_(NULL), | 251 before_translate_view_(NULL), |
| 252 translating_view_(NULL), | 252 translating_view_(NULL), |
| 253 after_translate_view_(NULL), | 253 after_translate_view_(NULL), |
| 254 error_view_(NULL), | 254 error_view_(NULL), |
| 255 advanced_view_(NULL), | 255 advanced_view_(NULL), |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 base::string16 label; | 755 base::string16 label; |
| 756 if (model_->IsPageTranslatedInCurrentLanguages()) | 756 if (model_->IsPageTranslatedInCurrentLanguages()) |
| 757 label = l10n_util::GetStringUTF16(IDS_DONE); | 757 label = l10n_util::GetStringUTF16(IDS_DONE); |
| 758 else | 758 else |
| 759 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); | 759 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); |
| 760 advanced_done_button_->SetText(label); | 760 advanced_done_button_->SetText(label); |
| 761 advanced_done_button_->SizeToPreferredSize(); | 761 advanced_done_button_->SizeToPreferredSize(); |
| 762 if (advanced_view_) | 762 if (advanced_view_) |
| 763 advanced_view_->Layout(); | 763 advanced_view_->Layout(); |
| 764 } | 764 } |
| OLD | NEW |