| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void AfterTranslateInfoBar::ButtonPressed(views::Button* sender, | 142 void AfterTranslateInfoBar::ButtonPressed(views::Button* sender, |
| 143 const ui::Event& event) { | 143 const ui::Event& event) { |
| 144 if (!owner()) | 144 if (!owner()) |
| 145 return; // We're closing; don't call anything, it might access the owner. | 145 return; // We're closing; don't call anything, it might access the owner. |
| 146 if (sender == revert_button_) | 146 if (sender == revert_button_) |
| 147 GetDelegate()->RevertTranslation(); | 147 GetDelegate()->RevertTranslation(); |
| 148 else | 148 else |
| 149 TranslateInfoBarBase::ButtonPressed(sender, event); | 149 TranslateInfoBarBase::ButtonPressed(sender, event); |
| 150 } | 150 } |
| 151 | 151 |
| 152 int AfterTranslateInfoBar::ContentMinimumWidth() { | 152 int AfterTranslateInfoBar::ContentMinimumWidth() const { |
| 153 return label_1_->GetMinimumSize().width() + | 153 return label_1_->GetMinimumSize().width() + |
| 154 label_2_->GetMinimumSize().width() + label_3_->GetMinimumSize().width() + | 154 label_2_->GetMinimumSize().width() + label_3_->GetMinimumSize().width() + |
| 155 NonLabelWidth(); | 155 NonLabelWidth(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void AfterTranslateInfoBar::OnMenuButtonClicked(views::View* source, | 158 void AfterTranslateInfoBar::OnMenuButtonClicked(views::View* source, |
| 159 const gfx::Point& point) { | 159 const gfx::Point& point) { |
| 160 if (!owner()) | 160 if (!owner()) |
| 161 return; // We're closing; don't call anything, it might access the owner. | 161 return; // We're closing; don't call anything, it might access the owner. |
| 162 if (source == original_language_menu_button_) { | 162 if (source == original_language_menu_button_) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 193 if (!autodetermined_source_language_) { | 193 if (!autodetermined_source_language_) { |
| 194 width += | 194 width += |
| 195 (label_2_->text().empty() ? | 195 (label_2_->text().empty() ? |
| 196 kButtonButtonSpacing : kButtonInLabelSpacing) + | 196 kButtonButtonSpacing : kButtonInLabelSpacing) + |
| 197 second_button->width() + | 197 second_button->width() + |
| 198 (label_3_->text().empty() ? 0 : kButtonInLabelSpacing); | 198 (label_3_->text().empty() ? 0 : kButtonInLabelSpacing); |
| 199 } | 199 } |
| 200 return width + kEndOfLabelSpacing + revert_button_->width() + | 200 return width + kEndOfLabelSpacing + revert_button_->width() + |
| 201 kEndOfLabelSpacing + options_menu_button_->width(); | 201 kEndOfLabelSpacing + options_menu_button_->width(); |
| 202 } | 202 } |
| OLD | NEW |