Chromium Code Reviews| Index: chrome/browser/chromeos/status/accessibility_menu_button.cc |
| diff --git a/chrome/browser/chromeos/status/accessibility_menu_button.cc b/chrome/browser/chromeos/status/accessibility_menu_button.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f74af326099417fea868508f360d6f33ac687934 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/status/accessibility_menu_button.cc |
| @@ -0,0 +1,59 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/chromeos/status/accessibility_menu_button.h" |
| + |
| +#include "chrome/browser/browser_process.h" |
| +#include "chrome/browser/prefs/pref_service.h" |
| +#include "chrome/common/chrome_notification_types.h" |
| +#include "chrome/common/pref_names.h" |
| +#include "grit/generated_resources.h" |
| +#include "grit/theme_resources.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| +#include "ui/base/resource/resource_bundle.h" |
| + |
| +namespace chromeos { |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// AccessibilityMenuButton |
| + |
| +AccessibilityMenuButton::AccessibilityMenuButton(StatusAreaHost* host) |
| + : StatusAreaButton(host, this) { |
| + accessibility_enabled_.Init(prefs::kAccessibilityEnabled, |
| + g_browser_process->local_state(), this); |
| + SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| + IDR_STATUSBAR_ACCESSIBILITY)); |
| + UpdateTooltip(); |
| +} |
| + |
| +AccessibilityMenuButton::~AccessibilityMenuButton() { |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// views::ViewMenuDelegate implementation: |
| + |
| +void AccessibilityMenuButton::RunMenu(views::View* unused_source, |
| + const gfx::Point& pt) { |
| + // This button is just an indicator, and therefore does not have a menu. |
| +} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// NotificationObserver implementation |
| + |
| +void AccessibilityMenuButton::Observe(int type, |
| + 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.
|
| + const NotificationDetails& details) { |
| + if (type == chrome::NOTIFICATION_PREF_CHANGED) |
| + UpdateTooltip(); |
| +} |
| + |
| +void AccessibilityMenuButton::UpdateTooltip() { |
| + string16 message = |
| + l10n_util::GetStringUTF16(IDS_STATUSBAR_ACCESSIBILITY_ENABLED); |
| + SetTooltipText(UTF16ToWide(message)); |
| + SetAccessibleName(message); |
| + SetVisible(accessibility_enabled_.GetValue()); |
| +} |
| + |
| +} // namespace chromeos |