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

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

Issue 1812013003: Pass shelf instances, not root windows, for ash context menus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call OnShelfAlignmentChanged after LayoutShelf. Created 4 years, 9 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_layout_manager.cc ('k') | ash/shell.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/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 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 void ShelfView::ShowContextMenuForView(views::View* source, 1791 void ShelfView::ShowContextMenuForView(views::View* source,
1792 const gfx::Point& point, 1792 const gfx::Point& point,
1793 ui::MenuSourceType source_type) { 1793 ui::MenuSourceType source_type) {
1794 int view_index = view_model_->GetIndexOfView(source); 1794 int view_index = view_model_->GetIndexOfView(source);
1795 if (view_index == -1) { 1795 if (view_index == -1) {
1796 Shell::GetInstance()->ShowContextMenu(point, source_type); 1796 Shell::GetInstance()->ShowContextMenu(point, source_type);
1797 return; 1797 return;
1798 } 1798 }
1799 1799
1800 context_menu_model_.reset(Shell::GetInstance()->delegate()->CreateContextMenu( 1800 context_menu_model_.reset(Shell::GetInstance()->delegate()->CreateContextMenu(
1801 source->GetWidget()->GetNativeView()->GetRootWindow(), 1801 shelf_, &model_->items()[view_index]));
1802 &model_->items()[view_index]));
1803 if (!context_menu_model_) 1802 if (!context_menu_model_)
1804 return; 1803 return;
1805 1804
1806 base::AutoReset<ShelfID> reseter( 1805 base::AutoReset<ShelfID> reseter(
1807 &context_menu_id_, 1806 &context_menu_id_,
1808 view_index == -1 ? 0 : model_->items()[view_index].id); 1807 view_index == -1 ? 0 : model_->items()[view_index].id);
1809 1808
1810 ShowMenu(context_menu_model_.get(), 1809 ShowMenu(context_menu_model_.get(),
1811 source, 1810 source,
1812 point, 1811 point,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 1958
1960 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1959 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1961 const gfx::Rect bounds = GetBoundsInScreen(); 1960 const gfx::Rect bounds = GetBoundsInScreen();
1962 int distance = shelf_->SelectValueForShelfAlignment( 1961 int distance = shelf_->SelectValueForShelfAlignment(
1963 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1962 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1964 bounds.x() - coordinate.x(), coordinate.y() - bounds.bottom()); 1963 bounds.x() - coordinate.x(), coordinate.y() - bounds.bottom());
1965 return distance > 0 ? distance : 0; 1964 return distance > 0 ? distance : 0;
1966 } 1965 }
1967 1966
1968 } // namespace ash 1967 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698