summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-19 20:50:52 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-19 20:50:52 +0000
commit814a573c6b9a0711fb5d4df12380efe9e0dce26b (patch)
tree65f2adf7cb8cb44442b8314f2e42e1d316fc4247
parent7f0af54abc860b151582262bce91d582ef381828 (diff)
downloadchromium_src-814a573c6b9a0711fb5d4df12380efe9e0dce26b.zip
chromium_src-814a573c6b9a0711fb5d4df12380efe9e0dce26b.tar.gz
chromium_src-814a573c6b9a0711fb5d4df12380efe9e0dce26b.tar.bz2
ash: Fix initial visibility of accessibility/caps-lock icons in the uber tray.
BUG=118859, 118861 TEST=none Review URL: https://chromiumcodereview.appspot.com/9733007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127526 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/shell.cc8
-rw-r--r--ash/system/tray/system_tray_delegate.h6
-rw-r--r--ash/system/tray/tray_image_item.cc3
-rw-r--r--ash/system/tray/tray_image_item.h3
-rw-r--r--ash/system/tray_accessibility.cc6
-rw-r--r--ash/system/tray_accessibility.h3
-rw-r--r--ash/system/tray_caps_lock.cc6
-rw-r--r--ash/system/tray_caps_lock.h3
-rw-r--r--chrome/browser/chromeos/system/ash_system_tray_delegate.cc12
9 files changed, 48 insertions, 2 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index 8206972..1d791ff 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -298,6 +298,14 @@ class DummySystemTrayDelegate : public SystemTrayDelegate {
volume_ = volume;
}
+ virtual bool IsCapsLockOn() const OVERRIDE {
+ return false;
+ }
+
+ virtual bool IsInAccessibilityMode() const OVERRIDE {
+ return false;
+ }
+
virtual void ShutDown() OVERRIDE {}
virtual void SignOut() OVERRIDE {
diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h
index 3ecc9d8..c253387 100644
--- a/ash/system/tray/system_tray_delegate.h
+++ b/ash/system/tray/system_tray_delegate.h
@@ -77,6 +77,12 @@ class SystemTrayDelegate {
// Sets the volume level.
virtual void SetVolumeLevel(float level) = 0;
+ // Gets whether the caps lock is on.
+ virtual bool IsCapsLockOn() const = 0;
+
+ // Gets whether accessibility mode is turned on.
+ virtual bool IsInAccessibilityMode() const = 0;
+
// Attempts to shut down the system.
virtual void ShutDown() = 0;
diff --git a/ash/system/tray/tray_image_item.cc b/ash/system/tray/tray_image_item.cc
index 1918735..980fd27 100644
--- a/ash/system/tray/tray_image_item.cc
+++ b/ash/system/tray/tray_image_item.cc
@@ -21,7 +21,7 @@ views::View* TrayImageItem::CreateTrayView(user::LoginStatus status) {
image_view_.reset(new views::ImageView);
image_view_->SetImage(ui::ResourceBundle::GetSharedInstance().
GetImageNamed(resource_id_).ToSkBitmap());
- image_view_->SetVisible(false);
+ image_view_->SetVisible(ShouldDisplay());
return image_view_.get();
}
@@ -45,4 +45,3 @@ void TrayImageItem::DestroyDetailedView() {
} // namespace internal
} // namespace ash
-
diff --git a/ash/system/tray/tray_image_item.h b/ash/system/tray/tray_image_item.h
index 5c838d2..7cc27bc 100644
--- a/ash/system/tray/tray_image_item.h
+++ b/ash/system/tray/tray_image_item.h
@@ -22,6 +22,9 @@ class TrayImageItem : public SystemTrayItem {
views::ImageView* image_view() { return image_view_.get(); }
+ protected:
+ virtual bool ShouldDisplay() = 0;
+
private:
// Overridden from SystemTrayItem.
virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE;
diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc
index 8862dc8..0581fca 100644
--- a/ash/system/tray_accessibility.cc
+++ b/ash/system/tray_accessibility.cc
@@ -4,6 +4,8 @@
#include "ash/system/tray_accessibility.h"
+#include "ash/shell.h"
+#include "ash/system/tray/system_tray_delegate.h"
#include "grit/ui_resources.h"
#include "ui/views/controls/image_view.h"
@@ -16,6 +18,10 @@ TrayAccessibility::TrayAccessibility()
TrayAccessibility::~TrayAccessibility() {}
+bool TrayAccessibility::ShouldDisplay() {
+ return ash::Shell::GetInstance()->tray_delegate()->IsInAccessibilityMode();
+}
+
void TrayAccessibility::OnAccessibilityModeChanged(bool enabled) {
if (image_view())
image_view()->SetVisible(enabled);
diff --git a/ash/system/tray_accessibility.h b/ash/system/tray_accessibility.h
index d7ffe0a..1636482 100644
--- a/ash/system/tray_accessibility.h
+++ b/ash/system/tray_accessibility.h
@@ -30,6 +30,9 @@ class TrayAccessibility : public TrayImageItem,
virtual ~TrayAccessibility();
private:
+ // Overridden from TrayImageItem.
+ virtual bool ShouldDisplay() OVERRIDE;
+
// Overridden from AccessibilityObserver.
virtual void OnAccessibilityModeChanged(bool enabled) OVERRIDE;
diff --git a/ash/system/tray_caps_lock.cc b/ash/system/tray_caps_lock.cc
index c02d08b..9d4e33a 100644
--- a/ash/system/tray_caps_lock.cc
+++ b/ash/system/tray_caps_lock.cc
@@ -4,6 +4,8 @@
#include "ash/system/tray_caps_lock.h"
+#include "ash/shell.h"
+#include "ash/system/tray/system_tray_delegate.h"
#include "grit/ui_resources.h"
#include "ui/views/controls/image_view.h"
@@ -16,6 +18,10 @@ TrayCapsLock::TrayCapsLock()
TrayCapsLock::~TrayCapsLock() {}
+bool TrayCapsLock::ShouldDisplay() {
+ return ash::Shell::GetInstance()->tray_delegate()->IsCapsLockOn();
+}
+
void TrayCapsLock::OnCapsLockChanged(bool enabled) {
if (image_view())
image_view()->SetVisible(enabled);
diff --git a/ash/system/tray_caps_lock.h b/ash/system/tray_caps_lock.h
index 54108b4..9bc490a 100644
--- a/ash/system/tray_caps_lock.h
+++ b/ash/system/tray_caps_lock.h
@@ -30,6 +30,9 @@ class TrayCapsLock : public TrayImageItem,
virtual ~TrayCapsLock();
private:
+ // Overridden from TrayImageItem.
+ virtual bool ShouldDisplay() OVERRIDE;
+
// Overridden from CapsLockObserver.
virtual void OnCapsLockChanged(bool enabled) OVERRIDE;
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index ff38472..75135ea 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -24,6 +24,8 @@
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
#include "chrome/browser/chromeos/dbus/power_manager_client.h"
+#include "chrome/browser/chromeos/input_method/input_method_manager.h"
+#include "chrome/browser/chromeos/input_method/xkeyboard.h"
#include "chrome/browser/chromeos/login/base_login_display_host.h"
#include "chrome/browser/chromeos/login/login_display_host.h"
#include "chrome/browser/chromeos/login/user.h"
@@ -189,6 +191,16 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
AudioHandler::GetInstance()->SetVolumePercent(level * 100.f);
}
+ virtual bool IsCapsLockOn() const OVERRIDE {
+ input_method::InputMethodManager* ime_manager =
+ input_method::InputMethodManager::GetInstance();
+ return ime_manager->GetXKeyboard()->CapsLockIsEnabled();
+ }
+
+ virtual bool IsInAccessibilityMode() const OVERRIDE {
+ return accessibility_enabled_.GetValue();
+ }
+
virtual void ShutDown() OVERRIDE {
DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown();
}