Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: chrome/browser/ui/views/translate/translate_bubble_view.cc

Issue 2905243003: Cleanup BookmarkBubbleView, remove LocationBarBubbleDelegateView::GetDialogButtons() (Closed)
Patch Set: neater Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 advanced_done_button_ = 893 advanced_done_button_ =
889 Use2016Q2UI() ? views::MdTextButton::CreateSecondaryUiBlueButton( 894 Use2016Q2UI() ? views::MdTextButton::CreateSecondaryUiBlueButton(
890 this, l10n_util::GetStringUTF16(IDS_DONE)) 895 this, l10n_util::GetStringUTF16(IDS_DONE))
891 : views::MdTextButton::CreateSecondaryUiButton( 896 : views::MdTextButton::CreateSecondaryUiButton(
892 this, l10n_util::GetStringUTF16(IDS_DONE)); 897 this, l10n_util::GetStringUTF16(IDS_DONE));
893 advanced_done_button_->set_id(BUTTON_ID_DONE); 898 advanced_done_button_->set_id(BUTTON_ID_DONE);
894 advanced_done_button_->SetIsDefault(true); 899 advanced_done_button_->SetIsDefault(true);
895 advanced_cancel_button_ = views::MdTextButton::CreateSecondaryUiButton( 900 advanced_cancel_button_ = views::MdTextButton::CreateSecondaryUiButton(
896 this, l10n_util::GetStringUTF16(IDS_CANCEL)); 901 this, l10n_util::GetStringUTF16(IDS_CANCEL));
897 advanced_cancel_button_->set_id(BUTTON_ID_CANCEL); 902 advanced_cancel_button_->set_id(BUTTON_ID_CANCEL);
898 // TODO(estade): this should be using GetDialogButtons().
899 layout->AddView(advanced_done_button_); 903 layout->AddView(advanced_done_button_);
900 layout->AddView(advanced_cancel_button_); 904 layout->AddView(advanced_cancel_button_);
901 905
902 UpdateAdvancedView(); 906 UpdateAdvancedView();
903 907
904 return view; 908 return view;
905 } 909 }
906 910
907 views::Checkbox* TranslateBubbleView::GetAlwaysTranslateCheckbox() { 911 views::Checkbox* TranslateBubbleView::GetAlwaysTranslateCheckbox() {
908 if (model_->GetViewState() == TranslateBubbleModel::VIEW_STATE_ADVANCED) { 912 if (model_->GetViewState() == TranslateBubbleModel::VIEW_STATE_ADVANCED) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 base::string16 label; 958 base::string16 label;
955 if (model_->IsPageTranslatedInCurrentLanguages()) 959 if (model_->IsPageTranslatedInCurrentLanguages())
956 label = l10n_util::GetStringUTF16(IDS_DONE); 960 label = l10n_util::GetStringUTF16(IDS_DONE);
957 else 961 else
958 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); 962 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT);
959 advanced_done_button_->SetText(label); 963 advanced_done_button_->SetText(label);
960 advanced_done_button_->SizeToPreferredSize(); 964 advanced_done_button_->SizeToPreferredSize();
961 if (advanced_view_) 965 if (advanced_view_)
962 advanced_view_->Layout(); 966 advanced_view_->Layout();
963 } 967 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698