[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / infobars / translate_language_menu_model.h
blob078a1400d46f91a64073fb545611593968ff2685
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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_LANGUAGE_MENU_MODEL_H_
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_LANGUAGE_MENU_MODEL_H_
8 #include "ui/base/models/simple_menu_model.h"
10 class TranslateInfoBarBase;
11 class TranslateInfoBarDelegate;
13 namespace views {
14 class MenuButton;
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
27 TranslateLanguageMenuModel(LanguageType language_type,
28 TranslateInfoBarDelegate* infobar_delegate,
29 TranslateInfoBarBase* infobar,
30 views::MenuButton* button,
31 bool translate_on_change);
32 virtual ~TranslateLanguageMenuModel();
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;
42 private:
43 size_t GetLanguageIndex() const;
45 LanguageType language_type_;
46 TranslateInfoBarDelegate* infobar_delegate_;
47 TranslateInfoBarBase* infobar_;
48 views::MenuButton* button_;
49 const bool translate_on_change_;
51 DISALLOW_COPY_AND_ASSIGN(TranslateLanguageMenuModel);
54 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_LANGUAGE_MENU_MODEL_H_