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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_BEFORE_TRANSLATE_INFOBAR_H_
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_BEFORE_TRANSLATE_INFOBAR_H_
8 #include "chrome/browser/ui/views/infobars/translate_infobar_base.h"
9 #include "ui/views/controls/button/menu_button_listener.h"
11 class OptionsMenuModel
;
12 class TranslateInfoBarDelegate
;
13 class TranslateLanguageMenuModel
;
19 class BeforeTranslateInfoBar
: public TranslateInfoBarBase
,
20 public views::MenuButtonListener
{
22 explicit BeforeTranslateInfoBar(
23 scoped_ptr
<TranslateInfoBarDelegate
> delegate
);
26 virtual ~BeforeTranslateInfoBar();
28 // TranslateInfoBarBase:
29 virtual void Layout() OVERRIDE
;
30 virtual void ButtonPressed(views::Button
* sender
,
31 const ui::Event
& event
) OVERRIDE
;
32 virtual void ViewHierarchyChanged(
33 const ViewHierarchyChangedDetails
& details
) OVERRIDE
;
34 virtual int ContentMinimumWidth() const OVERRIDE
;
36 // views::MenuButtonListener:
37 virtual void OnMenuButtonClicked(views::View
* source
,
38 const gfx::Point
& point
) OVERRIDE
;
40 // Returns the width of all content other than the labels. Layout() uses this
41 // to determine how much space the labels can take.
42 int NonLabelWidth() const;
44 // The text displayed in the infobar is something like:
45 // "The page is in <lang>. Would you like to translate it?"
46 // ...where <lang> is a combobox. So the text is split in 2 chunks, each
47 // displayed in one of the labels below.
48 views::Label
* label_1_
;
49 views::Label
* label_2_
;
51 views::MenuButton
* language_menu_button_
;
52 views::LabelButton
* accept_button_
;
53 views::LabelButton
* deny_button_
;
54 views::LabelButton
* never_translate_button_
;
55 views::LabelButton
* always_translate_button_
;
56 views::MenuButton
* options_menu_button_
;
58 scoped_ptr
<TranslateLanguageMenuModel
> language_menu_model_
;
59 scoped_ptr
<OptionsMenuModel
> options_menu_model_
;
61 DISALLOW_COPY_AND_ASSIGN(BeforeTranslateInfoBar
);
64 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_BEFORE_TRANSLATE_INFOBAR_H_