OLD | NEW |
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 "ui/app_list/app_list_constants.h" | 12 #include "ui/app_list/app_list_constants.h" |
13 #include "ui/app_list/app_list_folder_item.h" | 13 #include "ui/app_list/app_list_folder_item.h" |
14 #include "ui/app_list/app_list_item.h" | 14 #include "ui/app_list/app_list_item.h" |
15 #include "ui/app_list/app_list_switches.h" | 15 #include "ui/app_list/app_list_switches.h" |
16 #include "ui/app_list/pagination_controller.h" | 16 #include "ui/app_list/pagination_controller.h" |
17 #include "ui/app_list/views/app_list_drag_and_drop_host.h" | 17 #include "ui/app_list/views/app_list_drag_and_drop_host.h" |
18 #include "ui/app_list/views/app_list_folder_view.h" | 18 #include "ui/app_list/views/app_list_folder_view.h" |
19 #include "ui/app_list/views/app_list_item_view.h" | 19 #include "ui/app_list/views/app_list_item_view.h" |
20 #include "ui/app_list/views/apps_grid_view_delegate.h" | 20 #include "ui/app_list/views/apps_grid_view_delegate.h" |
21 #include "ui/app_list/views/page_switcher.h" | 21 #include "ui/app_list/views/page_switcher.h" |
22 #include "ui/app_list/views/pulsing_block_view.h" | 22 #include "ui/app_list/views/pulsing_block_view.h" |
23 #include "ui/app_list/views/top_icon_animation_view.h" | 23 #include "ui/app_list/views/top_icon_animation_view.h" |
24 #include "ui/compositor/scoped_layer_animation_settings.h" | 24 #include "ui/compositor/scoped_layer_animation_settings.h" |
25 #include "ui/events/event.h" | 25 #include "ui/events/event.h" |
26 #include "ui/gfx/animation/animation.h" | 26 #include "ui/gfx/animation/animation.h" |
| 27 #include "ui/gfx/dpi.h" |
27 #include "ui/gfx/geometry/vector2d.h" | 28 #include "ui/gfx/geometry/vector2d.h" |
28 #include "ui/gfx/geometry/vector2d_conversions.h" | 29 #include "ui/gfx/geometry/vector2d_conversions.h" |
29 #include "ui/views/border.h" | 30 #include "ui/views/border.h" |
30 #include "ui/views/view_model_utils.h" | 31 #include "ui/views/view_model_utils.h" |
31 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
32 | 33 |
33 #if defined(USE_AURA) | 34 #if defined(USE_AURA) |
34 #include "ui/aura/window.h" | 35 #include "ui/aura/window.h" |
35 #include "ui/aura/window_event_dispatcher.h" | 36 #include "ui/aura/window_event_dispatcher.h" |
36 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
37 #include "ui/views/win/hwnd_util.h" | 38 #include "ui/views/win/hwnd_util.h" |
38 #endif // defined(OS_WIN) | 39 #endif // defined(OS_WIN) |
39 #endif // defined(USE_AURA) | 40 #endif // defined(USE_AURA) |
40 | 41 |
41 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
42 #include "base/command_line.h" | 43 #include "base/command_line.h" |
43 #include "base/files/file_path.h" | 44 #include "base/files/file_path.h" |
44 #include "base/win/shortcut.h" | 45 #include "base/win/shortcut.h" |
45 #include "ui/base/dragdrop/drag_utils.h" | 46 #include "ui/base/dragdrop/drag_utils.h" |
46 #include "ui/base/dragdrop/drop_target_win.h" | 47 #include "ui/base/dragdrop/drop_target_win.h" |
47 #include "ui/base/dragdrop/os_exchange_data.h" | 48 #include "ui/base/dragdrop/os_exchange_data.h" |
48 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 49 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
49 #include "ui/gfx/win/dpi.h" | |
50 #endif | 50 #endif |
51 | 51 |
52 namespace app_list { | 52 namespace app_list { |
53 | 53 |
54 namespace { | 54 namespace { |
55 | 55 |
56 // Distance a drag needs to be from the app grid to be considered 'outside', at | 56 // Distance a drag needs to be from the app grid to be considered 'outside', at |
57 // which point we rearrange the apps to their pre-drag configuration, as a drop | 57 // which point we rearrange the apps to their pre-drag configuration, as a drop |
58 // then would be canceled. We have a buffer to make it easier to drag apps to | 58 // then would be canceled. We have a buffer to make it easier to drag apps to |
59 // other pages. | 59 // other pages. |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 POINT p; | 330 POINT p; |
331 GetCursorPos(&p); | 331 GetCursorPos(&p); |
332 return GetGridViewHWND() == WindowFromPoint(p); | 332 return GetGridViewHWND() == WindowFromPoint(p); |
333 } | 333 } |
334 | 334 |
335 gfx::Point GetCursorInGridViewCoords() { | 335 gfx::Point GetCursorInGridViewCoords() { |
336 POINT p; | 336 POINT p; |
337 GetCursorPos(&p); | 337 GetCursorPos(&p); |
338 ScreenToClient(GetGridViewHWND(), &p); | 338 ScreenToClient(GetGridViewHWND(), &p); |
339 gfx::Point grid_view_pt(p.x, p.y); | 339 gfx::Point grid_view_pt(p.x, p.y); |
340 grid_view_pt = gfx::win::ScreenToDIPPoint(grid_view_pt); | 340 grid_view_pt = gfx::ScreenToDIPPoint(grid_view_pt); |
341 views::View::ConvertPointFromWidget(grid_view_, &grid_view_pt); | 341 views::View::ConvertPointFromWidget(grid_view_, &grid_view_pt); |
342 return grid_view_pt; | 342 return grid_view_pt; |
343 } | 343 } |
344 | 344 |
345 AppsGridView* grid_view_; | 345 AppsGridView* grid_view_; |
346 AppListItemView* drag_view_; | 346 AppListItemView* drag_view_; |
347 gfx::Point drag_view_offset_; | 347 gfx::Point drag_view_offset_; |
348 bool has_shortcut_path_; | 348 bool has_shortcut_path_; |
349 base::FilePath shortcut_path_; | 349 base::FilePath shortcut_path_; |
350 bool running_; | 350 bool running_; |
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 | 2155 |
2156 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 2156 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
2157 bool is_target_folder) { | 2157 bool is_target_folder) { |
2158 AppListItemView* target_view = | 2158 AppListItemView* target_view = |
2159 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); | 2159 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); |
2160 if (target_view) | 2160 if (target_view) |
2161 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 2161 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
2162 } | 2162 } |
2163 | 2163 |
2164 } // namespace app_list | 2164 } // namespace app_list |
OLD | NEW |