| 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_STATUS_INPUT_METHOD_MENU_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/chromeos/cros/input_method_library.h" | 11 #include "chrome/browser/chromeos/cros/input_method_library.h" |
| 12 #include "chrome/browser/chromeos/status/status_area_host.h" |
| 12 #include "chrome/browser/prefs/pref_member.h" | 13 #include "chrome/browser/prefs/pref_member.h" |
| 13 #include "chrome/common/notification_observer.h" | 14 #include "chrome/common/notification_observer.h" |
| 14 #include "chrome/common/notification_registrar.h" | 15 #include "chrome/common/notification_registrar.h" |
| 15 #include "chrome/common/notification_type.h" | 16 #include "chrome/common/notification_type.h" |
| 16 #include "ui/base/models/simple_menu_model.h" | 17 #include "ui/base/models/simple_menu_model.h" |
| 17 #include "views/controls/menu/menu_2.h" | 18 #include "views/controls/menu/menu_2.h" |
| 18 #include "views/controls/menu/view_menu_delegate.h" | 19 #include "views/controls/menu/view_menu_delegate.h" |
| 19 | 20 |
| 20 class PrefService; | 21 class PrefService; |
| 21 class SkBitmap; | 22 class SkBitmap; |
| 22 | 23 |
| 23 namespace chromeos { | 24 namespace chromeos { |
| 24 | 25 |
| 25 // A class for the dropdown menu for switching input method and keyboard layout. | 26 // A class for the dropdown menu for switching input method and keyboard layout. |
| 26 // Since the class provides the views::ViewMenuDelegate interface, it's easy to | 27 // Since the class provides the views::ViewMenuDelegate interface, it's easy to |
| 27 // create a button widget (e.g. views::MenuButton, chromeos::StatusAreaButton) | 28 // create a button widget (e.g. views::MenuButton, chromeos::StatusAreaButton) |
| 28 // which shows the dropdown menu on click. | 29 // which shows the dropdown menu on click. |
| 29 class InputMethodMenu : public views::ViewMenuDelegate, | 30 class InputMethodMenu : public views::ViewMenuDelegate, |
| 30 public ui::MenuModel, | 31 public ui::MenuModel, |
| 31 public InputMethodLibrary::Observer, | 32 public InputMethodLibrary::Observer, |
| 32 public NotificationObserver { | 33 public NotificationObserver { |
| 33 public: | 34 public: |
| 34 InputMethodMenu(PrefService* pref_service, | 35 InputMethodMenu(PrefService* pref_service, |
| 35 // TODO(yusukes): combine the three booleans into one enum. | 36 StatusAreaHost::ScreenMode screen_mode, |
| 36 // http://crosbug.com/8386. | 37 bool for_out_of_box_experience_dialog); |
| 37 bool is_browser_mode, | |
| 38 bool is_screen_locker, | |
| 39 bool is_out_of_box_experience_mode); | |
| 40 virtual ~InputMethodMenu(); | 38 virtual ~InputMethodMenu(); |
| 41 | 39 |
| 42 // ui::MenuModel implementation. | 40 // ui::MenuModel implementation. |
| 43 virtual bool HasIcons() const; | 41 virtual bool HasIcons() const; |
| 44 virtual int GetItemCount() const; | 42 virtual int GetItemCount() const; |
| 45 virtual ui::MenuModel::ItemType GetTypeAt(int index) const; | 43 virtual ui::MenuModel::ItemType GetTypeAt(int index) const; |
| 46 virtual int GetCommandIdAt(int index) const; | 44 virtual int GetCommandIdAt(int index) const; |
| 47 virtual string16 GetLabelAt(int index) const; | 45 virtual string16 GetLabelAt(int index) const; |
| 48 virtual bool IsItemDynamicAt(int index) const; | 46 virtual bool IsItemDynamicAt(int index) const; |
| 49 virtual bool GetAcceleratorAt(int index, | 47 virtual bool GetAcceleratorAt(int index, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // content of the pop-up menu. The ui::MenuModel is implemented using this | 154 // content of the pop-up menu. The ui::MenuModel is implemented using this |
| 157 // |model_|. | 155 // |model_|. |
| 158 scoped_ptr<ui::SimpleMenuModel> model_; | 156 scoped_ptr<ui::SimpleMenuModel> model_; |
| 159 | 157 |
| 160 // The language menu which pops up when the button in status area is clicked. | 158 // The language menu which pops up when the button in status area is clicked. |
| 161 views::Menu2 input_method_menu_; | 159 views::Menu2 input_method_menu_; |
| 162 int minimum_input_method_menu_width_; | 160 int minimum_input_method_menu_width_; |
| 163 | 161 |
| 164 PrefService* pref_service_; | 162 PrefService* pref_service_; |
| 165 NotificationRegistrar registrar_; | 163 NotificationRegistrar registrar_; |
| 166 const bool is_browser_mode_; | 164 |
| 167 const bool is_screen_locker_mode_; | 165 // The mode of the host screen (e.g. browser, screen locker, login screen.) |
| 168 const bool is_out_of_box_experience_mode_; | 166 const StatusAreaHost::ScreenMode screen_mode_; |
| 167 // true if the menu is for a dialog in OOBE screen. In the dialog, we don't |
| 168 // use radio buttons. |
| 169 const bool for_out_of_box_experience_dialog_; |
| 169 | 170 |
| 170 DISALLOW_COPY_AND_ASSIGN(InputMethodMenu); | 171 DISALLOW_COPY_AND_ASSIGN(InputMethodMenu); |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 } // namespace chromeos | 174 } // namespace chromeos |
| 174 | 175 |
| 175 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ | 176 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ |
| OLD | NEW |