| 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_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 "chrome/browser/chromeos/status/input_method_menu.h" | 11 #include "chrome/browser/chromeos/status/input_method_menu.h" |
| 12 #include "chrome/browser/chromeos/status/status_area_button.h" | 12 #include "chrome/browser/chromeos/status/status_area_button.h" |
| 13 #include "views/controls/menu/view_menu_delegate.h" |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace chromeos { |
| 15 | 16 |
| 16 class StatusAreaHost; | 17 class StatusAreaHost; |
| 17 | 18 |
| 18 // 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 |
| 19 // switching input method and keyboard layout. | 20 // switching input method and keyboard layout. |
| 20 class InputMethodMenuButton : public StatusAreaButton, | 21 class InputMethodMenuButton : public StatusAreaButton, |
| 21 public InputMethodMenu { | 22 public views::ViewMenuDelegate { |
| 22 public: | 23 public: |
| 23 explicit InputMethodMenuButton(StatusAreaHost* host); | 24 explicit InputMethodMenuButton(StatusAreaHost* host); |
| 24 virtual ~InputMethodMenuButton() {} | 25 virtual ~InputMethodMenuButton() {} |
| 25 | 26 |
| 26 // views::View implementation. | 27 // views::View implementation. |
| 27 virtual gfx::Size GetPreferredSize(); | 28 virtual gfx::Size GetPreferredSize(); |
| 28 virtual void OnLocaleChanged(); | 29 virtual void OnLocaleChanged(); |
| 29 | 30 |
| 30 private: | 31 // views::ViewMenuDelegate implementation. |
| 32 virtual void RunMenu(views::View* unused_source, const gfx::Point& pt); |
| 33 |
| 31 // InputMethodMenu implementation. | 34 // InputMethodMenu implementation. |
| 32 virtual void UpdateUI(const std::string& input_method_id, | 35 virtual void UpdateUI(const std::string& input_method_id, |
| 33 const std::wstring& name, | 36 const std::wstring& name, |
| 34 const std::wstring& tooltip, | 37 const std::wstring& tooltip, |
| 35 size_t num_active_input_methods); | 38 size_t num_active_input_methods); |
| 36 virtual bool ShouldSupportConfigUI(); | 39 virtual bool ShouldSupportConfigUI(); |
| 37 virtual void OpenConfigUI(); | 40 virtual void OpenConfigUI(); |
| 38 | 41 |
| 42 private: |
| 43 scoped_ptr<InputMethodMenu> menu_; |
| 39 StatusAreaHost* host_; | 44 StatusAreaHost* host_; |
| 40 | 45 |
| 41 DISALLOW_COPY_AND_ASSIGN(InputMethodMenuButton); | 46 DISALLOW_COPY_AND_ASSIGN(InputMethodMenuButton); |
| 42 }; | 47 }; |
| 43 | 48 |
| 44 } // namespace chromeos | 49 } // namespace chromeos |
| 45 | 50 |
| 46 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_BUTTON_H_ | 51 #endif // CHROME_BROWSER_CHROMEOS_STATUS_INPUT_METHOD_MENU_BUTTON_H_ |
| OLD | NEW |