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

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

Issue 9307036: Revert Aura changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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"
17 #include "grit/ui_resources.h" 16 #include "grit/ui_resources.h"
18 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
19 #include "ui/base/animation/animation.h" 18 #include "ui/base/animation/animation.h"
20 #include "ui/base/animation/throb_animation.h" 19 #include "ui/base/animation/throb_animation.h"
21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/models/simple_menu_model.h" 20 #include "ui/base/models/simple_menu_model.h"
23 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
24 #include "ui/gfx/compositor/layer.h" 22 #include "ui/gfx/compositor/layer.h"
25 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
26 #include "ui/views/animation/bounds_animator.h" 24 #include "ui/views/animation/bounds_animator.h"
27 #include "ui/views/controls/button/image_button.h" 25 #include "ui/views/controls/button/image_button.h"
28 #include "ui/views/controls/menu/menu_model_adapter.h" 26 #include "ui/views/controls/menu/menu_model_adapter.h"
29 #include "ui/views/controls/menu/menu_runner.h" 27 #include "ui/views/controls/menu/menu_runner.h"
30 #include "ui/views/widget/widget.h" 28 #include "ui/views/widget/widget.h"
31 29
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 overflow_button_->set_focusable(true); 213 overflow_button_->set_focusable(true);
216 overflow_button_->SetImage( 214 overflow_button_->SetImage(
217 views::CustomButton::BS_NORMAL, 215 views::CustomButton::BS_NORMAL,
218 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToSkBitmap()); 216 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToSkBitmap());
219 overflow_button_->SetImage( 217 overflow_button_->SetImage(
220 views::CustomButton::BS_HOT, 218 views::CustomButton::BS_HOT,
221 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToSkBitmap()); 219 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToSkBitmap());
222 overflow_button_->SetImage( 220 overflow_button_->SetImage(
223 views::CustomButton::BS_PUSHED, 221 views::CustomButton::BS_PUSHED,
224 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToSkBitmap()); 222 rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToSkBitmap());
225 overflow_button_->SetAccessibleName(
226 l10n_util::GetStringUTF16(IDS_AURA_LAUNCHER_OVERFLOW_NAME));
227 ConfigureChildView(overflow_button_); 223 ConfigureChildView(overflow_button_);
228 AddChildView(overflow_button_); 224 AddChildView(overflow_button_);
229 225
230 // We'll layout when our bounds change. 226 // We'll layout when our bounds change.
231 } 227 }
232 228
233 void LauncherView::LayoutToIdealBounds() { 229 void LauncherView::LayoutToIdealBounds() {
234 IdealBounds ideal_bounds; 230 IdealBounds ideal_bounds;
235 CalculateIdealBounds(&ideal_bounds); 231 CalculateIdealBounds(&ideal_bounds);
236 ViewModelUtils::SetViewBoundsToIdealBounds(*view_model_); 232 ViewModelUtils::SetViewBoundsToIdealBounds(*view_model_);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 636
641 case TYPE_BROWSER_SHORTCUT: 637 case TYPE_BROWSER_SHORTCUT:
642 cycler_->Cycle(); 638 cycler_->Cycle();
643 break; 639 break;
644 640
645 default: 641 default:
646 NOTREACHED(); 642 NOTREACHED();
647 } 643 }
648 } 644 }
649 645
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
676 } // namespace internal 646 } // namespace internal
677 } // namespace ash 647 } // 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