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

Side by Side Diff: ash/shelf/shelf_view.cc

Issue 1849623002: Remove unused ash::SHELF_ALIGNMENT_TOP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
« no previous file with comments | « ash/shelf/shelf_types.h ('k') | ash/shelf/shelf_view_unittest.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/shelf/shelf_view.h" 5 #include "ash/shelf/shelf_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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 // the call in ShelfView::ButtonPressed(...). 723 // the call in ShelfView::ButtonPressed(...).
724 is_repost_event_ = IsRepostEvent(event) && (last_pressed_index_ == index); 724 is_repost_event_ = IsRepostEvent(event) && (last_pressed_index_ == index);
725 725
726 CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName()); 726 CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName());
727 drag_view_ = static_cast<ShelfButton*>(view); 727 drag_view_ = static_cast<ShelfButton*>(view);
728 drag_origin_ = gfx::Point(event.x(), event.y()); 728 drag_origin_ = gfx::Point(event.x(), event.y());
729 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentUsage", 729 UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentUsage",
730 shelf_->SelectValueForShelfAlignment( 730 shelf_->SelectValueForShelfAlignment(
731 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, 731 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM,
732 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, 732 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT,
733 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, -1), 733 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT),
734 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); 734 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT);
735 } 735 }
736 736
737 void ShelfView::PointerDraggedOnButton(views::View* view, 737 void ShelfView::PointerDraggedOnButton(views::View* view,
738 Pointer pointer, 738 Pointer pointer,
739 const ui::LocatedEvent& event) { 739 const ui::LocatedEvent& event) {
740 // To prepare all drag types (moving an item in the shelf and dragging off), 740 // To prepare all drag types (moving an item in the shelf and dragging off),
741 // we should check the x-axis and y-axis offset. 741 // we should check the x-axis and y-axis offset.
742 if (!dragging() && drag_view_ && 742 if (!dragging() && drag_view_ &&
743 ((std::abs(event.x() - drag_origin_.x()) >= kMinimumDragDistance) || 743 ((std::abs(event.x() - drag_origin_.x()) >= kMinimumDragDistance) ||
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 anchor = source->GetBoundsInScreen() + 1792 anchor = source->GetBoundsInScreen() +
1793 (window->GetTargetBounds().origin() - window->bounds().origin()); 1793 (window->GetTargetBounds().origin() - window->bounds().origin());
1794 1794
1795 // Adjust the anchor location for shelf items with asymmetrical borders. 1795 // Adjust the anchor location for shelf items with asymmetrical borders.
1796 if (source->border()) 1796 if (source->border())
1797 anchor.Inset(source->border()->GetInsets()); 1797 anchor.Inset(source->border()->GetInsets());
1798 1798
1799 // Determine the menu alignment dependent on the shelf. 1799 // Determine the menu alignment dependent on the shelf.
1800 menu_alignment = shelf_->SelectValueForShelfAlignment( 1800 menu_alignment = shelf_->SelectValueForShelfAlignment(
1801 views::MENU_ANCHOR_BUBBLE_ABOVE, views::MENU_ANCHOR_BUBBLE_RIGHT, 1801 views::MENU_ANCHOR_BUBBLE_ABOVE, views::MENU_ANCHOR_BUBBLE_RIGHT,
1802 views::MENU_ANCHOR_BUBBLE_LEFT, views::MENU_ANCHOR_BUBBLE_BELOW); 1802 views::MENU_ANCHOR_BUBBLE_LEFT);
1803 } 1803 }
1804 // If this is deleted while the menu is running, the shelf will also be gone. 1804 // If this is deleted while the menu is running, the shelf will also be gone.
1805 bool got_deleted = false; 1805 bool got_deleted = false;
1806 got_deleted_ = &got_deleted; 1806 got_deleted_ = &got_deleted;
1807 1807
1808 ShelfWidget* shelf_widget = shelf_->shelf_widget(); 1808 ShelfWidget* shelf_widget = shelf_->shelf_widget();
1809 shelf_widget->ForceUndimming(true); 1809 shelf_widget->ForceUndimming(true);
1810 // NOTE: if you convert to HAS_MNEMONICS be sure to update menu building code. 1810 // NOTE: if you convert to HAS_MNEMONICS be sure to update menu building code.
1811 if (launcher_menu_runner_->RunMenuAt(source->GetWidget(), nullptr, anchor, 1811 if (launcher_menu_runner_->RunMenuAt(source->GetWidget(), nullptr, anchor,
1812 menu_alignment, source_type) == 1812 menu_alignment, source_type) ==
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 1873
1874 const ShelfItem* ShelfView::ShelfItemForView(const views::View* view) const { 1874 const ShelfItem* ShelfView::ShelfItemForView(const views::View* view) const {
1875 const int view_index = view_model_->GetIndexOfView(view); 1875 const int view_index = view_model_->GetIndexOfView(view);
1876 return (view_index < 0) ? nullptr : &(model_->items()[view_index]); 1876 return (view_index < 0) ? nullptr : &(model_->items()[view_index]);
1877 } 1877 }
1878 1878
1879 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1879 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1880 const gfx::Rect bounds = GetBoundsInScreen(); 1880 const gfx::Rect bounds = GetBoundsInScreen();
1881 int distance = shelf_->SelectValueForShelfAlignment( 1881 int distance = shelf_->SelectValueForShelfAlignment(
1882 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1882 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1883 bounds.x() - coordinate.x(), coordinate.y() - bounds.bottom()); 1883 bounds.x() - coordinate.x());
1884 return distance > 0 ? distance : 0; 1884 return distance > 0 ? distance : 0;
1885 } 1885 }
1886 1886
1887 } // namespace ash 1887 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_types.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698