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

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

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback 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
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"
11 #include "ash/drag_drop/drag_image_view.h" 11 #include "ash/drag_drop/drag_image_view.h"
12 #include "ash/public/cpp/shelf_item_delegate.h" 12 #include "ash/public/cpp/shelf_item_delegate.h"
13 #include "ash/scoped_root_window_for_new_windows.h" 13 #include "ash/scoped_root_window_for_new_windows.h"
14 #include "ash/shelf/app_list_button.h" 14 #include "ash/shelf/app_list_button.h"
15 #include "ash/shelf/overflow_bubble.h" 15 #include "ash/shelf/overflow_bubble.h"
16 #include "ash/shelf/overflow_bubble_view.h" 16 #include "ash/shelf/overflow_bubble_view.h"
17 #include "ash/shelf/overflow_button.h" 17 #include "ash/shelf/overflow_button.h"
18 #include "ash/shelf/shelf_application_menu_model.h" 18 #include "ash/shelf/shelf_application_menu_model.h"
19 #include "ash/shelf/shelf_button.h" 19 #include "ash/shelf/shelf_button.h"
20 #include "ash/shelf/shelf_constants.h" 20 #include "ash/shelf/shelf_constants.h"
21 #include "ash/shelf/shelf_delegate.h" 21 #include "ash/shelf/shelf_delegate.h"
22 #include "ash/shelf/shelf_model.h" 22 #include "ash/shelf/shelf_model.h"
23 #include "ash/shelf/shelf_widget.h" 23 #include "ash/shelf/shelf_widget.h"
24 #include "ash/shelf/wm_shelf.h" 24 #include "ash/shelf/wm_shelf.h"
25 #include "ash/shell.h" 25 #include "ash/shell.h"
26 #include "ash/shell_delegate.h" 26 #include "ash/shell_delegate.h"
27 #include "ash/shell_port.h"
27 #include "ash/strings/grit/ash_strings.h" 28 #include "ash/strings/grit/ash_strings.h"
28 #include "ash/wm/root_window_finder.h" 29 #include "ash/wm/root_window_finder.h"
29 #include "ash/wm_shell.h"
30 #include "ash/wm_window.h" 30 #include "ash/wm_window.h"
31 #include "base/auto_reset.h" 31 #include "base/auto_reset.h"
32 #include "base/memory/ptr_util.h" 32 #include "base/memory/ptr_util.h"
33 #include "base/metrics/histogram_macros.h" 33 #include "base/metrics/histogram_macros.h"
34 #include "ui/accessibility/ax_node_data.h" 34 #include "ui/accessibility/ax_node_data.h"
35 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
36 #include "ui/base/models/simple_menu_model.h" 36 #include "ui/base/models/simple_menu_model.h"
37 #include "ui/compositor/layer.h" 37 #include "ui/compositor/layer.h"
38 #include "ui/compositor/layer_animator.h" 38 #include "ui/compositor/layer_animator.h"
39 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 39 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 if (event.IsShiftDown()) { 459 if (event.IsShiftDown()) {
460 slowing_animations.reset(new ui::ScopedAnimationDurationScaleMode( 460 slowing_animations.reset(new ui::ScopedAnimationDurationScaleMode(
461 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION)); 461 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION));
462 } 462 }
463 463
464 // Collect usage statistics before we decide what to do with the click. 464 // Collect usage statistics before we decide what to do with the click.
465 switch (model_->items()[last_pressed_index_].type) { 465 switch (model_->items()[last_pressed_index_].type) {
466 case TYPE_PINNED_APP: 466 case TYPE_PINNED_APP:
467 case TYPE_BROWSER_SHORTCUT: 467 case TYPE_BROWSER_SHORTCUT:
468 case TYPE_APP: 468 case TYPE_APP:
469 WmShell::Get()->RecordUserMetricsAction(UMA_LAUNCHER_CLICK_ON_APP); 469 ShellPort::Get()->RecordUserMetricsAction(UMA_LAUNCHER_CLICK_ON_APP);
470 break; 470 break;
471 471
472 case TYPE_APP_LIST: 472 case TYPE_APP_LIST:
473 WmShell::Get()->RecordUserMetricsAction( 473 ShellPort::Get()->RecordUserMetricsAction(
474 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON); 474 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON);
475 break; 475 break;
476 476
477 case TYPE_APP_PANEL: 477 case TYPE_APP_PANEL:
478 case TYPE_DIALOG: 478 case TYPE_DIALOG:
479 break; 479 break;
480 480
481 case TYPE_UNDEFINED: 481 case TYPE_UNDEFINED:
482 NOTREACHED() << "ShelfItemType must be set."; 482 NOTREACHED() << "ShelfItemType must be set.";
483 break; 483 break;
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 scoped_root_window_for_new_windows_.reset(); 1621 scoped_root_window_for_new_windows_.reset();
1622 } 1622 }
1623 1623
1624 void ShelfView::ShowContextMenuForView(views::View* source, 1624 void ShelfView::ShowContextMenuForView(views::View* source,
1625 const gfx::Point& point, 1625 const gfx::Point& point,
1626 ui::MenuSourceType source_type) { 1626 ui::MenuSourceType source_type) {
1627 last_pressed_index_ = -1; 1627 last_pressed_index_ = -1;
1628 1628
1629 const ShelfItem* item = ShelfItemForView(source); 1629 const ShelfItem* item = ShelfItemForView(source);
1630 if (!item) { 1630 if (!item) {
1631 WmShell::Get()->ShowContextMenu(point, source_type); 1631 ShellPort::Get()->ShowContextMenu(point, source_type);
1632 return; 1632 return;
1633 } 1633 }
1634 1634
1635 std::unique_ptr<ui::MenuModel> context_menu_model( 1635 std::unique_ptr<ui::MenuModel> context_menu_model(
1636 Shell::Get()->shell_delegate()->CreateContextMenu(wm_shelf_, item)); 1636 Shell::Get()->shell_delegate()->CreateContextMenu(wm_shelf_, item));
1637 if (!context_menu_model) 1637 if (!context_menu_model)
1638 return; 1638 return;
1639 1639
1640 context_menu_id_ = item ? item->id : 0; 1640 context_menu_id_ = item ? item->id : 0;
1641 ShowMenu(std::move(context_menu_model), source, point, true, source_type, 1641 ShowMenu(std::move(context_menu_model), source, point, true, source_type,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 1762
1763 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1763 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1764 const gfx::Rect bounds = GetBoundsInScreen(); 1764 const gfx::Rect bounds = GetBoundsInScreen();
1765 int distance = wm_shelf_->SelectValueForShelfAlignment( 1765 int distance = wm_shelf_->SelectValueForShelfAlignment(
1766 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1766 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1767 bounds.x() - coordinate.x()); 1767 bounds.x() - coordinate.x());
1768 return distance > 0 ? distance : 0; 1768 return distance > 0 ? distance : 0;
1769 } 1769 }
1770 1770
1771 } // namespace ash 1771 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698