OLD | NEW |
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_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/input_method/input_method_manager.h" | 11 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
12 #include "chrome/browser/chromeos/status/status_area_host.h" | 12 #include "chrome/browser/chromeos/status/status_area_view_chromeos.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 "views/controls/menu/menu_item_view.h" | 18 #include "views/controls/menu/menu_item_view.h" |
19 #include "views/controls/menu/view_menu_delegate.h" | 19 #include "views/controls/menu/view_menu_delegate.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::ViewMenuDelegate interface, it's easy to | 37 // Since the class provides the views::ViewMenuDelegate interface, it's easy to |
38 // create a button widget (e.g. views::MenuButton, chromeos::StatusAreaButton) | 38 // create a button widget (e.g. views::MenuButton, StatusAreaButton) |
39 // which shows the dropdown menu on click. | 39 // which shows the dropdown menu on click. |
40 class InputMethodMenu | 40 class InputMethodMenu |
41 : public views::ViewMenuDelegate, | 41 : public views::ViewMenuDelegate, |
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 StatusAreaHost::ScreenMode screen_mode, | 48 StatusAreaViewChromeos::ScreenMode screen_mode, |
49 bool for_out_of_box_experience_dialog); | 49 bool for_out_of_box_experience_dialog); |
50 virtual ~InputMethodMenu(); | 50 virtual ~InputMethodMenu(); |
51 | 51 |
52 // ui::MenuModel implementation. | 52 // ui::MenuModel implementation. |
53 virtual bool HasIcons() const; | 53 virtual bool HasIcons() const; |
54 virtual int GetItemCount() const; | 54 virtual int GetItemCount() const; |
55 virtual ui::MenuModel::ItemType GetTypeAt(int index) const; | 55 virtual ui::MenuModel::ItemType GetTypeAt(int index) const; |
56 virtual int GetCommandIdAt(int index) const; | 56 virtual int GetCommandIdAt(int index) const; |
57 virtual string16 GetLabelAt(int index) const; | 57 virtual string16 GetLabelAt(int index) const; |
58 virtual bool IsItemDynamicAt(int index) const; | 58 virtual bool IsItemDynamicAt(int index) const; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 int minimum_input_method_menu_width_; | 187 int minimum_input_method_menu_width_; |
188 | 188 |
189 // Menu alignment (default TOPRIGHT). | 189 // Menu alignment (default TOPRIGHT). |
190 views::MenuItemView::AnchorPosition menu_alignment_; | 190 views::MenuItemView::AnchorPosition menu_alignment_; |
191 | 191 |
192 PrefService* pref_service_; | 192 PrefService* pref_service_; |
193 content::NotificationRegistrar registrar_; | 193 content::NotificationRegistrar registrar_; |
194 | 194 |
195 // The mode of the host screen (e.g. browser, screen locker, login screen.) | 195 // The mode of the host screen (e.g. browser, screen locker, login screen.) |
196 const StatusAreaHost::ScreenMode screen_mode_; | 196 const StatusAreaViewChromeos::ScreenMode screen_mode_; |
197 // true if the menu is for a dialog in OOBE screen. In the dialog, we don't | 197 // true if the menu is for a dialog in OOBE screen. In the dialog, we don't |
198 // use radio buttons. | 198 // use radio buttons. |
199 const bool for_out_of_box_experience_dialog_; | 199 const bool for_out_of_box_experience_dialog_; |
200 | 200 |
201 DISALLOW_COPY_AND_ASSIGN(InputMethodMenu); | 201 DISALLOW_COPY_AND_ASSIGN(InputMethodMenu); |
202 }; | 202 }; |
203 | 203 |
204 } // namespace chromeos | 204 } // namespace chromeos |
205 | 205 |
206 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ | 206 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_H_ |
OLD | NEW |