1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_AFTER_TRANSLATE_INFOBAR_H_ 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_AFTER_TRANSLATE_INFOBAR_H_ 7 #pragma once 8 9 #include "chrome/browser/translate/languages_menu_model.h" 10 #include "chrome/browser/translate/options_menu_model.h" 11 #include "chrome/browser/ui/views/infobars/translate_infobar_base.h" 12 #include "views/controls/menu/view_menu_delegate.h" 13 14 class TranslateInfoBarDelegate; 15 namespace views { 16 class Menu2; 17 class MenuButton; 18 } 19 20 class AfterTranslateInfoBar : public TranslateInfoBarBase, 21 public views::ViewMenuDelegate { 22 public: 23 explicit AfterTranslateInfoBar(TranslateInfoBarDelegate* delegate); 24 25 private: 26 virtual ~AfterTranslateInfoBar(); 27 28 // TranslateInfoBarBase: 29 virtual void Layout(); 30 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); 31 virtual void ButtonPressed(views::Button* sender, const views::Event& event); 32 virtual int ContentMinimumWidth() const; 33 virtual void OriginalLanguageChanged(); 34 virtual void TargetLanguageChanged(); 35 36 // ViewMenuDelegate: 37 virtual void RunMenu(View* source, const gfx::Point& pt); 38 39 // The text displayed in the infobar is something like: 40 // "Translated from <lang1> to <lang2> [more text in some languages]" 41 // ...where <lang1> and <lang2> are comboboxes. So the text is split in 3 42 // chunks, each displayed in one of the labels below. 43 views::Label* label_1_; 44 views::Label* label_2_; 45 views::Label* label_3_; 46 47 views::MenuButton* original_language_menu_button_; 48 views::MenuButton* target_language_menu_button_; 49 views::TextButton* revert_button_; 50 views::MenuButton* options_menu_button_; 51 52 LanguagesMenuModel original_language_menu_model_; 53 scoped_ptr<views::Menu2> original_language_menu_; 54 55 LanguagesMenuModel target_language_menu_model_; 56 scoped_ptr<views::Menu2> target_language_menu_; 57 58 OptionsMenuModel options_menu_model_; 59 scoped_ptr<views::Menu2> options_menu_; 60 61 // True if the target language comes before the original one. 62 bool swapped_language_buttons_; 63 64 DISALLOW_COPY_AND_ASSIGN(AfterTranslateInfoBar); 65 }; 66 67 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_AFTER_TRANSLATE_INFOBAR_H_ 68