| 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 "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" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 return this; | 509 return this; |
| 510 } | 510 } |
| 511 | 511 |
| 512 void ShelfView::CreateDragIconProxy( | 512 void ShelfView::CreateDragIconProxy( |
| 513 const gfx::Point& location_in_screen_coordinates, | 513 const gfx::Point& location_in_screen_coordinates, |
| 514 const gfx::ImageSkia& icon, | 514 const gfx::ImageSkia& icon, |
| 515 views::View* replaced_view, | 515 views::View* replaced_view, |
| 516 const gfx::Vector2d& cursor_offset_from_center, | 516 const gfx::Vector2d& cursor_offset_from_center, |
| 517 float scale_factor) { | 517 float scale_factor) { |
| 518 drag_replaced_view_ = replaced_view; | 518 drag_replaced_view_ = replaced_view; |
| 519 WmWindow* root_window = | 519 aura::Window* root_window = |
| 520 WmWindow::Get(drag_replaced_view_->GetWidget()->GetNativeWindow()) | 520 drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow(); |
| 521 ->GetRootWindow(); | 521 drag_image_ = base::MakeUnique<DragImageView>( |
| 522 drag_image_.reset(new DragImageView( | 522 root_window, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); |
| 523 root_window, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE)); | |
| 524 drag_image_->SetImage(icon); | 523 drag_image_->SetImage(icon); |
| 525 gfx::Size size = drag_image_->GetPreferredSize(); | 524 gfx::Size size = drag_image_->GetPreferredSize(); |
| 526 size.set_width(size.width() * scale_factor); | 525 size.set_width(size.width() * scale_factor); |
| 527 size.set_height(size.height() * scale_factor); | 526 size.set_height(size.height() * scale_factor); |
| 528 drag_image_offset_ = gfx::Vector2d(size.width() / 2, size.height() / 2) + | 527 drag_image_offset_ = gfx::Vector2d(size.width() / 2, size.height() / 2) + |
| 529 cursor_offset_from_center; | 528 cursor_offset_from_center; |
| 530 gfx::Rect drag_image_bounds( | 529 gfx::Rect drag_image_bounds( |
| 531 location_in_screen_coordinates - drag_image_offset_, size); | 530 location_in_screen_coordinates - drag_image_offset_, size); |
| 532 drag_image_->SetBoundsInScreen(drag_image_bounds); | 531 drag_image_->SetBoundsInScreen(drag_image_bounds); |
| 533 drag_image_->SetWidgetVisible(true); | 532 drag_image_->SetWidgetVisible(true); |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 | 1761 |
| 1763 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1762 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1764 const gfx::Rect bounds = GetBoundsInScreen(); | 1763 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1765 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1764 int distance = wm_shelf_->SelectValueForShelfAlignment( |
| 1766 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1765 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1767 bounds.x() - coordinate.x()); | 1766 bounds.x() - coordinate.x()); |
| 1768 return distance > 0 ? distance : 0; | 1767 return distance > 0 ? distance : 0; |
| 1769 } | 1768 } |
| 1770 | 1769 |
| 1771 } // namespace ash | 1770 } // namespace ash |
| OLD | NEW |