Commit 294d77c0 authored by glider@chromium.org's avatar glider@chromium.org

Revert 152135 - Fix accessability for web notification tray.


BUG=143671,142506
TBR=stevenjb@chromium.org,bryeung
Review URL: https://chromiumcodereview.appspot.com/10832389

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152317 0039d316-1c4b-4281-b951-d872f2087c98
parent aa5fd6a2
...@@ -443,9 +443,6 @@ Press Search key to cancel. ...@@ -443,9 +443,6 @@ Press Search key to cancel.
<message name="IDS_ASH_WEB_NOTFICATION_TRAY_NO_MESSAGES" desc="The message displayed in the message center when there are no notifications."> <message name="IDS_ASH_WEB_NOTFICATION_TRAY_NO_MESSAGES" desc="The message displayed in the message center when there are no notifications.">
You have no notifications. Relax! You have no notifications. Relax!
</message> </message>
<message name="IDS_ASH_WEB_NOTIFICATION_TRAY_ACCESSIBLE_NAME" desc="The accessible name of the web notification tray (message center).">
Message Center
</message>
<message name="IDS_ASH_MAXIMIZE_WINDOW" desc="A help text to show that when the button gets clicked the window get maximized."> <message name="IDS_ASH_MAXIMIZE_WINDOW" desc="A help text to show that when the button gets clicked the window get maximized.">
Maximize Maximize
</message> </message>
......
...@@ -327,8 +327,8 @@ StatusAreaWidget::~StatusAreaWidget() { ...@@ -327,8 +327,8 @@ StatusAreaWidget::~StatusAreaWidget() {
} }
void StatusAreaWidget::CreateTrayViews(ShellDelegate* shell_delegate) { void StatusAreaWidget::CreateTrayViews(ShellDelegate* shell_delegate) {
AddSystemTray(shell_delegate);
AddWebNotificationTray(); AddWebNotificationTray();
AddSystemTray(shell_delegate);
// Initialize() must be called after all trays have been created. // Initialize() must be called after all trays have been created.
if (system_tray_) if (system_tray_)
system_tray_->Initialize(); system_tray_->Initialize();
......
...@@ -96,14 +96,14 @@ void StatusAreaWidgetDelegate::UpdateLayout() { ...@@ -96,14 +96,14 @@ void StatusAreaWidgetDelegate::UpdateLayout() {
views::GridLayout::USE_PREF, 0, 0); views::GridLayout::USE_PREF, 0, 0);
} }
layout->StartRow(0, 0); layout->StartRow(0, 0);
for (int c = child_count() - 1; c >= 0; --c) for (int c = 0; c < child_count(); ++c)
layout->AddView(child_at(c)); layout->AddView(child_at(c));
} else { } else {
columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
0, /* resize percent */ 0, /* resize percent */
views::GridLayout::USE_PREF, 0, 0); views::GridLayout::USE_PREF, 0, 0);
for (int c = child_count() - 1; c >= 0; --c) { for (int c = 0; c < child_count(); ++c) {
if (c != child_count() - 1) if (c != 0)
layout->AddPaddingRow(0, kTraySpacing); layout->AddPaddingRow(0, kTraySpacing);
layout->StartRow(0, 0); layout->StartRow(0, 0);
layout->AddView(child_at(c)); layout->AddView(child_at(c));
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "grit/ash_strings.h" #include "grit/ash_strings.h"
#include "ui/aura/root_window.h" #include "ui/aura/root_window.h"
#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/events.h" #include "ui/base/events.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
...@@ -422,10 +423,6 @@ void SystemTray::AnchorUpdated() { ...@@ -422,10 +423,6 @@ void SystemTray::AnchorUpdated() {
bubble_->bubble_view()->UpdateBubble(); bubble_->bubble_view()->UpdateBubble();
} }
string16 SystemTray::GetAccessibleName() {
return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
}
bool SystemTray::PerformAction(const ui::Event& event) { bool SystemTray::PerformAction(const ui::Event& event) {
// If we're already showing the default view, hide it; otherwise, show it // If we're already showing the default view, hide it; otherwise, show it
// (and hide any popup that's currently shown). // (and hide any popup that's currently shown).
...@@ -448,4 +445,10 @@ bool SystemTray::PerformAction(const ui::Event& event) { ...@@ -448,4 +445,10 @@ bool SystemTray::PerformAction(const ui::Event& event) {
return true; return true;
} }
void SystemTray::GetAccessibleState(ui::AccessibleViewState* state) {
state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON;
state->name = l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
}
} // namespace ash } // namespace ash
...@@ -156,7 +156,6 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView { ...@@ -156,7 +156,6 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView {
virtual void Initialize() OVERRIDE; virtual void Initialize() OVERRIDE;
virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE;
virtual void AnchorUpdated() OVERRIDE; virtual void AnchorUpdated() OVERRIDE;
virtual string16 GetAccessibleName() OVERRIDE;
private: private:
friend class internal::SystemTrayBubble; friend class internal::SystemTrayBubble;
...@@ -193,6 +192,9 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView { ...@@ -193,6 +192,9 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView {
// Overridden from internal::ActionableView. // Overridden from internal::ActionableView.
virtual bool PerformAction(const ui::Event& event) OVERRIDE; virtual bool PerformAction(const ui::Event& event) OVERRIDE;
// Overridden from views::View.
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
// Owned items. // Owned items.
ScopedVector<SystemTrayItem> items_; ScopedVector<SystemTrayItem> items_;
......
...@@ -333,10 +333,6 @@ void SystemTrayBubble::OnClickedOutsideView() { ...@@ -333,10 +333,6 @@ void SystemTrayBubble::OnClickedOutsideView() {
bubble_widget_->Close(); bubble_widget_->Close();
} }
string16 SystemTrayBubble::GetAccessibleName() {
return tray_->GetAccessibleName();
}
void SystemTrayBubble::DestroyItemViews() { void SystemTrayBubble::DestroyItemViews() {
for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin();
it != items_.end(); it != items_.end();
......
...@@ -49,7 +49,6 @@ class SystemTrayBubble : public TrayBubbleView::Host, ...@@ -49,7 +49,6 @@ class SystemTrayBubble : public TrayBubbleView::Host,
virtual void OnMouseEnteredView() OVERRIDE; virtual void OnMouseEnteredView() OVERRIDE;
virtual void OnMouseExitedView() OVERRIDE; virtual void OnMouseExitedView() OVERRIDE;
virtual void OnClickedOutsideView() OVERRIDE; virtual void OnClickedOutsideView() OVERRIDE;
virtual string16 GetAccessibleName() OVERRIDE;
BubbleType bubble_type() const { return bubble_type_; } BubbleType bubble_type() const { return bubble_type_; }
TrayBubbleView* bubble_view() const { return bubble_view_; } TrayBubbleView* bubble_view() const { return bubble_view_; }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "ash/system/status_area_widget_delegate.h" #include "ash/system/status_area_widget_delegate.h"
#include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/layer_animation_observer.h"
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
...@@ -207,15 +206,10 @@ void TrayBackgroundView::OnPaintFocusBorder(gfx::Canvas* canvas) { ...@@ -207,15 +206,10 @@ void TrayBackgroundView::OnPaintFocusBorder(gfx::Canvas* canvas) {
// The tray itself expands to the right and bottom edge of the screen to make // The tray itself expands to the right and bottom edge of the screen to make
// sure clicking on the edges brings up the popup. However, the focus border // sure clicking on the edges brings up the popup. However, the focus border
// should be only around the container. // should be only around the container.
if (HasFocus() && (focusable() || IsAccessibilityFocusable())) if (GetWidget() && GetWidget()->IsActive())
DrawBorder(canvas, GetContentsBounds()); DrawBorder(canvas, GetContentsBounds());
} }
void TrayBackgroundView::GetAccessibleState(ui::AccessibleViewState* state) {
state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON;
state->name = GetAccessibleName();
}
void TrayBackgroundView::AboutToRequestFocusFromTabTraversal(bool reverse) { void TrayBackgroundView::AboutToRequestFocusFromTabTraversal(bool reverse) {
// Return focus to the login view. See crbug.com/120500. // Return focus to the login view. See crbug.com/120500.
views::View* v = GetNextFocusableView(); views::View* v = GetNextFocusableView();
...@@ -257,8 +251,9 @@ void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) { ...@@ -257,8 +251,9 @@ void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) {
void TrayBackgroundView::SetBorder() { void TrayBackgroundView::SetBorder() {
views::View* parent = status_area_widget_->status_area_widget_delegate(); views::View* parent = status_area_widget_->status_area_widget_delegate();
// Tray views are laid out right-to-left or bottom-to-top int child_count = parent->child_count();
int on_edge = (this == parent->child_at(0)); DCHECK(child_count > 0);
int on_edge = (this == parent->child_at(child_count-1));
// Change the border padding for different shelf alignment. // Change the border padding for different shelf alignment.
if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) { if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) {
set_border(views::Border::CreateEmptyBorder( set_border(views::Border::CreateEmptyBorder(
......
...@@ -67,7 +67,6 @@ class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, ...@@ -67,7 +67,6 @@ class ASH_EXPORT TrayBackgroundView : public internal::ActionableView,
virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
// Overridden from internal::ActionableView. // Overridden from internal::ActionableView.
...@@ -82,8 +81,6 @@ class ASH_EXPORT TrayBackgroundView : public internal::ActionableView, ...@@ -82,8 +81,6 @@ class ASH_EXPORT TrayBackgroundView : public internal::ActionableView,
// Called when the anchor (tray or bubble) may have moved or changed. // Called when the anchor (tray or bubble) may have moved or changed.
virtual void AnchorUpdated() {} virtual void AnchorUpdated() {}
virtual string16 GetAccessibleName() = 0;
// Sets |contents| as a child and sets its background to |background_|. // Sets |contents| as a child and sets its background to |background_|.
void SetContents(views::View* contents); void SetContents(views::View* contents);
......
...@@ -404,7 +404,8 @@ void TrayBubbleView::OnMouseExited(const ui::MouseEvent& event) { ...@@ -404,7 +404,8 @@ void TrayBubbleView::OnMouseExited(const ui::MouseEvent& event) {
void TrayBubbleView::GetAccessibleState(ui::AccessibleViewState* state) { void TrayBubbleView::GetAccessibleState(ui::AccessibleViewState* state) {
if (params_.can_activate) { if (params_.can_activate) {
state->role = ui::AccessibilityTypes::ROLE_WINDOW; state->role = ui::AccessibilityTypes::ROLE_WINDOW;
state->name = host_->GetAccessibleName(); state->name = l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
} }
} }
......
...@@ -45,7 +45,6 @@ class TrayBubbleView : public views::BubbleDelegateView { ...@@ -45,7 +45,6 @@ class TrayBubbleView : public views::BubbleDelegateView {
virtual void OnMouseEnteredView() = 0; virtual void OnMouseEnteredView() = 0;
virtual void OnMouseExitedView() = 0; virtual void OnMouseExitedView() = 0;
virtual void OnClickedOutsideView() = 0; virtual void OnClickedOutsideView() = 0;
virtual string16 GetAccessibleName() = 0;
// Overridden from aura::EventFilter. // Overridden from aura::EventFilter.
virtual bool PreHandleKeyEvent(aura::Window* target, virtual bool PreHandleKeyEvent(aura::Window* target,
......
...@@ -717,7 +717,6 @@ class WebNotificationTray::Bubble : public TrayBubbleView::Host, ...@@ -717,7 +717,6 @@ class WebNotificationTray::Bubble : public TrayBubbleView::Host,
init_params.bubble_width = kWebNotificationWidth; init_params.bubble_width = kWebNotificationWidth;
if (bubble_type == BUBBLE_TYPE_MESAGE_CENTER) { if (bubble_type == BUBBLE_TYPE_MESAGE_CENTER) {
init_params.max_height = kWebNotificationBubbleMaxHeight; init_params.max_height = kWebNotificationBubbleMaxHeight;
init_params.can_activate = true;
} else { } else {
init_params.arrow_color = kBackgroundColor; init_params.arrow_color = kBackgroundColor;
init_params.close_on_deactivate = false; init_params.close_on_deactivate = false;
...@@ -791,10 +790,6 @@ class WebNotificationTray::Bubble : public TrayBubbleView::Host, ...@@ -791,10 +790,6 @@ class WebNotificationTray::Bubble : public TrayBubbleView::Host,
tray_->HideMessageCenterBubble(); tray_->HideMessageCenterBubble();
} }
virtual string16 GetAccessibleName() OVERRIDE {
return tray_->GetAccessibleName();
}
// Overridden from views::WidgetObserver: // Overridden from views::WidgetObserver:
virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE { virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE {
CHECK_EQ(bubble_widget_, widget); CHECK_EQ(bubble_widget_, widget);
...@@ -1002,11 +997,6 @@ void WebNotificationTray::AnchorUpdated() { ...@@ -1002,11 +997,6 @@ void WebNotificationTray::AnchorUpdated() {
message_center_bubble_->bubble_view()->UpdateBubble(); message_center_bubble_->bubble_view()->UpdateBubble();
} }
string16 WebNotificationTray::GetAccessibleName() {
return l10n_util::GetStringUTF16(
IDS_ASH_WEB_NOTIFICATION_TRAY_ACCESSIBLE_NAME);
}
// Protected methods (invoked only from Bubble and its child classes) // Protected methods (invoked only from Bubble and its child classes)
void WebNotificationTray::SendRemoveNotification(const std::string& id) { void WebNotificationTray::SendRemoveNotification(const std::string& id) {
......
...@@ -125,7 +125,6 @@ class ASH_EXPORT WebNotificationTray : public internal::TrayBackgroundView { ...@@ -125,7 +125,6 @@ class ASH_EXPORT WebNotificationTray : public internal::TrayBackgroundView {
// Overridden from TrayBackgroundView. // Overridden from TrayBackgroundView.
virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE; virtual void SetShelfAlignment(ShelfAlignment alignment) OVERRIDE;
virtual void AnchorUpdated() OVERRIDE; virtual void AnchorUpdated() OVERRIDE;
virtual string16 GetAccessibleName() OVERRIDE;
// Overridden from internal::ActionableView. // Overridden from internal::ActionableView.
virtual bool PerformAction(const ui::Event& event) OVERRIDE; virtual bool PerformAction(const ui::Event& event) OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment