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

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

Issue 2915553004: mash: Remove last WmWindow uses in ash/shelf. (Closed)
Patch Set: Created 3 years, 6 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 | « ash/shelf/shelf_controller.cc ('k') | ash/shelf/shelf_widget_unittest.cc » ('j') | 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 "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/screen_util.h" 14 #include "ash/screen_util.h"
15 #include "ash/shelf/app_list_button.h" 15 #include "ash/shelf/app_list_button.h"
16 #include "ash/shelf/overflow_bubble.h" 16 #include "ash/shelf/overflow_bubble.h"
17 #include "ash/shelf/overflow_bubble_view.h" 17 #include "ash/shelf/overflow_bubble_view.h"
18 #include "ash/shelf/overflow_button.h" 18 #include "ash/shelf/overflow_button.h"
19 #include "ash/shelf/shelf.h" 19 #include "ash/shelf/shelf.h"
20 #include "ash/shelf/shelf_application_menu_model.h" 20 #include "ash/shelf/shelf_application_menu_model.h"
21 #include "ash/shelf/shelf_button.h" 21 #include "ash/shelf/shelf_button.h"
22 #include "ash/shelf/shelf_constants.h" 22 #include "ash/shelf/shelf_constants.h"
23 #include "ash/shelf/shelf_model.h" 23 #include "ash/shelf/shelf_model.h"
24 #include "ash/shelf/shelf_widget.h" 24 #include "ash/shelf/shelf_widget.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/shell_port.h"
28 #include "ash/strings/grit/ash_strings.h" 28 #include "ash/strings/grit/ash_strings.h"
29 #include "ash/wm/root_window_finder.h" 29 #include "ash/wm/root_window_finder.h"
30 #include "ash/wm_window.h"
31 #include "base/auto_reset.h" 30 #include "base/auto_reset.h"
32 #include "base/memory/ptr_util.h" 31 #include "base/memory/ptr_util.h"
33 #include "base/metrics/histogram_macros.h" 32 #include "base/metrics/histogram_macros.h"
34 #include "ui/accessibility/ax_node_data.h" 33 #include "ui/accessibility/ax_node_data.h"
35 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
36 #include "ui/base/models/simple_menu_model.h" 35 #include "ui/base/models/simple_menu_model.h"
37 #include "ui/compositor/layer.h" 36 #include "ui/compositor/layer.h"
38 #include "ui/compositor/layer_animator.h" 37 #include "ui/compositor/layer_animator.h"
39 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 38 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
40 #include "ui/events/event_utils.h" 39 #include "ui/events/event_utils.h"
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 DCHECK(overflow_bubble_->IsShowing()); 1032 DCHECK(overflow_bubble_->IsShowing());
1034 overflow_bubble_->shelf_view()->EndDrag(cancel); 1033 overflow_bubble_->shelf_view()->EndDrag(cancel);
1035 } 1034 }
1036 } 1035 }
1037 1036
1038 bool ShelfView::HandleRipOffDrag(const ui::LocatedEvent& event) { 1037 bool ShelfView::HandleRipOffDrag(const ui::LocatedEvent& event) {
1039 int current_index = view_model_->GetIndexOfView(drag_view_); 1038 int current_index = view_model_->GetIndexOfView(drag_view_);
1040 DCHECK_NE(-1, current_index); 1039 DCHECK_NE(-1, current_index);
1041 std::string dragged_app_id = model_->items()[current_index].id.app_id; 1040 std::string dragged_app_id = model_->items()[current_index].id.app_id;
1042 1041
1043 gfx::Point screen_location = 1042 gfx::Point screen_location = event.root_location();
1044 WmWindow::Get(GetWidget()->GetNativeWindow()) 1043 ::wm::ConvertPointToScreen(GetWidget()->GetNativeWindow()->GetRootWindow(),
1045 ->GetRootWindow() 1044 &screen_location);
1046 ->ConvertPointToScreen(event.root_location());
1047 1045
1048 // To avoid ugly forwards and backwards flipping we use different constants 1046 // To avoid ugly forwards and backwards flipping we use different constants
1049 // for ripping off / re-inserting the items. 1047 // for ripping off / re-inserting the items.
1050 if (dragged_off_shelf_) { 1048 if (dragged_off_shelf_) {
1051 // If the shelf/overflow bubble bounds contains |screen_location| we insert 1049 // If the shelf/overflow bubble bounds contains |screen_location| we insert
1052 // the item back into the shelf. 1050 // the item back into the shelf.
1053 if (GetBoundsForDragInsertInScreen().Contains(screen_location)) { 1051 if (GetBoundsForDragInsertInScreen().Contains(screen_location)) {
1054 if (dragged_to_another_shelf_) { 1052 if (dragged_to_another_shelf_) {
1055 // During the dragging an item from Shelf to Overflow, it can enter here 1053 // During the dragging an item from Shelf to Overflow, it can enter here
1056 // directly because both are located very closely. 1054 // directly because both are located very closely.
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 if (pointer == TOUCH && 1820 if (pointer == TOUCH &&
1823 (base::TimeTicks::Now() - touch_press_time_) < 1821 (base::TimeTicks::Now() - touch_press_time_) <
1824 base::TimeDelta::FromMilliseconds(kTouchDragTimeThresholdMs)) { 1822 base::TimeDelta::FromMilliseconds(kTouchDragTimeThresholdMs)) {
1825 return false; 1823 return false;
1826 } 1824 }
1827 1825
1828 return true; 1826 return true;
1829 } 1827 }
1830 1828
1831 } // namespace ash 1829 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_controller.cc ('k') | ash/shelf/shelf_widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698