summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-24 01:30:50 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-24 01:30:50 +0000
commit93c9c2e009f4c7104fb9347def654376fff8fe33 (patch)
treeaa2e8fc3faccc3ae18466c54f14472c49bd78f9b
parent9271a055a7749baa0dd2edae16505e9043aeddbc (diff)
downloadchromium_src-93c9c2e009f4c7104fb9347def654376fff8fe33.zip
chromium_src-93c9c2e009f4c7104fb9347def654376fff8fe33.tar.gz
chromium_src-93c9c2e009f4c7104fb9347def654376fff8fe33.tar.bz2
ash: Show a bubble when accessibility is turned on.
BUG=118861 TEST=none Review URL: https://chromiumcodereview.appspot.com/9836070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128643 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/system/tray/tray_constants.cc1
-rw-r--r--ash/system/tray/tray_constants.h1
-rw-r--r--ash/system/tray_accessibility.cc44
-rw-r--r--ash/system/tray_accessibility.h14
-rw-r--r--ash/system/tray_caps_lock.cc2
-rw-r--r--chrome/browser/chromeos/system/ash_system_tray_delegate.cc3
6 files changed, 59 insertions, 6 deletions
diff --git a/ash/system/tray/tray_constants.cc b/ash/system/tray/tray_constants.cc
index 076e3ed..3c9500b 100644
--- a/ash/system/tray/tray_constants.cc
+++ b/ash/system/tray/tray_constants.cc
@@ -10,6 +10,7 @@ namespace ash {
const int kTrayPaddingBetweenItems = 8;
const int kTrayPopupAutoCloseDelayInSeconds = 2;
+const int kTrayPopupAutoCloseDelayForTextInSeconds = 5;
const int kTrayPopupPaddingHorizontal = 18;
const int kTrayPopupPaddingBetweenItems = 10;
diff --git a/ash/system/tray/tray_constants.h b/ash/system/tray/tray_constants.h
index df1ea5c..24e60bb 100644
--- a/ash/system/tray/tray_constants.h
+++ b/ash/system/tray/tray_constants.h
@@ -12,6 +12,7 @@ namespace ash {
extern const int kTrayPaddingBetweenItems;
extern const int kTrayPopupAutoCloseDelayInSeconds;
+extern const int kTrayPopupAutoCloseDelayForTextInSeconds;
extern const int kTrayPopupPaddingHorizontal;
extern const int kTrayPopupPaddingBetweenItems;
diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc
index a0b550e..941ae21 100644
--- a/ash/system/tray_accessibility.cc
+++ b/ash/system/tray_accessibility.cc
@@ -6,14 +6,21 @@
#include "ash/shell.h"
#include "ash/system/tray/system_tray_delegate.h"
+#include "ash/system/tray/tray_constants.h"
#include "grit/ui_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/image/image.h"
#include "ui/views/controls/image_view.h"
+#include "ui/views/controls/label.h"
+#include "ui/views/layout/box_layout.h"
+#include "ui/views/widget/widget.h"
namespace ash {
namespace internal {
TrayAccessibility::TrayAccessibility()
- : TrayImageItem(IDR_AURA_UBER_TRAY_ACCESSIBILITY) {
+ : TrayImageItem(IDR_AURA_UBER_TRAY_ACCESSIBILITY),
+ string_id_(0) {
}
TrayAccessibility::~TrayAccessibility() {}
@@ -22,9 +29,42 @@ bool TrayAccessibility::GetInitialVisibility() {
return ash::Shell::GetInstance()->tray_delegate()->IsInAccessibilityMode();
}
-void TrayAccessibility::OnAccessibilityModeChanged(bool enabled) {
+views::View* TrayAccessibility::CreateDetailedView(user::LoginStatus status) {
+ DCHECK(string_id_);
+ detailed_.reset(new views::View);
+
+ detailed_->SetLayoutManager(new
+ views::BoxLayout(views::BoxLayout::kHorizontal,
+ kTrayPopupPaddingHorizontal, 10, kTrayPopupPaddingBetweenItems));
+
+ ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
+ views::ImageView* image = new views::ImageView;
+ image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_ACCESSIBILITY).
+ ToSkBitmap());
+
+ detailed_->AddChildView(image);
+ detailed_->AddChildView(new views::Label(
+ bundle.GetLocalizedString(string_id_)));
+
+ return detailed_.get();
+}
+
+void TrayAccessibility::DestroyDetailedView() {
+ detailed_.reset();
+}
+
+void TrayAccessibility::OnAccessibilityModeChanged(bool enabled,
+ int string_id) {
if (image_view())
image_view()->SetVisible(enabled);
+
+ if (enabled) {
+ string_id_ = string_id;
+ PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false);
+ } else if (detailed_.get()) {
+ string_id_ = 0;
+ detailed_->GetWidget()->Close();
+ }
}
} // namespace internal
diff --git a/ash/system/tray_accessibility.h b/ash/system/tray_accessibility.h
index 82538ab..bc657a6 100644
--- a/ash/system/tray_accessibility.h
+++ b/ash/system/tray_accessibility.h
@@ -10,6 +10,7 @@
namespace views {
class ImageView;
+class View;
}
namespace ash {
@@ -18,7 +19,10 @@ class ASH_EXPORT AccessibilityObserver {
public:
virtual ~AccessibilityObserver() {}
- virtual void OnAccessibilityModeChanged(bool enabled) = 0;
+ // Notifies when accessibilty mode changes. Also sends a string-id to display
+ // to the user.
+ virtual void OnAccessibilityModeChanged(bool enabled,
+ int string_id) = 0;
};
namespace internal {
@@ -32,9 +36,15 @@ class TrayAccessibility : public TrayImageItem,
private:
// Overridden from TrayImageItem.
virtual bool GetInitialVisibility() OVERRIDE;
+ virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE;
+ virtual void DestroyDetailedView() OVERRIDE;
// Overridden from AccessibilityObserver.
- virtual void OnAccessibilityModeChanged(bool enabled) OVERRIDE;
+ virtual void OnAccessibilityModeChanged(bool enabled,
+ int string_id) OVERRIDE;
+
+ scoped_ptr<views::View> detailed_;
+ int string_id_;
DISALLOW_COPY_AND_ASSIGN(TrayAccessibility);
};
diff --git a/ash/system/tray_caps_lock.cc b/ash/system/tray_caps_lock.cc
index 60e2f63..b2eb228 100644
--- a/ash/system/tray_caps_lock.cc
+++ b/ash/system/tray_caps_lock.cc
@@ -60,7 +60,7 @@ void TrayCapsLock::OnCapsLockChanged(bool enabled,
if (enabled) {
string_id_ = string_id;
- PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false);
+ PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false);
} else if (detailed_.get()) {
string_id_ = 0;
detailed_->GetWidget()->Close();
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index 3f38bf1..e0b0abc 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -754,7 +754,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
ash::Shell::GetInstance()->tray()->accessibility_observer();
if (observer) {
observer->OnAccessibilityModeChanged(
- service->GetBoolean(prefs::kSpokenFeedbackEnabled));
+ service->GetBoolean(prefs::kSpokenFeedbackEnabled),
+ IDS_STATUSBAR_ACCESSIBILITY_TURNED_ON_BUBBLE);
}
} else {
NOTREACHED();