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

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: Update DEPS file 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
« no previous file with comments | « ash/launcher/launcher_view.h ('k') | ash/launcher/tabbed_launcher_button.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
achuithb 2012/02/01 11:32:10 I'm getting an assertion failure here. I see this
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 ShellDelegate* delegate = Shell::GetInstance()->delegate();
652 if (!delegate)
653 return string16();
654 int view_index = view_model_->GetIndexOfView(view);
655 // May be -1 while in the process of animating closed.
656 if (view_index == -1)
657 return string16();
658
659 switch (model_->items()[view_index].type) {
660 case TYPE_TABBED:
661 case TYPE_APP:
662 return delegate->GetLauncherItemTitle(model_->items()[view_index]);
663
664 case TYPE_APP_LIST:
665 return l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE);
666
667 case TYPE_BROWSER_SHORTCUT:
668 return l10n_util::GetStringUTF16(IDS_AURA_CYCLER_TITLE);
669
670 default:
671 NOTREACHED();
672 }
673 return string16();
674 }
675
646 } // namespace internal 676 } // namespace internal
647 } // namespace ash 677 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_view.h ('k') | ash/launcher/tabbed_launcher_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698