OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/infobars/after_translate_infobar.h" | 5 #include "chrome/browser/ui/views/infobars/after_translate_infobar.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/translate/options_menu_model.h" | 8 #include "chrome/browser/translate/options_menu_model.h" |
9 #include "chrome/browser/translate/translate_infobar_delegate.h" | 9 #include "chrome/browser/translate/translate_infobar_delegate.h" |
10 #include "chrome/browser/ui/views/infobars/translate_language_menu_model.h" | 10 #include "chrome/browser/ui/views/infobars/translate_language_menu_model.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 AddChildView(first_button); | 111 AddChildView(first_button); |
112 | 112 |
113 label_2_ = CreateLabel(strings[1]); | 113 label_2_ = CreateLabel(strings[1]); |
114 AddChildView(label_2_); | 114 AddChildView(label_2_); |
115 | 115 |
116 // These views may not always be shown, but adding them unconditionally | 116 // These views may not always be shown, but adding them unconditionally |
117 // prevents leaks and reduces NULL-checking elsewhere. | 117 // prevents leaks and reduces NULL-checking elsewhere. |
118 AddChildView(second_button); | 118 AddChildView(second_button); |
119 if (autodetermined_source_language_) | 119 if (autodetermined_source_language_) |
120 second_button->SetVisible(false); | 120 second_button->SetVisible(false); |
121 label_3_ = | 121 label_3_ = CreateLabel(autodetermined_source_language_ ? base::string16() : |
122 CreateLabel(autodetermined_source_language_ ? string16() : strings[2]); | 122 strings[2]); |
123 AddChildView(label_3_); | 123 AddChildView(label_3_); |
124 | 124 |
125 revert_button_ = CreateLabelButton(this, | 125 revert_button_ = CreateLabelButton(this, |
126 l10n_util::GetStringUTF16(IDS_TRANSLATE_INFOBAR_REVERT), false); | 126 l10n_util::GetStringUTF16(IDS_TRANSLATE_INFOBAR_REVERT), false); |
127 AddChildView(revert_button_); | 127 AddChildView(revert_button_); |
128 | 128 |
129 options_menu_button_ = CreateMenuButton( | 129 options_menu_button_ = CreateMenuButton( |
130 l10n_util::GetStringUTF16(IDS_TRANSLATE_INFOBAR_OPTIONS), this); | 130 l10n_util::GetStringUTF16(IDS_TRANSLATE_INFOBAR_OPTIONS), this); |
131 options_menu_model_.reset(new OptionsMenuModel(delegate)); | 131 options_menu_model_.reset(new OptionsMenuModel(delegate)); |
132 AddChildView(options_menu_button_); | 132 AddChildView(options_menu_button_); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 184 } |
185 | 185 |
186 void AfterTranslateInfoBar::GetButtons( | 186 void AfterTranslateInfoBar::GetButtons( |
187 views::MenuButton** first_button, | 187 views::MenuButton** first_button, |
188 views::MenuButton** second_button) const { | 188 views::MenuButton** second_button) const { |
189 *first_button = original_language_menu_button_; | 189 *first_button = original_language_menu_button_; |
190 *second_button = target_language_menu_button_; | 190 *second_button = target_language_menu_button_; |
191 if (swapped_language_buttons_ || autodetermined_source_language_) | 191 if (swapped_language_buttons_ || autodetermined_source_language_) |
192 std::swap(*first_button, *second_button); | 192 std::swap(*first_button, *second_button); |
193 } | 193 } |
OLD | NEW |