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 | 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "ui/views/controls/menu/menu_runner.h" | 54 #include "ui/views/controls/menu/menu_runner.h" |
55 #include "ui/views/focus/focus_search.h" | 55 #include "ui/views/focus/focus_search.h" |
56 #include "ui/views/view_model.h" | 56 #include "ui/views/view_model.h" |
57 #include "ui/views/view_model_utils.h" | 57 #include "ui/views/view_model_utils.h" |
58 #include "ui/views/widget/widget.h" | 58 #include "ui/views/widget/widget.h" |
59 | 59 |
60 using gfx::Animation; | 60 using gfx::Animation; |
61 using views::View; | 61 using views::View; |
62 | 62 |
63 namespace ash { | 63 namespace ash { |
64 namespace internal { | |
65 | 64 |
66 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM = 0; | 65 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM = 0; |
67 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT = 1; | 66 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT = 1; |
68 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT = 2; | 67 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT = 2; |
69 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT = 3; | 68 const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT = 3; |
70 | 69 |
71 // Default amount content is inset on the left edge. | 70 // Default amount content is inset on the left edge. |
72 const int kDefaultLeadingInset = 8; | 71 const int kDefaultLeadingInset = 8; |
73 | 72 |
74 // Minimum distance before drag starts. | 73 // Minimum distance before drag starts. |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 return this; | 558 return this; |
560 } | 559 } |
561 | 560 |
562 void ShelfView::CreateDragIconProxy( | 561 void ShelfView::CreateDragIconProxy( |
563 const gfx::Point& location_in_screen_coordinates, | 562 const gfx::Point& location_in_screen_coordinates, |
564 const gfx::ImageSkia& icon, | 563 const gfx::ImageSkia& icon, |
565 views::View* replaced_view, | 564 views::View* replaced_view, |
566 const gfx::Vector2d& cursor_offset_from_center, | 565 const gfx::Vector2d& cursor_offset_from_center, |
567 float scale_factor) { | 566 float scale_factor) { |
568 drag_replaced_view_ = replaced_view; | 567 drag_replaced_view_ = replaced_view; |
569 drag_image_.reset(new ash::internal::DragImageView( | 568 drag_image_.reset(new ash::DragImageView( |
570 drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow(), | 569 drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow(), |
571 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE)); | 570 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE)); |
572 drag_image_->SetImage(icon); | 571 drag_image_->SetImage(icon); |
573 gfx::Size size = drag_image_->GetPreferredSize(); | 572 gfx::Size size = drag_image_->GetPreferredSize(); |
574 size.set_width(size.width() * scale_factor); | 573 size.set_width(size.width() * scale_factor); |
575 size.set_height(size.height() * scale_factor); | 574 size.set_height(size.height() * scale_factor); |
576 drag_image_offset_ = gfx::Vector2d(size.width() / 2, size.height() / 2) + | 575 drag_image_offset_ = gfx::Vector2d(size.width() / 2, size.height() / 2) + |
577 cursor_offset_from_center; | 576 cursor_offset_from_center; |
578 gfx::Rect drag_image_bounds( | 577 gfx::Rect drag_image_bounds( |
579 location_in_screen_coordinates - drag_image_offset_, | 578 location_in_screen_coordinates - drag_image_offset_, |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 case SHELF_ALIGNMENT_RIGHT: | 2049 case SHELF_ALIGNMENT_RIGHT: |
2051 distance = bounds.x() - coordinate.x(); | 2050 distance = bounds.x() - coordinate.x(); |
2052 break; | 2051 break; |
2053 case SHELF_ALIGNMENT_TOP: | 2052 case SHELF_ALIGNMENT_TOP: |
2054 distance = coordinate.y() - bounds.bottom(); | 2053 distance = coordinate.y() - bounds.bottom(); |
2055 break; | 2054 break; |
2056 } | 2055 } |
2057 return distance > 0 ? distance : 0; | 2056 return distance > 0 ? distance : 0; |
2058 } | 2057 } |
2059 | 2058 |
2060 } // namespace internal | |
2061 } // namespace ash | 2059 } // namespace ash |
OLD | NEW |