| 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/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 } | 538 } |
| 539 | 539 |
| 540 View* LauncherView::GetFocusTraversableParentView() { | 540 View* LauncherView::GetFocusTraversableParentView() { |
| 541 return this; | 541 return this; |
| 542 } | 542 } |
| 543 | 543 |
| 544 void LauncherView::CreateDragIconProxy( | 544 void LauncherView::CreateDragIconProxy( |
| 545 const gfx::Point& location_in_screen_coordinates, | 545 const gfx::Point& location_in_screen_coordinates, |
| 546 const gfx::ImageSkia& icon, | 546 const gfx::ImageSkia& icon, |
| 547 views::View* replaced_view, | 547 views::View* replaced_view, |
| 548 const gfx::Vector2d& cursor_offset_from_center, |
| 548 float scale_factor) { | 549 float scale_factor) { |
| 549 drag_replaced_view_ = replaced_view; | 550 drag_replaced_view_ = replaced_view; |
| 550 drag_image_.reset(new ash::internal::DragImageView( | 551 drag_image_.reset(new ash::internal::DragImageView( |
| 551 drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow())); | 552 drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow())); |
| 552 drag_image_->SetImage(icon); | 553 drag_image_->SetImage(icon); |
| 553 gfx::Size size = drag_image_->GetPreferredSize(); | 554 gfx::Size size = drag_image_->GetPreferredSize(); |
| 554 size.set_width(size.width() * scale_factor); | 555 size.set_width(size.width() * scale_factor); |
| 555 size.set_height(size.height() * scale_factor); | 556 size.set_height(size.height() * scale_factor); |
| 556 drag_image_offset_ = gfx::Vector2d(size.width() / 2, size.height() / 2); | 557 drag_image_offset_ = gfx::Vector2d(size.width() / 2, size.height() / 2) + |
| 558 cursor_offset_from_center; |
| 557 gfx::Rect drag_image_bounds( | 559 gfx::Rect drag_image_bounds( |
| 558 GetPositionInScreen(location_in_screen_coordinates, | 560 GetPositionInScreen(location_in_screen_coordinates, |
| 559 drag_replaced_view_) - drag_image_offset_, size); | 561 drag_replaced_view_) - drag_image_offset_, size); |
| 560 drag_image_->SetBoundsInScreen(drag_image_bounds); | 562 drag_image_->SetBoundsInScreen(drag_image_bounds); |
| 561 drag_image_->SetWidgetVisible(true); | 563 drag_image_->SetWidgetVisible(true); |
| 562 } | 564 } |
| 563 | 565 |
| 564 void LauncherView::UpdateDragIconProxy( | 566 void LauncherView::UpdateDragIconProxy( |
| 565 const gfx::Point& location_in_screen_coordinates) { | 567 const gfx::Point& location_in_screen_coordinates) { |
| 566 drag_image_->SetScreenPosition( | 568 drag_image_->SetScreenPosition( |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const { | 1645 bool LauncherView::ShouldShowTooltipForView(const views::View* view) const { |
| 1644 if (view == GetAppListButtonView() && | 1646 if (view == GetAppListButtonView() && |
| 1645 Shell::GetInstance()->GetAppListWindow()) | 1647 Shell::GetInstance()->GetAppListWindow()) |
| 1646 return false; | 1648 return false; |
| 1647 const LauncherItem* item = LauncherItemForView(view); | 1649 const LauncherItem* item = LauncherItemForView(view); |
| 1648 return (!item || delegate_->ShouldShowTooltip(*item)); | 1650 return (!item || delegate_->ShouldShowTooltip(*item)); |
| 1649 } | 1651 } |
| 1650 | 1652 |
| 1651 } // namespace internal | 1653 } // namespace internal |
| 1652 } // namespace ash | 1654 } // namespace ash |
| OLD | NEW |