Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: chrome/browser/ui/views/infobars/translate_language_menu_model.h

Issue 10952016: Simplify the translate infobar code some. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_TRANSLATE_LANGUAGES_MENU_MODEL_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_LANGUAGE_MENU_MODEL_H_
6 #define CHROME_BROWSER_TRANSLATE_LANGUAGES_MENU_MODEL_H_ 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_LANGUAGE_MENU_MODEL_H_
7 7
8 #include "ui/base/models/simple_menu_model.h" 8 #include "ui/base/models/simple_menu_model.h"
9 9
10 class TranslateInfoBarBase;
10 class TranslateInfoBarDelegate; 11 class TranslateInfoBarDelegate;
12 namespace views {
13 class MenuButton;
14 }
11 15
12 // A menu model that builds the contents of the language menus in the translate 16 // A menu model that builds the contents of the language menus in the translate
13 // infobar. This menu has only one level (no submenus). 17 // infobar. This menu has only one level (no submenus).
14 class LanguagesMenuModel : public ui::SimpleMenuModel, 18 class TranslateLanguageMenuModel : public ui::SimpleMenuModel,
15 public ui::SimpleMenuModel::Delegate { 19 public ui::SimpleMenuModel::Delegate {
16 public: 20 public:
17 enum LanguageType { 21 enum LanguageType {
18 ORIGINAL, 22 ORIGINAL,
19 TARGET 23 TARGET
20 }; 24 };
21 LanguagesMenuModel(TranslateInfoBarDelegate* translate_delegate, 25 TranslateLanguageMenuModel(LanguageType language_type,
sky 2012/09/19 14:18:07 nit: newline between 24/25
22 LanguageType language_type); 26 TranslateInfoBarDelegate* infobar_delegate,
23 virtual ~LanguagesMenuModel(); 27 TranslateInfoBarBase* infobar,
28 views::MenuButton* button,
29 bool translate_on_change);
30 virtual ~TranslateLanguageMenuModel();
24 31
25 // ui::SimpleMenuModel::Delegate implementation: 32 // ui::SimpleMenuModel::Delegate implementation:
26 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 33 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
27 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 34 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
28 virtual bool GetAcceleratorForCommandId( 35 virtual bool GetAcceleratorForCommandId(
29 int command_id, 36 int command_id,
30 ui::Accelerator* accelerator) OVERRIDE; 37 ui::Accelerator* accelerator) OVERRIDE;
31 virtual void ExecuteCommand(int command_id) OVERRIDE; 38 virtual void ExecuteCommand(int command_id) OVERRIDE;
32 39
33 private: 40 private:
34 TranslateInfoBarDelegate* translate_infobar_delegate_; 41 size_t GetLanguageIndex() const;
42
35 LanguageType language_type_; 43 LanguageType language_type_;
44 TranslateInfoBarDelegate* infobar_delegate_;
45 TranslateInfoBarBase* infobar_;
46 views::MenuButton* button_;
47 bool translate_on_change_;
sky 2012/09/19 14:18:07 nit: const
36 48
37 DISALLOW_COPY_AND_ASSIGN(LanguagesMenuModel); 49 DISALLOW_COPY_AND_ASSIGN(TranslateLanguageMenuModel);
38 }; 50 };
39 51
40 #endif // CHROME_BROWSER_TRANSLATE_LANGUAGES_MENU_MODEL_H_ 52 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_LANGUAGE_MENU_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698