| 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/gtk/infobars/translate_infobar_base_gtk.h" | 5 #include "chrome/browser/ui/gtk/infobars/translate_infobar_base_gtk.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/infobars/infobar_tab_helper.h" | 8 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 9 #include "chrome/browser/translate/options_menu_model.h" | 9 #include "chrome/browser/translate/options_menu_model.h" |
| 10 #include "chrome/browser/translate/translate_infobar_delegate.h" | 10 #include "chrome/browser/translate/translate_infobar_delegate.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 TranslateInfoBarDelegate* TranslateInfoBarBase::GetDelegate() { | 189 TranslateInfoBarDelegate* TranslateInfoBarBase::GetDelegate() { |
| 190 return static_cast<TranslateInfoBarDelegate*>(delegate()); | 190 return static_cast<TranslateInfoBarDelegate*>(delegate()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void TranslateInfoBarBase::OnOptionsClicked(GtkWidget* sender) { | 193 void TranslateInfoBarBase::OnOptionsClicked(GtkWidget* sender) { |
| 194 ShowMenuWithModel(sender, NULL, new OptionsMenuModel(GetDelegate())); | 194 ShowMenuWithModel(sender, NULL, new OptionsMenuModel(GetDelegate())); |
| 195 } | 195 } |
| 196 | 196 |
| 197 // TranslateInfoBarDelegate specific method: | 197 // TranslateInfoBarDelegate specific method: |
| 198 InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarTabService* owner) { | 198 InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
| 199 InfoBarTabHelper* helper = static_cast<InfoBarTabHelper*>(owner); | 199 InfoBarTabHelper* helper = static_cast<InfoBarTabHelper*>(owner); |
| 200 TranslateInfoBarBase* infobar = NULL; | 200 TranslateInfoBarBase* infobar = NULL; |
| 201 switch (type_) { | 201 switch (type_) { |
| 202 case BEFORE_TRANSLATE: | 202 case BEFORE_TRANSLATE: |
| 203 infobar = new BeforeTranslateInfoBar(helper, this); | 203 infobar = new BeforeTranslateInfoBar(helper, this); |
| 204 break; | 204 break; |
| 205 case AFTER_TRANSLATE: | 205 case AFTER_TRANSLATE: |
| 206 infobar = new AfterTranslateInfoBar(helper, this); | 206 infobar = new AfterTranslateInfoBar(helper, this); |
| 207 break; | 207 break; |
| 208 case TRANSLATING: | 208 case TRANSLATING: |
| 209 case TRANSLATION_ERROR: | 209 case TRANSLATION_ERROR: |
| 210 infobar = new TranslateMessageInfoBar(helper, this); | 210 infobar = new TranslateMessageInfoBar(helper, this); |
| 211 break; | 211 break; |
| 212 default: | 212 default: |
| 213 NOTREACHED(); | 213 NOTREACHED(); |
| 214 } | 214 } |
| 215 infobar->Init(); | 215 infobar->Init(); |
| 216 return infobar; | 216 return infobar; |
| 217 } | 217 } |
| OLD | NEW |