OLD | NEW |
| (Empty) |
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_TRANSLATE_LANGUAGE_MENU_MODEL_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_LANGUAGE_MENU_MODEL_H_ | |
7 | |
8 #include "ui/base/models/simple_menu_model.h" | |
9 | |
10 class TranslateInfoBarBase; | |
11 class TranslateInfoBarDelegate; | |
12 | |
13 namespace views { | |
14 class MenuButton; | |
15 } | |
16 | |
17 // A menu model that builds the contents of the language menus in the translate | |
18 // infobar. This menu has only one level (no submenus). | |
19 class TranslateLanguageMenuModel : public ui::SimpleMenuModel, | |
20 public ui::SimpleMenuModel::Delegate { | |
21 public: | |
22 enum LanguageType { | |
23 ORIGINAL, | |
24 TARGET | |
25 }; | |
26 | |
27 TranslateLanguageMenuModel(LanguageType language_type, | |
28 TranslateInfoBarDelegate* infobar_delegate, | |
29 TranslateInfoBarBase* infobar, | |
30 views::MenuButton* button, | |
31 bool translate_on_change); | |
32 virtual ~TranslateLanguageMenuModel(); | |
33 | |
34 // ui::SimpleMenuModel::Delegate implementation: | |
35 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
36 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
37 virtual bool GetAcceleratorForCommandId( | |
38 int command_id, | |
39 ui::Accelerator* accelerator) OVERRIDE; | |
40 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | |
41 | |
42 private: | |
43 size_t GetLanguageIndex() const; | |
44 | |
45 LanguageType language_type_; | |
46 TranslateInfoBarDelegate* infobar_delegate_; | |
47 TranslateInfoBarBase* infobar_; | |
48 views::MenuButton* button_; | |
49 const bool translate_on_change_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(TranslateLanguageMenuModel); | |
52 }; | |
53 | |
54 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_LANGUAGE_MENU_MODEL_H_ | |
OLD | NEW |