OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/infobars/before_translate_infobar.h" | 5 #include "chrome/browser/views/infobars/before_translate_infobar.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/translate/options_menu_model.h" | 10 #include "chrome/browser/translate/options_menu_model.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 deny_button_->SetBounds( | 89 deny_button_->SetBounds( |
90 accept_button_->bounds().right() + InfoBar::kButtonButtonSpacing, | 90 accept_button_->bounds().right() + InfoBar::kButtonButtonSpacing, |
91 OffsetY(this, pref_size), pref_size.width(), pref_size.height()); | 91 OffsetY(this, pref_size), pref_size.width(), pref_size.height()); |
92 } | 92 } |
93 | 93 |
94 void BeforeTranslateInfoBar::ButtonPressed(views::Button* sender, | 94 void BeforeTranslateInfoBar::ButtonPressed(views::Button* sender, |
95 const views::Event& event) { | 95 const views::Event& event) { |
96 if (sender == accept_button_) { | 96 if (sender == accept_button_) { |
97 GetDelegate()->Translate(); | 97 GetDelegate()->Translate(); |
98 } else if (sender == deny_button_) { | 98 } else if (sender == deny_button_) { |
99 Close(); | 99 RemoveInfoBar(); |
100 } else { | 100 } else { |
101 TranslateInfoBarBase::ButtonPressed(sender, event); | 101 TranslateInfoBarBase::ButtonPressed(sender, event); |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 void BeforeTranslateInfoBar::OriginalLanguageChanged() { | 105 void BeforeTranslateInfoBar::OriginalLanguageChanged() { |
106 UpdateOriginalButtonText(); | 106 UpdateOriginalButtonText(); |
107 } | 107 } |
108 | 108 |
109 void BeforeTranslateInfoBar::TargetLanguageChanged() { | 109 void BeforeTranslateInfoBar::TargetLanguageChanged() { |
(...skipping 18 matching lines...) Expand all Loading... |
128 void BeforeTranslateInfoBar::UpdateOriginalButtonText() { | 128 void BeforeTranslateInfoBar::UpdateOriginalButtonText() { |
129 string16 language = GetDelegate()->GetLanguageDisplayableNameAt( | 129 string16 language = GetDelegate()->GetLanguageDisplayableNameAt( |
130 GetDelegate()->original_language_index()); | 130 GetDelegate()->original_language_index()); |
131 language_menu_button_->SetText(UTF16ToWideHack(language)); | 131 language_menu_button_->SetText(UTF16ToWideHack(language)); |
132 // The following line is necessary for the preferred size to be recomputed. | 132 // The following line is necessary for the preferred size to be recomputed. |
133 language_menu_button_->ClearMaxTextSize(); | 133 language_menu_button_->ClearMaxTextSize(); |
134 // The button may have to grow to show the new text. | 134 // The button may have to grow to show the new text. |
135 Layout(); | 135 Layout(); |
136 SchedulePaint(); | 136 SchedulePaint(); |
137 } | 137 } |
OLD | NEW |