OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 12 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
13 #include "chrome/browser/prefs/pref_member.h" | 13 #include "chrome/browser/prefs/pref_member.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "content/public/browser/notification_types.h" | 16 #include "content/public/browser/notification_types.h" |
17 #include "ui/base/models/menu_model.h" | 17 #include "ui/base/models/menu_model.h" |
18 #include "ui/views/controls/button/menu_button_delegate.h" | 18 #include "ui/views/controls/button/menu_button_listener.h" |
19 #include "ui/views/controls/menu/menu_item_view.h" | 19 #include "ui/views/controls/menu/menu_item_view.h" |
20 | 20 |
21 class PrefService; | 21 class PrefService; |
22 class SkBitmap; | 22 class SkBitmap; |
23 | 23 |
24 namespace ui { | 24 namespace ui { |
25 class SimpleMenuModel; | 25 class SimpleMenuModel; |
26 } // namespace ui | 26 } // namespace ui |
27 | 27 |
28 namespace views { | 28 namespace views { |
29 class MenuItemView; | 29 class MenuItemView; |
30 class MenuModelAdapter; | 30 class MenuModelAdapter; |
31 class MenuRunner; | 31 class MenuRunner; |
32 } // namespace views | 32 } // namespace views |
33 | 33 |
34 namespace chromeos { | 34 namespace chromeos { |
35 | 35 |
36 // A class for the dropdown menu for switching input method and keyboard layout. | 36 // A class for the dropdown menu for switching input method and keyboard layout. |
37 // Since the class provides the views::MenuButtonDelegate interface, it's easy | 37 // Since the class provides the views::MenuButtonListener interface, it's easy |
38 // to create a button widget (e.g. views::MenuButton, StatusAreaButton) which | 38 // to create a button widget (e.g. views::MenuButton, StatusAreaButton) which |
39 // shows the dropdown menu on click. | 39 // shows the dropdown menu on click. |
40 class InputMethodMenu | 40 class InputMethodMenu |
41 : public views::MenuButtonDelegate, | 41 : public views::MenuButtonListener, |
42 public ui::MenuModel, | 42 public ui::MenuModel, |
43 public input_method::InputMethodManager::Observer, | 43 public input_method::InputMethodManager::Observer, |
44 public input_method::InputMethodManager::PreferenceObserver, | 44 public input_method::InputMethodManager::PreferenceObserver, |
45 public content::NotificationObserver { | 45 public content::NotificationObserver { |
46 public: | 46 public: |
47 InputMethodMenu(PrefService* pref_service, | 47 InputMethodMenu(PrefService* pref_service, |
48 bool for_out_of_box_experience_dialog); | 48 bool for_out_of_box_experience_dialog); |
49 virtual ~InputMethodMenu(); | 49 virtual ~InputMethodMenu(); |
50 | 50 |
51 // ui::MenuModel implementation. | 51 // ui::MenuModel implementation. |
(...skipping 10 matching lines...) Expand all Loading... |
62 virtual bool GetIconAt(int index, SkBitmap* icon) OVERRIDE; | 62 virtual bool GetIconAt(int index, SkBitmap* icon) OVERRIDE; |
63 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( | 63 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( |
64 int index) const OVERRIDE; | 64 int index) const OVERRIDE; |
65 virtual bool IsEnabledAt(int index) const OVERRIDE; | 65 virtual bool IsEnabledAt(int index) const OVERRIDE; |
66 virtual ui::MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; | 66 virtual ui::MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; |
67 virtual void HighlightChangedTo(int index) OVERRIDE; | 67 virtual void HighlightChangedTo(int index) OVERRIDE; |
68 virtual void ActivatedAt(int index) OVERRIDE; | 68 virtual void ActivatedAt(int index) OVERRIDE; |
69 virtual void MenuWillShow() OVERRIDE; | 69 virtual void MenuWillShow() OVERRIDE; |
70 virtual void SetMenuModelDelegate(ui::MenuModelDelegate* delegate) OVERRIDE; | 70 virtual void SetMenuModelDelegate(ui::MenuModelDelegate* delegate) OVERRIDE; |
71 | 71 |
72 // views::MenuButtonDelegate implementation. Sub classes can override the | 72 // views::MenuButtonListener implementation. |
73 // method to adjust the position of the menu. | 73 virtual void OnMenuButtonClicked(views::View* source, |
74 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; | 74 const gfx::Point& point) OVERRIDE; |
75 | 75 |
76 // InputMethodManager::Observer implementation. | 76 // InputMethodManager::Observer implementation. |
77 virtual void InputMethodChanged( | 77 virtual void InputMethodChanged( |
78 input_method::InputMethodManager* manager, | 78 input_method::InputMethodManager* manager, |
79 const input_method::InputMethodDescriptor& current_input_method, | 79 const input_method::InputMethodDescriptor& current_input_method, |
80 size_t num_active_input_methods) OVERRIDE; | 80 size_t num_active_input_methods) OVERRIDE; |
81 virtual void ActiveInputMethodsChanged( | 81 virtual void ActiveInputMethodsChanged( |
82 input_method::InputMethodManager* manager, | 82 input_method::InputMethodManager* manager, |
83 const input_method::InputMethodDescriptor& current_input_method, | 83 const input_method::InputMethodDescriptor& current_input_method, |
84 size_t num_active_input_methods) OVERRIDE; | 84 size_t num_active_input_methods) OVERRIDE; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // true if the menu is for a dialog in OOBE screen. In the dialog, we don't | 203 // true if the menu is for a dialog in OOBE screen. In the dialog, we don't |
204 // use radio buttons. | 204 // use radio buttons. |
205 const bool for_out_of_box_experience_dialog_; | 205 const bool for_out_of_box_experience_dialog_; |
206 | 206 |
207 DISALLOW_COPY_AND_ASSIGN(InputMethodMenu); | 207 DISALLOW_COPY_AND_ASSIGN(InputMethodMenu); |
208 }; | 208 }; |
209 | 209 |
210 } // namespace chromeos | 210 } // namespace chromeos |
211 | 211 |
212 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ | 212 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ |
OLD | NEW |