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/views/tabs/tab_drag_controller.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 point_in_screen, | 1046 point_in_screen, |
1047 &drag_bounds); | 1047 &drag_bounds); |
1048 WindowPositionManagedUpdater updater; | 1048 WindowPositionManagedUpdater updater; |
1049 dragged_widget->AddObserver(&updater); | 1049 dragged_widget->AddObserver(&updater); |
1050 browser->window()->Show(); | 1050 browser->window()->Show(); |
1051 dragged_widget->RemoveObserver(&updater); | 1051 dragged_widget->RemoveObserver(&updater); |
1052 dragged_widget->SetVisibilityChangedAnimationsEnabled(true); | 1052 dragged_widget->SetVisibilityChangedAnimationsEnabled(true); |
1053 // Activate may trigger a focus loss, destroying us. | 1053 // Activate may trigger a focus loss, destroying us. |
1054 { | 1054 { |
1055 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 1055 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
1056 browser->window()->Activate(); | 1056 browser->window()->Activate(true /* user_gesture */); |
1057 if (!ref) | 1057 if (!ref) |
1058 return; | 1058 return; |
1059 } | 1059 } |
1060 RunMoveLoop(drag_offset); | 1060 RunMoveLoop(drag_offset); |
1061 } | 1061 } |
1062 | 1062 |
1063 void TabDragController::RunMoveLoop(const gfx::Vector2d& drag_offset) { | 1063 void TabDragController::RunMoveLoop(const gfx::Vector2d& drag_offset) { |
1064 // If the user drags the whole window we'll assume they are going to attach to | 1064 // If the user drags the whole window we'll assume they are going to attach to |
1065 // another window and therefore want to reorder. | 1065 // another window and therefore want to reorder. |
1066 move_behavior_ = REORDER; | 1066 move_behavior_ = REORDER; |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 it != browser_list->end(); ++it) { | 1796 it != browser_list->end(); ++it) { |
1797 if ((*it)->tab_strip_model()->empty()) | 1797 if ((*it)->tab_strip_model()->empty()) |
1798 exclude.insert((*it)->window()->GetNativeWindow()); | 1798 exclude.insert((*it)->window()->GetNativeWindow()); |
1799 } | 1799 } |
1800 #endif | 1800 #endif |
1801 return GetLocalProcessWindowAtPoint(host_desktop_type_, | 1801 return GetLocalProcessWindowAtPoint(host_desktop_type_, |
1802 screen_point, | 1802 screen_point, |
1803 exclude); | 1803 exclude); |
1804 | 1804 |
1805 } | 1805 } |
OLD | NEW |