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 |
(...skipping 28 matching lines...) Expand all Loading... |
39 #endif // defined(USE_AURA) | 39 #endif // defined(USE_AURA) |
40 | 40 |
41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
42 #include "base/command_line.h" | 42 #include "base/command_line.h" |
43 #include "base/files/file_path.h" | 43 #include "base/files/file_path.h" |
44 #include "base/win/shortcut.h" | 44 #include "base/win/shortcut.h" |
45 #include "ui/base/dragdrop/drag_utils.h" | 45 #include "ui/base/dragdrop/drag_utils.h" |
46 #include "ui/base/dragdrop/drop_target_win.h" | 46 #include "ui/base/dragdrop/drop_target_win.h" |
47 #include "ui/base/dragdrop/os_exchange_data.h" | 47 #include "ui/base/dragdrop/os_exchange_data.h" |
48 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 48 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
| 49 #include "ui/gfx/win/dpi.h" |
49 #endif | 50 #endif |
50 | 51 |
51 namespace app_list { | 52 namespace app_list { |
52 | 53 |
53 namespace { | 54 namespace { |
54 | 55 |
55 // 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 |
56 // 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 |
57 // 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 |
58 // other pages. | 59 // other pages. |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 POINT p; | 288 POINT p; |
288 GetCursorPos(&p); | 289 GetCursorPos(&p); |
289 return GetGridViewHWND() == WindowFromPoint(p); | 290 return GetGridViewHWND() == WindowFromPoint(p); |
290 } | 291 } |
291 | 292 |
292 gfx::Point GetCursorInGridViewCoords() { | 293 gfx::Point GetCursorInGridViewCoords() { |
293 POINT p; | 294 POINT p; |
294 GetCursorPos(&p); | 295 GetCursorPos(&p); |
295 ScreenToClient(GetGridViewHWND(), &p); | 296 ScreenToClient(GetGridViewHWND(), &p); |
296 gfx::Point grid_view_pt(p.x, p.y); | 297 gfx::Point grid_view_pt(p.x, p.y); |
| 298 grid_view_pt = gfx::win::ScreenToDIPPoint(grid_view_pt); |
297 views::View::ConvertPointFromWidget(grid_view_, &grid_view_pt); | 299 views::View::ConvertPointFromWidget(grid_view_, &grid_view_pt); |
298 return grid_view_pt; | 300 return grid_view_pt; |
299 } | 301 } |
300 | 302 |
301 AppsGridView* grid_view_; | 303 AppsGridView* grid_view_; |
302 AppListItemView* drag_view_; | 304 AppListItemView* drag_view_; |
303 gfx::Point drag_view_offset_; | 305 gfx::Point drag_view_offset_; |
304 bool has_shortcut_path_; | 306 bool has_shortcut_path_; |
305 base::FilePath shortcut_path_; | 307 base::FilePath shortcut_path_; |
306 bool running_; | 308 bool running_; |
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2085 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 2087 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
2086 bool is_target_folder) { | 2088 bool is_target_folder) { |
2087 AppListItemView* target_view = | 2089 AppListItemView* target_view = |
2088 static_cast<AppListItemView*>( | 2090 static_cast<AppListItemView*>( |
2089 GetViewAtSlotOnCurrentPage(target_index.slot)); | 2091 GetViewAtSlotOnCurrentPage(target_index.slot)); |
2090 if (target_view) | 2092 if (target_view) |
2091 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 2093 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
2092 } | 2094 } |
2093 | 2095 |
2094 } // namespace app_list | 2096 } // namespace app_list |
OLD | NEW |