OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/chromeos/status/accessibility_menu_button.h" | |
6 | |
7 #include "chrome/browser/browser_process.h" | |
8 #include "chrome/browser/prefs/pref_service.h" | |
9 #include "chrome/common/chrome_notification_types.h" | |
10 #include "chrome/common/pref_names.h" | |
11 #include "grit/generated_resources.h" | |
12 #include "grit/theme_resources.h" | |
13 #include "ui/base/l10n/l10n_util.h" | |
14 #include "ui/base/resource/resource_bundle.h" | |
15 | |
16 namespace chromeos { | |
17 | |
18 //////////////////////////////////////////////////////////////////////////////// | |
19 // AccessibilityMenuButton | |
20 | |
21 AccessibilityMenuButton::AccessibilityMenuButton(StatusAreaHost* host) | |
22 : StatusAreaButton(host, this) { | |
23 accessibility_enabled_.Init(prefs::kAccessibilityEnabled, | |
24 g_browser_process->local_state(), this); | |
25 SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
26 IDR_STATUSBAR_ACCESSIBILITY)); | |
27 UpdateTooltip(); | |
28 } | |
29 | |
30 AccessibilityMenuButton::~AccessibilityMenuButton() { | |
31 } | |
32 | |
33 //////////////////////////////////////////////////////////////////////////////// | |
34 // views::ViewMenuDelegate implementation: | |
35 | |
36 void AccessibilityMenuButton::RunMenu(views::View* unused_source, | |
37 const gfx::Point& pt) { | |
38 // This button is just an indicator, and therefore does not have a menu. | |
39 } | |
40 | |
41 //////////////////////////////////////////////////////////////////////////////// | |
42 // NotificationObserver implementation | |
43 | |
44 void AccessibilityMenuButton::Observe(int type, | |
45 const NotificationSource& source, | |
Zachary Kuznia
2011/08/29 04:09:48
nit: Indent should line up with int on previous l
hashimoto
2011/08/29 08:22:48
Fixed.
| |
46 const NotificationDetails& details) { | |
47 if (type == chrome::NOTIFICATION_PREF_CHANGED) | |
48 UpdateTooltip(); | |
49 } | |
50 | |
51 void AccessibilityMenuButton::UpdateTooltip() { | |
52 string16 message = | |
53 l10n_util::GetStringUTF16(IDS_STATUSBAR_ACCESSIBILITY_ENABLED); | |
54 SetTooltipText(UTF16ToWide(message)); | |
55 SetAccessibleName(message); | |
56 SetVisible(accessibility_enabled_.GetValue()); | |
57 } | |
58 | |
59 } // namespace chromeos | |
OLD | NEW |