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