Home | History | Annotate | Download | only in infobars
      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_BEFORE_TRANSLATE_INFOBAR_H_
      6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_BEFORE_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 BeforeTranslateInfoBar : public TranslateInfoBarBase,
     21                                public views::ViewMenuDelegate {
     22  public:
     23   explicit BeforeTranslateInfoBar(TranslateInfoBarDelegate* delegate);
     24 
     25  private:
     26   virtual ~BeforeTranslateInfoBar();
     27 
     28   // TranslateInfoBarBase:
     29   virtual void Layout();
     30   virtual void ButtonPressed(views::Button* sender, const views::Event& event);
     31   virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
     32   virtual int ContentMinimumWidth() const;
     33   virtual void OriginalLanguageChanged();
     34 
     35   // views::ViewMenuDelegate:
     36   virtual void RunMenu(View* source, const gfx::Point& pt);
     37 
     38   // The text displayed in the infobar is something like:
     39   // "The page is in <lang>. Would you like to translate it?"
     40   // ...where <lang> is a combobox.  So the text is split in 2 chunks, each
     41   // displayed in one of the labels below.
     42   views::Label* label_1_;
     43   views::Label* label_2_;
     44 
     45   views::MenuButton* language_menu_button_;
     46   views::TextButton* accept_button_;
     47   views::TextButton* deny_button_;
     48   views::TextButton* never_translate_button_;
     49   views::TextButton* always_translate_button_;
     50   views::MenuButton* options_menu_button_;
     51 
     52   LanguagesMenuModel languages_menu_model_;
     53   scoped_ptr<views::Menu2> languages_menu_;
     54 
     55   OptionsMenuModel options_menu_model_;
     56   scoped_ptr<views::Menu2> options_menu_;
     57 
     58   DISALLOW_COPY_AND_ASSIGN(BeforeTranslateInfoBar);
     59 };
     60 
     61 #endif  // CHROME_BROWSER_UI_VIEWS_INFOBARS_BEFORE_TRANSLATE_INFOBAR_H_
     62