| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CHROMEOS_LOGIN_LANGUAGE_SWITCH_MODEL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LANGUAGE_SWITCH_MODEL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LANGUAGE_SWITCH_MODEL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LANGUAGE_SWITCH_MODEL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "app/menus/simple_menu_model.h" | 10 #include "app/menus/simple_menu_model.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // Returns original width of the first level menu to be shown when called. | 35 // Returns original width of the first level menu to be shown when called. |
| 36 int GetFirstLevelMenuWidth() const; | 36 int GetFirstLevelMenuWidth() const; |
| 37 void SetFirstLevelMenuWidth(int width); | 37 void SetFirstLevelMenuWidth(int width); |
| 38 | 38 |
| 39 void set_menu_offset(int delta_x, int delta_y) { | 39 void set_menu_offset(int delta_x, int delta_y) { |
| 40 delta_x_ = delta_x; | 40 delta_x_ = delta_x; |
| 41 delta_y_ = delta_y; | 41 delta_y_ = delta_y; |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Switches the current locale, saves the new locale in preferences. |
| 45 static void SwitchLanguage(const std::string& locale); |
| 46 |
| 44 private: | 47 private: |
| 45 // views::ViewMenuDelegate implementation. | 48 // views::ViewMenuDelegate implementation. |
| 46 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 49 virtual void RunMenu(views::View* source, const gfx::Point& pt); |
| 47 | 50 |
| 48 // menus::SimpleMenuModel::Delegate implementation. | 51 // menus::SimpleMenuModel::Delegate implementation. |
| 49 virtual bool IsCommandIdChecked(int command_id) const; | 52 virtual bool IsCommandIdChecked(int command_id) const; |
| 50 virtual bool IsCommandIdEnabled(int command_id) const; | 53 virtual bool IsCommandIdEnabled(int command_id) const; |
| 51 virtual bool GetAcceleratorForCommandId(int command_id, | 54 virtual bool GetAcceleratorForCommandId(int command_id, |
| 52 menus::Accelerator* accelerator); | 55 menus::Accelerator* accelerator); |
| 53 virtual void ExecuteCommand(int command_id); | 56 virtual void ExecuteCommand(int command_id); |
| 54 | 57 |
| 55 // Switches the current locale, saves the new locale in preferences. | |
| 56 static void SwitchLanguage(const std::string& locale); | |
| 57 | |
| 58 // Dialog controls that we own ourselves. | 58 // Dialog controls that we own ourselves. |
| 59 menus::SimpleMenuModel menu_model_; | 59 menus::SimpleMenuModel menu_model_; |
| 60 menus::SimpleMenuModel menu_model_submenu_; | 60 menus::SimpleMenuModel menu_model_submenu_; |
| 61 scoped_ptr<views::Menu2> menu_; | 61 scoped_ptr<views::Menu2> menu_; |
| 62 | 62 |
| 63 // Language locale name storage. | 63 // Language locale name storage. |
| 64 scoped_ptr<LanguageList> language_list_; | 64 scoped_ptr<LanguageList> language_list_; |
| 65 | 65 |
| 66 int delta_x_, delta_y_; | 66 int delta_x_, delta_y_; |
| 67 | 67 |
| 68 FRIEND_TEST(::WizardControllerTest, SwitchLanguage); | 68 FRIEND_TEST(::WizardControllerTest, SwitchLanguage); |
| 69 DISALLOW_COPY_AND_ASSIGN(LanguageSwitchModel); | 69 DISALLOW_COPY_AND_ASSIGN(LanguageSwitchModel); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace chromeos | 72 } // namespace chromeos |
| 73 | 73 |
| 74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LANGUAGE_SWITCH_MODEL_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LANGUAGE_SWITCH_MODEL_H_ |
| OLD | NEW |