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

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

Issue 13993027: ash: Update app list button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for #1 Created 7 years, 7 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 AddChildView(overflow_button_); 413 AddChildView(overflow_button_);
414 UpdateFirstButtonPadding(); 414 UpdateFirstButtonPadding();
415 415
416 // We'll layout when our bounds change. 416 // We'll layout when our bounds change.
417 } 417 }
418 418
419 void LauncherView::OnShelfAlignmentChanged() { 419 void LauncherView::OnShelfAlignmentChanged() {
420 UpdateFirstButtonPadding(); 420 UpdateFirstButtonPadding();
421 overflow_button_->OnShelfAlignmentChanged(); 421 overflow_button_->OnShelfAlignmentChanged();
422 LayoutToIdealBounds(); 422 LayoutToIdealBounds();
423 for (int i=0; i < view_model_->view_size(); ++i) { 423 for (int i = 0; i < view_model_->view_size(); ++i) {
424 // TODO: remove when AppIcon is a Launcher Button.
425 if (TYPE_APP_LIST == model_->items()[i].type) {
426 ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager();
427 static_cast<AppListButton*>(view_model_->view_at(i))->SetImageAlignment(
428 shelf->SelectValueForShelfAlignment(
429 views::ImageButton::ALIGN_CENTER,
430 views::ImageButton::ALIGN_LEFT,
431 views::ImageButton::ALIGN_RIGHT,
432 views::ImageButton::ALIGN_CENTER),
433 shelf->SelectValueForShelfAlignment(
434 views::ImageButton::ALIGN_TOP,
435 views::ImageButton::ALIGN_MIDDLE,
436 views::ImageButton::ALIGN_MIDDLE,
437 views::ImageButton::ALIGN_BOTTOM));
438 }
439 if (i >= first_visible_index_ && i <= last_visible_index_) 424 if (i >= first_visible_index_ && i <= last_visible_index_)
440 view_model_->view_at(i)->Layout(); 425 view_model_->view_at(i)->Layout();
441 } 426 }
442 tooltip_->UpdateArrow(); 427 tooltip_->UpdateArrow();
443 if (overflow_bubble_) 428 if (overflow_bubble_)
444 overflow_bubble_->Hide(); 429 overflow_bubble_->Hide();
445 } 430 }
446 431
447 gfx::Rect LauncherView::GetIdealBoundsOfItemIcon(LauncherID id) { 432 gfx::Rect LauncherView::GetIdealBoundsOfItemIcon(LauncherID id) {
448 int index = model_->ItemIndexByID(id); 433 int index = model_->ItemIndexByID(id);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 this, this, tooltip_->shelf_layout_manager()); 741 this, this, tooltip_->shelf_layout_manager());
757 button->SetImage(item.image); 742 button->SetImage(item.image);
758 ReflectItemStatus(item, button); 743 ReflectItemStatus(item, button);
759 view = button; 744 view = button;
760 break; 745 break;
761 } 746 }
762 747
763 case TYPE_APP_LIST: { 748 case TYPE_APP_LIST: {
764 // TODO(dave): turn this into a LauncherButton too. 749 // TODO(dave): turn this into a LauncherButton too.
765 AppListButton* button = new AppListButton(this, this); 750 AppListButton* button = new AppListButton(this, this);
766 ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager();
767 button->SetImageAlignment(
768 shelf->SelectValueForShelfAlignment(
769 views::ImageButton::ALIGN_CENTER,
770 views::ImageButton::ALIGN_LEFT,
771 views::ImageButton::ALIGN_RIGHT,
772 views::ImageButton::ALIGN_CENTER),
773 shelf->SelectValueForShelfAlignment(
774 views::ImageButton::ALIGN_TOP,
775 views::ImageButton::ALIGN_MIDDLE,
776 views::ImageButton::ALIGN_MIDDLE,
777 views::ImageButton::ALIGN_BOTTOM));
778 view = button; 751 view = button;
779 break; 752 break;
780 } 753 }
781 754
782 case TYPE_BROWSER_SHORTCUT: { 755 case TYPE_BROWSER_SHORTCUT: {
783 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 756 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
784 LauncherButton* button = LauncherButton::Create( 757 LauncherButton* button = LauncherButton::Create(
785 this, this, tooltip_->shelf_layout_manager()); 758 this, this, tooltip_->shelf_layout_manager());
786 int image_id = delegate_ ? 759 int image_id = delegate_ ?
787 delegate_->GetBrowserShortcutResourceId() : 760 delegate_->GetBrowserShortcutResourceId() :
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const { 1495 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const {
1523 if (view == GetAppListButtonView() && 1496 if (view == GetAppListButtonView() &&
1524 Shell::GetInstance()->GetAppListWindow()) 1497 Shell::GetInstance()->GetAppListWindow())
1525 return false; 1498 return false;
1526 const LauncherItem* item = LauncherItemForView(view); 1499 const LauncherItem* item = LauncherItemForView(view);
1527 return (!item || delegate_->ShouldShowTooltip(*item)); 1500 return (!item || delegate_->ShouldShowTooltip(*item));
1528 } 1501 }
1529 1502
1530 } // namespace internal 1503 } // namespace internal
1531 } // namespace ash 1504 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_unittest.cc ('k') | ash/resources/default_100_percent/common/launcher/launcher_appmenu.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698