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

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

Issue 14297013: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/focus_cycler_unittest.cc ('k') | ash/root_window_controller.cc » ('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 <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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 shelf->SelectValueForShelfAlignment( 433 shelf->SelectValueForShelfAlignment(
434 views::ImageButton::ALIGN_TOP, 434 views::ImageButton::ALIGN_TOP,
435 views::ImageButton::ALIGN_MIDDLE, 435 views::ImageButton::ALIGN_MIDDLE,
436 views::ImageButton::ALIGN_MIDDLE, 436 views::ImageButton::ALIGN_MIDDLE,
437 views::ImageButton::ALIGN_BOTTOM)); 437 views::ImageButton::ALIGN_BOTTOM));
438 } 438 }
439 if (i >= first_visible_index_ && i <= last_visible_index_) 439 if (i >= first_visible_index_ && i <= last_visible_index_)
440 view_model_->view_at(i)->Layout(); 440 view_model_->view_at(i)->Layout();
441 } 441 }
442 tooltip_->UpdateArrow(); 442 tooltip_->UpdateArrow();
443 if (overflow_bubble_.get()) 443 if (overflow_bubble_)
444 overflow_bubble_->Hide(); 444 overflow_bubble_->Hide();
445 } 445 }
446 446
447 gfx::Rect LauncherView::GetIdealBoundsOfItemIcon(LauncherID id) { 447 gfx::Rect LauncherView::GetIdealBoundsOfItemIcon(LauncherID id) {
448 int index = model_->ItemIndexByID(id); 448 int index = model_->ItemIndexByID(id);
449 if (index == -1 || (index > last_visible_index_ && 449 if (index == -1 || (index > last_visible_index_ &&
450 index < model_->FirstPanelIndex())) 450 index < model_->FirstPanelIndex()))
451 return gfx::Rect(); 451 return gfx::Rect();
452 const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index)); 452 const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index));
453 DCHECK_NE(TYPE_APP_LIST, model_->items()[index].type); 453 DCHECK_NE(TYPE_APP_LIST, model_->items()[index].type);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 668
669 x = shelf->PrimaryAxisValue(x + w + kButtonSpacing, x); 669 x = shelf->PrimaryAxisValue(x + w + kButtonSpacing, x);
670 y = shelf->PrimaryAxisValue(y, y + h + kButtonSpacing); 670 y = shelf->PrimaryAxisValue(y, y + h + kButtonSpacing);
671 app_list_bounds.set_x(x); 671 app_list_bounds.set_x(x);
672 app_list_bounds.set_y(y); 672 app_list_bounds.set_y(y);
673 view_model_->set_ideal_bounds(app_list_index, app_list_bounds); 673 view_model_->set_ideal_bounds(app_list_index, app_list_bounds);
674 674
675 if (overflow_bubble_.get() && overflow_bubble_->IsShowing()) 675 if (overflow_bubble_.get() && overflow_bubble_->IsShowing())
676 UpdateOverflowRange(overflow_bubble_->launcher_view()); 676 UpdateOverflowRange(overflow_bubble_->launcher_view());
677 } else { 677 } else {
678 if (overflow_bubble_.get()) 678 if (overflow_bubble_)
679 overflow_bubble_->Hide(); 679 overflow_bubble_->Hide();
680 } 680 }
681 } 681 }
682 682
683 int LauncherView::DetermineLastVisibleIndex(int max_value) const { 683 int LauncherView::DetermineLastVisibleIndex(int max_value) const {
684 ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager(); 684 ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager();
685 685
686 int index = model_->FirstPanelIndex() - 1; 686 int index = model_->FirstPanelIndex() - 1;
687 while (index >= 0 && 687 while (index >= 0 &&
688 shelf->PrimaryAxisValue( 688 shelf->PrimaryAxisValue(
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 view->SetPaintToLayer(true); 928 view->SetPaintToLayer(true);
929 view->layer()->SetFillsBoundsOpaquely(false); 929 view->layer()->SetFillsBoundsOpaquely(false);
930 } 930 }
931 931
932 void LauncherView::ToggleOverflowBubble() { 932 void LauncherView::ToggleOverflowBubble() {
933 if (IsShowingOverflowBubble()) { 933 if (IsShowingOverflowBubble()) {
934 overflow_bubble_->Hide(); 934 overflow_bubble_->Hide();
935 return; 935 return;
936 } 936 }
937 937
938 if (!overflow_bubble_.get()) 938 if (!overflow_bubble_)
939 overflow_bubble_.reset(new OverflowBubble()); 939 overflow_bubble_.reset(new OverflowBubble());
940 940
941 LauncherView* overflow_view = new LauncherView( 941 LauncherView* overflow_view = new LauncherView(
942 model_, delegate_, tooltip_->shelf_layout_manager()); 942 model_, delegate_, tooltip_->shelf_layout_manager());
943 overflow_view->Init(); 943 overflow_view->Init();
944 overflow_view->OnShelfAlignmentChanged(); 944 overflow_view->OnShelfAlignmentChanged();
945 UpdateOverflowRange(overflow_view); 945 UpdateOverflowRange(overflow_view);
946 946
947 overflow_bubble_->Show(overflow_button_, overflow_view); 947 overflow_bubble_->Show(overflow_button_, overflow_view);
948 948
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 view_index = -1; 1399 view_index = -1;
1400 } 1400 }
1401 1401
1402 if (view_index == -1) { 1402 if (view_index == -1) {
1403 Shell::GetInstance()->ShowContextMenu(point); 1403 Shell::GetInstance()->ShowContextMenu(point);
1404 return; 1404 return;
1405 } 1405 }
1406 scoped_ptr<ui::MenuModel> menu_model(delegate_->CreateContextMenu( 1406 scoped_ptr<ui::MenuModel> menu_model(delegate_->CreateContextMenu(
1407 model_->items()[view_index], 1407 model_->items()[view_index],
1408 source->GetWidget()->GetNativeView()->GetRootWindow())); 1408 source->GetWidget()->GetNativeView()->GetRootWindow()));
1409 if (!menu_model.get()) 1409 if (!menu_model)
1410 return; 1410 return;
1411 base::AutoReset<LauncherID> reseter( 1411 base::AutoReset<LauncherID> reseter(
1412 &context_menu_id_, 1412 &context_menu_id_,
1413 view_index == -1 ? 0 : model_->items()[view_index].id); 1413 view_index == -1 ? 0 : model_->items()[view_index].id);
1414 1414
1415 ShowMenu(scoped_ptr<views::MenuModelAdapter>( 1415 ShowMenu(scoped_ptr<views::MenuModelAdapter>(
1416 new views::MenuModelAdapter(menu_model.get())), 1416 new views::MenuModelAdapter(menu_model.get())),
1417 source, 1417 source,
1418 point, 1418 point,
1419 true); 1419 true);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 got_deleted_ = NULL; 1478 got_deleted_ = NULL;
1479 shelf->ForceUndimming(false); 1479 shelf->ForceUndimming(false);
1480 } 1480 }
1481 return; 1481 return;
1482 } 1482 }
1483 got_deleted_ = NULL; 1483 got_deleted_ = NULL;
1484 shelf->ForceUndimming(false); 1484 shelf->ForceUndimming(false);
1485 1485
1486 // Unpinning an item will reset the |launcher_menu_runner_| before coming 1486 // Unpinning an item will reset the |launcher_menu_runner_| before coming
1487 // here. 1487 // here.
1488 if (launcher_menu_runner_.get()) 1488 if (launcher_menu_runner_)
1489 closing_event_time_ = launcher_menu_runner_->closing_event_time(); 1489 closing_event_time_ = launcher_menu_runner_->closing_event_time();
1490 Shell::GetInstance()->UpdateShelfVisibility(); 1490 Shell::GetInstance()->UpdateShelfVisibility();
1491 } 1491 }
1492 1492
1493 void LauncherView::OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) { 1493 void LauncherView::OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) {
1494 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, 1494 FOR_EACH_OBSERVER(LauncherIconObserver, observers_,
1495 OnLauncherIconPositionsChanged()); 1495 OnLauncherIconPositionsChanged());
1496 PreferredSizeChanged(); 1496 PreferredSizeChanged();
1497 } 1497 }
1498 1498
(...skipping 23 matching lines...) Expand all
1522 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const { 1522 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const {
1523 if (view == GetAppListButtonView() && 1523 if (view == GetAppListButtonView() &&
1524 Shell::GetInstance()->GetAppListWindow()) 1524 Shell::GetInstance()->GetAppListWindow())
1525 return false; 1525 return false;
1526 const LauncherItem* item = LauncherItemForView(view); 1526 const LauncherItem* item = LauncherItemForView(view);
1527 return (!item || delegate_->ShouldShowTooltip(*item)); 1527 return (!item || delegate_->ShouldShowTooltip(*item));
1528 } 1528 }
1529 1529
1530 } // namespace internal 1530 } // namespace internal
1531 } // namespace ash 1531 } // namespace ash
OLDNEW
« no previous file with comments | « ash/focus_cycler_unittest.cc ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698