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

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

Issue 2790773002: Cleanup MenuRunner API (Closed)
Patch Set: Rebase Created 3 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/root_window_controller.cc ('k') | ash/shell/window_type_launcher.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 #include <memory> 8 #include <memory>
9 9
10 #include "ash/ash_constants.h" 10 #include "ash/ash_constants.h"
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 const gfx::Point& click_point, 1642 const gfx::Point& click_point,
1643 bool context_menu, 1643 bool context_menu,
1644 ui::MenuSourceType source_type, 1644 ui::MenuSourceType source_type,
1645 views::InkDrop* ink_drop) { 1645 views::InkDrop* ink_drop) {
1646 menu_model_ = std::move(menu_model); 1646 menu_model_ = std::move(menu_model);
1647 menu_model_adapter_.reset(new views::MenuModelAdapter( 1647 menu_model_adapter_.reset(new views::MenuModelAdapter(
1648 menu_model_.get(), 1648 menu_model_.get(),
1649 base::Bind(&ShelfView::OnMenuClosed, base::Unretained(this), ink_drop))); 1649 base::Bind(&ShelfView::OnMenuClosed, base::Unretained(this), ink_drop)));
1650 1650
1651 closing_event_time_ = base::TimeTicks(); 1651 closing_event_time_ = base::TimeTicks();
1652 int run_types = views::MenuRunner::ASYNC; 1652 int run_types = 0;
1653 if (context_menu) 1653 if (context_menu)
1654 run_types |= views::MenuRunner::CONTEXT_MENU; 1654 run_types |= views::MenuRunner::CONTEXT_MENU;
1655 launcher_menu_runner_.reset( 1655 launcher_menu_runner_.reset(
1656 new views::MenuRunner(menu_model_adapter_->CreateMenu(), run_types)); 1656 new views::MenuRunner(menu_model_adapter_->CreateMenu(), run_types));
1657 1657
1658 // Place new windows on the same display as the button that spawned the menu. 1658 // Place new windows on the same display as the button that spawned the menu.
1659 WmWindow* window = WmWindow::Get(source->GetWidget()->GetNativeWindow()); 1659 WmWindow* window = WmWindow::Get(source->GetWidget()->GetNativeWindow());
1660 scoped_root_window_for_new_windows_.reset( 1660 scoped_root_window_for_new_windows_.reset(
1661 new ScopedRootWindowForNewWindows(window->GetRootWindow())); 1661 new ScopedRootWindowForNewWindows(window->GetRootWindow()));
1662 1662
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 1757
1758 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1758 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1759 const gfx::Rect bounds = GetBoundsInScreen(); 1759 const gfx::Rect bounds = GetBoundsInScreen();
1760 int distance = wm_shelf_->SelectValueForShelfAlignment( 1760 int distance = wm_shelf_->SelectValueForShelfAlignment(
1761 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1761 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1762 bounds.x() - coordinate.x()); 1762 bounds.x() - coordinate.x());
1763 return distance > 0 ? distance : 0; 1763 return distance > 0 ? distance : 0;
1764 } 1764 }
1765 1765
1766 } // namespace ash 1766 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shell/window_type_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698