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