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_VOLUME_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_VOLUME_MENU_BUTTON_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_VOLUME_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_VOLUME_MENU_BUTTON_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "chrome/browser/chromeos/audio/audio_handler.h" | |
11 #include "chrome/browser/chromeos/status/status_area_button.h" | 10 #include "chrome/browser/chromeos/status/status_area_button.h" |
12 #include "ui/views/controls/menu/menu_delegate.h" | 11 #include "ui/views/controls/menu/menu_delegate.h" |
13 #include "ui/views/controls/menu/view_menu_delegate.h" | 12 #include "ui/views/controls/menu/view_menu_delegate.h" |
14 | 13 |
15 namespace chromeos { | 14 namespace chromeos { |
16 | 15 |
17 // The volume button in the status area. | 16 // The volume button in the status area. |
18 class VolumeMenuButton : public StatusAreaButton, | 17 class VolumeMenuButton : public StatusAreaButton, |
19 public views::MenuDelegate, | 18 public views::MenuDelegate, |
20 public views::ViewMenuDelegate, | 19 public views::ViewMenuDelegate { |
21 public AudioHandler::VolumeObserver { | |
22 public: | 20 public: |
23 explicit VolumeMenuButton(StatusAreaButton::Delegate* delegate); | 21 explicit VolumeMenuButton(StatusAreaButton::Delegate* delegate); |
24 virtual ~VolumeMenuButton(); | 22 virtual ~VolumeMenuButton(); |
25 | 23 |
26 // Update the volume icon. | 24 // Update the volume icon. |
27 void UpdateIcon(); | 25 void UpdateIcon(); |
28 | 26 |
29 protected: | 27 protected: |
30 // StatusAreaButton implementation. | 28 // StatusAreaButton implementation. |
31 virtual int icon_width() OVERRIDE; | 29 virtual int icon_width() OVERRIDE; |
32 | 30 |
33 private: | 31 private: |
34 // views::View implementation. | 32 // views::View implementation. |
35 virtual void OnLocaleChanged() OVERRIDE; | 33 virtual void OnLocaleChanged() OVERRIDE; |
36 | 34 |
37 // views::ViewMenuDelegate implementation. | 35 // views::ViewMenuDelegate implementation. |
38 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; | 36 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; |
39 | 37 |
40 // AudioHandler::VolumeObserver implementation. | |
41 virtual void OnVolumeChanged() OVERRIDE; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(VolumeMenuButton); | 38 DISALLOW_COPY_AND_ASSIGN(VolumeMenuButton); |
44 }; | 39 }; |
45 | 40 |
46 } // namespace chromeos | 41 } // namespace chromeos |
47 | 42 |
48 #endif // CHROME_BROWSER_CHROMEOS_STATUS_VOLUME_MENU_BUTTON_H_ | 43 #endif // CHROME_BROWSER_CHROMEOS_STATUS_VOLUME_MENU_BUTTON_H_ |
OLD | NEW |