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

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

Issue 659883002: Enable hidpi on Linux, refactor a bit on Windows to share Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: constants Created 6 years, 1 month 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 "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
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 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 2168
2169 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, 2169 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index,
2170 bool is_target_folder) { 2170 bool is_target_folder) {
2171 AppListItemView* target_view = 2171 AppListItemView* target_view =
2172 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); 2172 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot);
2173 if (target_view) 2173 if (target_view)
2174 target_view->SetAsAttemptedFolderTarget(is_target_folder); 2174 target_view->SetAsAttemptedFolderTarget(is_target_folder);
2175 } 2175 }
2176 2176
2177 } // namespace app_list 2177 } // namespace app_list
OLDNEW
« no previous file with comments | « content/test/content_test_suite.cc ('k') | ui/aura/demo/demo_main.cc » ('j') | ui/gfx/dpi.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698