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 "chrome/browser/ui/panels/panel_drag_controller.h" | 5 #include "chrome/browser/ui/panels/panel_drag_controller.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include <limits> |
| 10 |
7 #include "base/logging.h" | 11 #include "base/logging.h" |
8 #include "chrome/browser/ui/panels/detached_panel_collection.h" | 12 #include "chrome/browser/ui/panels/detached_panel_collection.h" |
9 #include "chrome/browser/ui/panels/detached_panel_drag_handler.h" | 13 #include "chrome/browser/ui/panels/detached_panel_drag_handler.h" |
10 #include "chrome/browser/ui/panels/docked_panel_collection.h" | 14 #include "chrome/browser/ui/panels/docked_panel_collection.h" |
11 #include "chrome/browser/ui/panels/docked_panel_drag_handler.h" | 15 #include "chrome/browser/ui/panels/docked_panel_drag_handler.h" |
12 #include "chrome/browser/ui/panels/panel.h" | 16 #include "chrome/browser/ui/panels/panel.h" |
13 #include "chrome/browser/ui/panels/panel_manager.h" | 17 #include "chrome/browser/ui/panels/panel_manager.h" |
14 #include "chrome/browser/ui/panels/stacked_panel_collection.h" | 18 #include "chrome/browser/ui/panels/stacked_panel_collection.h" |
15 #include "chrome/browser/ui/panels/stacked_panel_drag_handler.h" | 19 #include "chrome/browser/ui/panels/stacked_panel_drag_handler.h" |
16 | 20 |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 kSnapPanelToScreenEdgeThreshold) | 646 kSnapPanelToScreenEdgeThreshold) |
643 target_position->set_y(work_area.bottom() - height); | 647 target_position->set_y(work_area.bottom() - height); |
644 } | 648 } |
645 } | 649 } |
646 | 650 |
647 Panel* PanelDragController::FindPanelToGlue( | 651 Panel* PanelDragController::FindPanelToGlue( |
648 const gfx::Point& potential_position, | 652 const gfx::Point& potential_position, |
649 GlueAction action, | 653 GlueAction action, |
650 gfx::Rect* target_bounds, | 654 gfx::Rect* target_bounds, |
651 GlueEdge* target_edge) const { | 655 GlueEdge* target_edge) const { |
652 int best_distance = kint32max; | 656 int best_distance = std::numeric_limits<int32_t>::max(); |
653 Panel* best_matching_panel = NULL; | 657 Panel* best_matching_panel = NULL; |
654 | 658 |
655 // Compute the potential bounds for the dragging panel. | 659 // Compute the potential bounds for the dragging panel. |
656 gfx::Rect current_dragging_bounds = dragging_panel_->GetBounds(); | 660 gfx::Rect current_dragging_bounds = dragging_panel_->GetBounds(); |
657 gfx::Rect potential_dragging_bounds(potential_position, | 661 gfx::Rect potential_dragging_bounds(potential_position, |
658 current_dragging_bounds.size()); | 662 current_dragging_bounds.size()); |
659 | 663 |
660 // Compute the potential bounds for the bottom panel if the dragging panel is | 664 // Compute the potential bounds for the bottom panel if the dragging panel is |
661 // in a stack. If not, it is same as |potential_dragging_bounds|. | 665 // in a stack. If not, it is same as |potential_dragging_bounds|. |
662 // This is used to determine if the dragging panel or the bottom panel can | 666 // This is used to determine if the dragging panel or the bottom panel can |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 panel_manager_->detached_collection(), | 809 panel_manager_->detached_collection(), |
806 PanelCollection::KNOWN_POSITION); | 810 PanelCollection::KNOWN_POSITION); |
807 } | 811 } |
808 // Note that if the stack is the original collection, do not remove it now. | 812 // Note that if the stack is the original collection, do not remove it now. |
809 // This is because the original collection contains the information to | 813 // This is because the original collection contains the information to |
810 // restore the dragging panel to the right place when the drag is cancelled. | 814 // restore the dragging panel to the right place when the drag is cancelled. |
811 if (stack != dragging_panel_original_collection_) | 815 if (stack != dragging_panel_original_collection_) |
812 panel_manager_->RemoveStack(stack); | 816 panel_manager_->RemoveStack(stack); |
813 } | 817 } |
814 } | 818 } |
OLD | NEW |