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

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

Issue 2741273002: chromeos: Promotes more from WmShell to Shell (Closed)
Patch Set: feedback Created 3 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/common/accelerators/exit_warning_handler.cc ('k') | ash/common/shutdown_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/common/shelf/shelf_view.h" 5 #include "ash/common/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/common/ash_constants.h" 10 #include "ash/common/ash_constants.h"
11 #include "ash/common/drag_drop/drag_image_view.h" 11 #include "ash/common/drag_drop/drag_image_view.h"
12 #include "ash/common/scoped_root_window_for_new_windows.h" 12 #include "ash/common/scoped_root_window_for_new_windows.h"
13 #include "ash/common/shelf/app_list_button.h" 13 #include "ash/common/shelf/app_list_button.h"
14 #include "ash/common/shelf/overflow_bubble.h" 14 #include "ash/common/shelf/overflow_bubble.h"
15 #include "ash/common/shelf/overflow_bubble_view.h" 15 #include "ash/common/shelf/overflow_bubble_view.h"
16 #include "ash/common/shelf/overflow_button.h" 16 #include "ash/common/shelf/overflow_button.h"
17 #include "ash/common/shelf/shelf_application_menu_model.h" 17 #include "ash/common/shelf/shelf_application_menu_model.h"
18 #include "ash/common/shelf/shelf_button.h" 18 #include "ash/common/shelf/shelf_button.h"
19 #include "ash/common/shelf/shelf_constants.h" 19 #include "ash/common/shelf/shelf_constants.h"
20 #include "ash/common/shelf/shelf_delegate.h" 20 #include "ash/common/shelf/shelf_delegate.h"
21 #include "ash/common/shelf/shelf_model.h" 21 #include "ash/common/shelf/shelf_model.h"
22 #include "ash/common/shelf/shelf_widget.h" 22 #include "ash/common/shelf/shelf_widget.h"
23 #include "ash/common/shelf/wm_shelf.h" 23 #include "ash/common/shelf/wm_shelf.h"
24 #include "ash/common/shell_delegate.h" 24 #include "ash/common/shell_delegate.h"
25 #include "ash/common/wm/root_window_finder.h" 25 #include "ash/common/wm/root_window_finder.h"
26 #include "ash/common/wm_shell.h" 26 #include "ash/common/wm_shell.h"
27 #include "ash/common/wm_window.h" 27 #include "ash/common/wm_window.h"
28 #include "ash/shell.h"
28 #include "ash/strings/grit/ash_strings.h" 29 #include "ash/strings/grit/ash_strings.h"
29 #include "base/auto_reset.h" 30 #include "base/auto_reset.h"
30 #include "base/memory/ptr_util.h" 31 #include "base/memory/ptr_util.h"
31 #include "base/metrics/histogram_macros.h" 32 #include "base/metrics/histogram_macros.h"
32 #include "ui/accessibility/ax_node_data.h" 33 #include "ui/accessibility/ax_node_data.h"
33 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
34 #include "ui/base/models/simple_menu_model.h" 35 #include "ui/base/models/simple_menu_model.h"
35 #include "ui/compositor/layer.h" 36 #include "ui/compositor/layer.h"
36 #include "ui/compositor/layer_animator.h" 37 #include "ui/compositor/layer_animator.h"
37 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 38 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 ui::MenuSourceType source_type) { 1633 ui::MenuSourceType source_type) {
1633 last_pressed_index_ = -1; 1634 last_pressed_index_ = -1;
1634 1635
1635 const ShelfItem* item = ShelfItemForView(source); 1636 const ShelfItem* item = ShelfItemForView(source);
1636 if (!item) { 1637 if (!item) {
1637 WmShell::Get()->ShowContextMenu(point, source_type); 1638 WmShell::Get()->ShowContextMenu(point, source_type);
1638 return; 1639 return;
1639 } 1640 }
1640 1641
1641 std::unique_ptr<ui::MenuModel> context_menu_model( 1642 std::unique_ptr<ui::MenuModel> context_menu_model(
1642 WmShell::Get()->delegate()->CreateContextMenu(wm_shelf_, item)); 1643 Shell::Get()->shell_delegate()->CreateContextMenu(wm_shelf_, item));
1643 if (!context_menu_model) 1644 if (!context_menu_model)
1644 return; 1645 return;
1645 1646
1646 context_menu_id_ = item ? item->id : 0; 1647 context_menu_id_ = item ? item->id : 0;
1647 ShowMenu(std::move(context_menu_model), source, point, true, source_type, 1648 ShowMenu(std::move(context_menu_model), source, point, true, source_type,
1648 nullptr); 1649 nullptr);
1649 } 1650 }
1650 1651
1651 void ShelfView::ShowMenu(std::unique_ptr<ui::MenuModel> menu_model, 1652 void ShelfView::ShowMenu(std::unique_ptr<ui::MenuModel> menu_model,
1652 views::View* source, 1653 views::View* source,
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 1769
1769 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1770 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1770 const gfx::Rect bounds = GetBoundsInScreen(); 1771 const gfx::Rect bounds = GetBoundsInScreen();
1771 int distance = wm_shelf_->SelectValueForShelfAlignment( 1772 int distance = wm_shelf_->SelectValueForShelfAlignment(
1772 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1773 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1773 bounds.x() - coordinate.x()); 1774 bounds.x() - coordinate.x());
1774 return distance > 0 ? distance : 0; 1775 return distance > 0 ? distance : 0;
1775 } 1776 }
1776 1777
1777 } // namespace ash 1778 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/accelerators/exit_warning_handler.cc ('k') | ash/common/shutdown_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698