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

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

Issue 1898223002: Removes most aura dependencies from WindowResizer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_aura_from_window_state
Patch Set: nit and merge Created 4 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 | « ash/screen_util.cc ('k') | ash/shell.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/ash_switches.h" 11 #include "ash/ash_switches.h"
12 #include "ash/drag_drop/drag_image_view.h" 12 #include "ash/drag_drop/drag_image_view.h"
13 #include "ash/metrics/user_metrics_recorder.h" 13 #include "ash/metrics/user_metrics_recorder.h"
14 #include "ash/scoped_target_root_window.h" 14 #include "ash/scoped_target_root_window.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_button.h" 20 #include "ash/shelf/shelf_button.h"
21 #include "ash/shelf/shelf_constants.h" 21 #include "ash/shelf/shelf_constants.h"
22 #include "ash/shelf/shelf_delegate.h" 22 #include "ash/shelf/shelf_delegate.h"
23 #include "ash/shelf/shelf_icon_observer.h" 23 #include "ash/shelf/shelf_icon_observer.h"
24 #include "ash/shelf/shelf_item_delegate_manager.h" 24 #include "ash/shelf/shelf_item_delegate_manager.h"
25 #include "ash/shelf/shelf_menu_model.h" 25 #include "ash/shelf/shelf_menu_model.h"
26 #include "ash/shelf/shelf_model.h" 26 #include "ash/shelf/shelf_model.h"
27 #include "ash/shelf/shelf_widget.h" 27 #include "ash/shelf/shelf_widget.h"
28 #include "ash/shell.h" 28 #include "ash/shell.h"
29 #include "ash/shell_delegate.h" 29 #include "ash/shell_delegate.h"
30 #include "ash/wm/coordinate_conversion.h" 30 #include "ash/wm/aura/wm_window_aura.h"
31 #include "ash/wm/common/root_window_finder.h"
31 #include "base/auto_reset.h" 32 #include "base/auto_reset.h"
32 #include "base/metrics/histogram.h" 33 #include "base/metrics/histogram.h"
33 #include "grit/ash_strings.h" 34 #include "grit/ash_strings.h"
34 #include "ui/accessibility/ax_view_state.h" 35 #include "ui/accessibility/ax_view_state.h"
35 #include "ui/aura/client/screen_position_client.h" 36 #include "ui/aura/client/screen_position_client.h"
36 #include "ui/aura/window.h" 37 #include "ui/aura/window.h"
37 #include "ui/aura/window_event_dispatcher.h" 38 #include "ui/aura/window_event_dispatcher.h"
38 #include "ui/base/l10n/l10n_util.h" 39 #include "ui/base/l10n/l10n_util.h"
39 #include "ui/base/models/simple_menu_model.h" 40 #include "ui/base/models/simple_menu_model.h"
40 #include "ui/base/resource/resource_bundle.h" 41 #include "ui/base/resource/resource_bundle.h"
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 // for now. That has to be done by reducing the size since the visibility will 645 // for now. That has to be done by reducing the size since the visibility will
645 // change once a regrouping animation is performed. 646 // change once a regrouping animation is performed.
646 pre_drag_and_drop_size_ = drag_and_drop_view->size(); 647 pre_drag_and_drop_size_ = drag_and_drop_view->size();
647 drag_and_drop_view->SetSize(gfx::Size()); 648 drag_and_drop_view->SetSize(gfx::Size());
648 649
649 // First we have to center the mouse cursor over the item. 650 // First we have to center the mouse cursor over the item.
650 gfx::Point pt = drag_and_drop_view->GetBoundsInScreen().CenterPoint(); 651 gfx::Point pt = drag_and_drop_view->GetBoundsInScreen().CenterPoint();
651 views::View::ConvertPointFromScreen(drag_and_drop_view, &pt); 652 views::View::ConvertPointFromScreen(drag_and_drop_view, &pt);
652 gfx::Point point_in_root = location_in_screen_coordinates; 653 gfx::Point point_in_root = location_in_screen_coordinates;
653 ::wm::ConvertPointFromScreen( 654 ::wm::ConvertPointFromScreen(
654 ash::wm::GetRootWindowAt(location_in_screen_coordinates), &point_in_root); 655 wm::WmWindowAura::GetAuraWindow(
656 ash::wm::GetRootWindowAt(location_in_screen_coordinates)),
657 &point_in_root);
655 ui::MouseEvent event(ui::ET_MOUSE_PRESSED, pt, point_in_root, 658 ui::MouseEvent event(ui::ET_MOUSE_PRESSED, pt, point_in_root,
656 ui::EventTimeForNow(), 0, 0); 659 ui::EventTimeForNow(), 0, 0);
657 PointerPressedOnButton(drag_and_drop_view, DRAG_AND_DROP, event); 660 PointerPressedOnButton(drag_and_drop_view, DRAG_AND_DROP, event);
658 661
659 // Drag the item where it really belongs. 662 // Drag the item where it really belongs.
660 Drag(location_in_screen_coordinates); 663 Drag(location_in_screen_coordinates);
661 return true; 664 return true;
662 } 665 }
663 666
664 bool ShelfView::Drag(const gfx::Point& location_in_screen_coordinates) { 667 bool ShelfView::Drag(const gfx::Point& location_in_screen_coordinates) {
665 if (!drag_and_drop_shelf_id_ || 668 if (!drag_and_drop_shelf_id_ ||
666 !GetBoundsInScreen().Contains(location_in_screen_coordinates)) 669 !GetBoundsInScreen().Contains(location_in_screen_coordinates))
667 return false; 670 return false;
668 671
669 gfx::Point pt = location_in_screen_coordinates; 672 gfx::Point pt = location_in_screen_coordinates;
670 views::View* drag_and_drop_view = view_model_->view_at( 673 views::View* drag_and_drop_view = view_model_->view_at(
671 model_->ItemIndexByID(drag_and_drop_shelf_id_)); 674 model_->ItemIndexByID(drag_and_drop_shelf_id_));
672 ConvertPointFromScreen(drag_and_drop_view, &pt); 675 ConvertPointFromScreen(drag_and_drop_view, &pt);
673 gfx::Point point_in_root = location_in_screen_coordinates; 676 gfx::Point point_in_root = location_in_screen_coordinates;
674 ::wm::ConvertPointFromScreen( 677 ::wm::ConvertPointFromScreen(
675 ash::wm::GetRootWindowAt(location_in_screen_coordinates), &point_in_root); 678 wm::WmWindowAura::GetAuraWindow(
679 ash::wm::GetRootWindowAt(location_in_screen_coordinates)),
680 &point_in_root);
676 ui::MouseEvent event(ui::ET_MOUSE_DRAGGED, pt, point_in_root, 681 ui::MouseEvent event(ui::ET_MOUSE_DRAGGED, pt, point_in_root,
677 ui::EventTimeForNow(), 0, 0); 682 ui::EventTimeForNow(), 0, 0);
678 PointerDraggedOnButton(drag_and_drop_view, DRAG_AND_DROP, event); 683 PointerDraggedOnButton(drag_and_drop_view, DRAG_AND_DROP, event);
679 return true; 684 return true;
680 } 685 }
681 686
682 void ShelfView::EndDrag(bool cancel) { 687 void ShelfView::EndDrag(bool cancel) {
683 if (!drag_and_drop_shelf_id_) 688 if (!drag_and_drop_shelf_id_)
684 return; 689 return;
685 690
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 1881
1877 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1882 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1878 const gfx::Rect bounds = GetBoundsInScreen(); 1883 const gfx::Rect bounds = GetBoundsInScreen();
1879 int distance = shelf_->SelectValueForShelfAlignment( 1884 int distance = shelf_->SelectValueForShelfAlignment(
1880 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1885 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1881 bounds.x() - coordinate.x()); 1886 bounds.x() - coordinate.x());
1882 return distance > 0 ? distance : 0; 1887 return distance > 0 ? distance : 0;
1883 } 1888 }
1884 1889
1885 } // namespace ash 1890 } // namespace ash
OLDNEW
« no previous file with comments | « ash/screen_util.cc ('k') | ash/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698