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_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_BUTTON_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_BUTTON_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/status/input_method_menu.h" | 12 #include "chrome/browser/chromeos/status/input_method_menu.h" |
13 #include "chrome/browser/chromeos/status/status_area_button.h" | 13 #include "chrome/browser/chromeos/status/status_area_button.h" |
| 14 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" |
14 #include "views/controls/menu/view_menu_delegate.h" | 15 #include "views/controls/menu/view_menu_delegate.h" |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 | 18 |
18 class StatusAreaHost; | |
19 | |
20 // A class for the button in the status area which expands the dropdown menu for | 19 // A class for the button in the status area which expands the dropdown menu for |
21 // switching input method and keyboard layout. | 20 // switching input method and keyboard layout. |
22 class InputMethodMenuButton : public StatusAreaButton, | 21 class InputMethodMenuButton : public StatusAreaButton, |
23 public views::ViewMenuDelegate { | 22 public views::ViewMenuDelegate { |
24 public: | 23 public: |
25 explicit InputMethodMenuButton(StatusAreaHost* host); | 24 explicit InputMethodMenuButton( |
| 25 StatusAreaButton::Delegate* delegate, |
| 26 StatusAreaViewChromeos::ScreenMode screen_mode); |
26 virtual ~InputMethodMenuButton(); | 27 virtual ~InputMethodMenuButton(); |
27 | 28 |
28 // views::View implementation. | 29 // views::View implementation. |
29 virtual void OnLocaleChanged(); | 30 virtual void OnLocaleChanged(); |
30 | 31 |
31 // views::ViewMenuDelegate implementation. | 32 // views::ViewMenuDelegate implementation. |
32 virtual void RunMenu(views::View* unused_source, const gfx::Point& pt); | 33 virtual void RunMenu(views::View* unused_source, const gfx::Point& pt); |
33 | 34 |
34 // InputMethodMenu implementation. | 35 // InputMethodMenu implementation. |
35 virtual void UpdateUI(const std::string& input_method_id, | 36 virtual void UpdateUI(const std::string& input_method_id, |
36 const string16& name, | 37 const string16& name, |
37 const string16& tooltip, | 38 const string16& tooltip, |
38 size_t num_active_input_methods); | 39 size_t num_active_input_methods); |
39 virtual bool ShouldSupportConfigUI(); | 40 virtual bool ShouldSupportConfigUI(); |
40 virtual void OpenConfigUI(); | 41 virtual void OpenConfigUI(); |
41 | 42 |
42 // Updates the UI from the current input method. | 43 // Updates the UI from the current input method. |
43 void UpdateUIFromCurrentInputMethod(); | 44 void UpdateUIFromCurrentInputMethod(); |
44 | 45 |
45 private: | 46 private: |
46 // Returns true if the Chrome window where the button lives is active. | 47 // Returns true if the Chrome window where the button lives is active. |
47 bool WindowIsActive(); | 48 bool WindowIsActive(); |
48 | 49 |
49 scoped_ptr<InputMethodMenu> menu_; | 50 scoped_ptr<InputMethodMenu> menu_; |
| 51 StatusAreaViewChromeos::ScreenMode screen_mode_; |
50 | 52 |
51 DISALLOW_COPY_AND_ASSIGN(InputMethodMenuButton); | 53 DISALLOW_COPY_AND_ASSIGN(InputMethodMenuButton); |
52 }; | 54 }; |
53 | 55 |
54 } // namespace chromeos | 56 } // namespace chromeos |
55 | 57 |
56 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_BUTTON_H_ | 58 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_BUTTON_H_ |
OLD | NEW |