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

Side by Side Diff: ui/app_list/views/apps_grid_view.cc

Issue 2787693002: Remove more dead app list code. (Closed)
Patch Set: updated comment 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 | « ui/app_list/views/app_list_view_unittest.cc ('k') | no next file » | 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 "ui/app_list/views/apps_grid_view.h" 5 #include "ui/app_list/views/apps_grid_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/guid.h" 11 #include "base/guid.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "ui/app_list/app_list_constants.h" 14 #include "ui/app_list/app_list_constants.h"
15 #include "ui/app_list/app_list_folder_item.h" 15 #include "ui/app_list/app_list_folder_item.h"
16 #include "ui/app_list/app_list_item.h" 16 #include "ui/app_list/app_list_item.h"
17 #include "ui/app_list/app_list_switches.h" 17 #include "ui/app_list/app_list_switches.h"
18 #include "ui/app_list/pagination_controller.h" 18 #include "ui/app_list/pagination_controller.h"
19 #include "ui/app_list/views/app_list_drag_and_drop_host.h" 19 #include "ui/app_list/views/app_list_drag_and_drop_host.h"
20 #include "ui/app_list/views/app_list_folder_view.h" 20 #include "ui/app_list/views/app_list_folder_view.h"
21 #include "ui/app_list/views/app_list_item_view.h" 21 #include "ui/app_list/views/app_list_item_view.h"
22 #include "ui/app_list/views/apps_grid_view_delegate.h" 22 #include "ui/app_list/views/apps_grid_view_delegate.h"
23 #include "ui/app_list/views/page_switcher.h" 23 #include "ui/app_list/views/page_switcher.h"
24 #include "ui/app_list/views/pulsing_block_view.h" 24 #include "ui/app_list/views/pulsing_block_view.h"
25 #include "ui/app_list/views/top_icon_animation_view.h" 25 #include "ui/app_list/views/top_icon_animation_view.h"
26 #include "ui/aura/window.h"
27 #include "ui/aura/window_event_dispatcher.h"
26 #include "ui/compositor/scoped_layer_animation_settings.h" 28 #include "ui/compositor/scoped_layer_animation_settings.h"
27 #include "ui/events/event.h" 29 #include "ui/events/event.h"
28 #include "ui/gfx/animation/animation.h" 30 #include "ui/gfx/animation/animation.h"
29 #include "ui/gfx/geometry/vector2d.h" 31 #include "ui/gfx/geometry/vector2d.h"
30 #include "ui/gfx/geometry/vector2d_conversions.h" 32 #include "ui/gfx/geometry/vector2d_conversions.h"
31 #include "ui/views/border.h" 33 #include "ui/views/border.h"
32 #include "ui/views/controls/label.h" 34 #include "ui/views/controls/label.h"
33 #include "ui/views/view_model_utils.h" 35 #include "ui/views/view_model_utils.h"
34 #include "ui/views/widget/widget.h" 36 #include "ui/views/widget/widget.h"
35 37
36 #if defined(USE_AURA)
37 #include "ui/aura/window.h"
38 #include "ui/aura/window_event_dispatcher.h"
39 #endif // defined(USE_AURA)
40
41 namespace app_list { 38 namespace app_list {
42 39
43 namespace { 40 namespace {
44 41
45 // Distance a drag needs to be from the app grid to be considered 'outside', at 42 // Distance a drag needs to be from the app grid to be considered 'outside', at
46 // which point we rearrange the apps to their pre-drag configuration, as a drop 43 // which point we rearrange the apps to their pre-drag configuration, as a drop
47 // then would be canceled. We have a buffer to make it easier to drag apps to 44 // then would be canceled. We have a buffer to make it easier to drag apps to
48 // other pages. 45 // other pages.
49 const int kDragBufferPx = 20; 46 const int kDragBufferPx = 20;
50 47
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 new RowMoveAnimationDelegate(view, layer.release(), current_out))); 1087 new RowMoveAnimationDelegate(view, layer.release(), current_out)));
1091 } 1088 }
1092 1089
1093 void AppsGridView::ExtractDragLocation(const ui::LocatedEvent& event, 1090 void AppsGridView::ExtractDragLocation(const ui::LocatedEvent& event,
1094 gfx::Point* drag_point) { 1091 gfx::Point* drag_point) {
1095 // Use root location of |event| instead of location in |drag_view_|'s 1092 // Use root location of |event| instead of location in |drag_view_|'s
1096 // coordinates because |drag_view_| has a scale transform and location 1093 // coordinates because |drag_view_| has a scale transform and location
1097 // could have integer round error and causes jitter. 1094 // could have integer round error and causes jitter.
1098 *drag_point = event.root_location(); 1095 *drag_point = event.root_location();
1099 1096
1100 #if defined(USE_AURA)
1101 // GetWidget() could be NULL for tests. 1097 // GetWidget() could be NULL for tests.
1102 if (GetWidget()) { 1098 if (GetWidget()) {
1103 aura::Window::ConvertPointToTarget( 1099 aura::Window::ConvertPointToTarget(
1104 GetWidget()->GetNativeWindow()->GetRootWindow(), 1100 GetWidget()->GetNativeWindow()->GetRootWindow(),
1105 GetWidget()->GetNativeWindow(), 1101 GetWidget()->GetNativeWindow(),
1106 drag_point); 1102 drag_point);
1107 } 1103 }
1108 #endif
1109 1104
1110 views::View::ConvertPointFromWidget(this, drag_point); 1105 views::View::ConvertPointFromWidget(this, drag_point);
1111 } 1106 }
1112 1107
1113 void AppsGridView::CalculateDropTarget() { 1108 void AppsGridView::CalculateDropTarget() {
1114 DCHECK(drag_view_); 1109 DCHECK(drag_view_);
1115 1110
1116 gfx::Point point = drag_view_->icon()->bounds().CenterPoint(); 1111 gfx::Point point = drag_view_->icon()->bounds().CenterPoint();
1117 views::View::ConvertPointToTarget(drag_view_, this, &point); 1112 views::View::ConvertPointToTarget(drag_view_, this, &point);
1118 if (!IsPointWithinDragBuffer(point)) { 1113 if (!IsPointWithinDragBuffer(point)) {
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 1910
1916 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, 1911 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index,
1917 bool is_target_folder) { 1912 bool is_target_folder) {
1918 AppListItemView* target_view = 1913 AppListItemView* target_view =
1919 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); 1914 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot);
1920 if (target_view) 1915 if (target_view)
1921 target_view->SetAsAttemptedFolderTarget(is_target_folder); 1916 target_view->SetAsAttemptedFolderTarget(is_target_folder);
1922 } 1917 }
1923 1918
1924 } // namespace app_list 1919 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_view_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698