Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: ash/launcher/launcher_view.cc

Issue 9121050: Add accessible names to the launcher buttons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Query the LauncherView for the correct accessible name Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/launcher/launcher_view.h" 5 #include "ash/launcher/launcher_view.h"
6 6
7 #include "ash/launcher/app_launcher_button.h" 7 #include "ash/launcher/app_launcher_button.h"
8 #include "ash/launcher/launcher_model.h" 8 #include "ash/launcher/launcher_model.h"
9 #include "ash/launcher/launcher_window_cycler.h" 9 #include "ash/launcher/launcher_window_cycler.h"
10 #include "ash/launcher/tabbed_launcher_button.h" 10 #include "ash/launcher/tabbed_launcher_button.h"
11 #include "ash/launcher/view_model.h" 11 #include "ash/launcher/view_model.h"
12 #include "ash/launcher/view_model_utils.h" 12 #include "ash/launcher/view_model_utils.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/shell_delegate.h" 14 #include "ash/shell_delegate.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "grit/ash_strings.h"
16 #include "grit/ui_resources.h" 17 #include "grit/ui_resources.h"
17 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
18 #include "ui/base/animation/animation.h" 19 #include "ui/base/animation/animation.h"
19 #include "ui/base/animation/throb_animation.h" 20 #include "ui/base/animation/throb_animation.h"
21 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/models/simple_menu_model.h" 22 #include "ui/base/models/simple_menu_model.h"
21 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/gfx/compositor/layer.h" 24 #include "ui/gfx/compositor/layer.h"
23 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
24 #include "ui/views/animation/bounds_animator.h" 26 #include "ui/views/animation/bounds_animator.h"
25 #include "ui/views/controls/button/image_button.h" 27 #include "ui/views/controls/button/image_button.h"
26 #include "ui/views/controls/menu/menu_model_adapter.h" 28 #include "ui/views/controls/menu/menu_model_adapter.h"
27 #include "ui/views/controls/menu/menu_runner.h" 29 #include "ui/views/controls/menu/menu_runner.h"
28 #include "ui/views/widget/widget.h" 30 #include "ui/views/widget/widget.h"
29 31
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 overflow_button_->set_focusable(true); 215 overflow_button_->set_focusable(true);
214 overflow_button_->SetImage( 216 overflow_button_->SetImage(
215 views::CustomButton::BS_NORMAL, 217 views::CustomButton::BS_NORMAL,
216 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToSkBitmap()); 218 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToSkBitmap());
217 overflow_button_->SetImage( 219 overflow_button_->SetImage(
218 views::CustomButton::BS_HOT, 220 views::CustomButton::BS_HOT,
219 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToSkBitmap()); 221 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToSkBitmap());
220 overflow_button_->SetImage( 222 overflow_button_->SetImage(
221 views::CustomButton::BS_PUSHED, 223 views::CustomButton::BS_PUSHED,
222 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToSkBitmap()); 224 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToSkBitmap());
225 overflow_button_->SetAccessibleName(
226 l10n_util::GetStringUTF16(IDS_AURA_LAUNCHER_OVERFLOW_NAME));
223 ConfigureChildView(overflow_button_); 227 ConfigureChildView(overflow_button_);
224 AddChildView(overflow_button_); 228 AddChildView(overflow_button_);
225 229
226 // We'll layout when our bounds change. 230 // We'll layout when our bounds change.
227 } 231 }
228 232
229 void LauncherView::LayoutToIdealBounds() { 233 void LauncherView::LayoutToIdealBounds() {
230 IdealBounds ideal_bounds; 234 IdealBounds ideal_bounds;
231 CalculateIdealBounds(&ideal_bounds); 235 CalculateIdealBounds(&ideal_bounds);
232 ViewModelUtils::SetViewBoundsToIdealBounds(*view_model_); 236 ViewModelUtils::SetViewBoundsToIdealBounds(*view_model_);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 640
637 case TYPE_BROWSER_SHORTCUT: 641 case TYPE_BROWSER_SHORTCUT:
638 cycler_->Cycle(); 642 cycler_->Cycle();
639 break; 643 break;
640 644
641 default: 645 default:
642 NOTREACHED(); 646 NOTREACHED();
643 } 647 }
644 } 648 }
645 649
650 string16 LauncherView::GetAccessibleName(views::View* view) {
651 if (view == overflow_button_)
sky 2012/01/30 15:33:46 This should never be invoked for the overflow_butt
Zachary Kuznia 2012/01/31 00:29:08 Done.
652 return string16();
653
654 ShellDelegate* delegate = Shell::GetInstance()->delegate();
655 if (!delegate)
656 return string16();
657 int view_index = view_model_->GetIndexOfView(view);
658 // May be -1 while in the process of animating closed.
659 if (view_index == -1)
660 return string16();
661
662 switch (model_->items()[view_index].type) {
663 case TYPE_TABBED:
664 case TYPE_APP:
665 return delegate->GetLauncherItemTitle(model_->items()[view_index]);
666
667 case TYPE_APP_LIST:
668 return l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE);
669
670 case TYPE_BROWSER_SHORTCUT:
671 return l10n_util::GetStringUTF16(IDS_AURA_CYCLER_TITLE);
672
673 default:
674 NOTREACHED();
675 }
676 return string16();
677 }
678
679
646 } // namespace internal 680 } // namespace internal
647 } // namespace ash 681 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698