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 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 | 1040 |
1041 Detach(can_release_capture_ ? RELEASE_CAPTURE : DONT_RELEASE_CAPTURE); | 1041 Detach(can_release_capture_ ? RELEASE_CAPTURE : DONT_RELEASE_CAPTURE); |
1042 | 1042 |
1043 dragged_widget->SetVisibilityChangedAnimationsEnabled(false); | 1043 dragged_widget->SetVisibilityChangedAnimationsEnabled(false); |
1044 Attach(dragged_browser_view->tabstrip(), gfx::Point()); | 1044 Attach(dragged_browser_view->tabstrip(), gfx::Point()); |
1045 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, | 1045 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, |
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(true /* user_gesture */); |
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(true /* user_gesture */); | 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); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 item.web_contents = drag_data_[i].contents; | 1523 item.web_contents = drag_data_[i].contents; |
1524 item.add_types = drag_data_[i].pinned ? TabStripModel::ADD_PINNED | 1524 item.add_types = drag_data_[i].pinned ? TabStripModel::ADD_PINNED |
1525 : TabStripModel::ADD_NONE; | 1525 : TabStripModel::ADD_NONE; |
1526 contentses.push_back(item); | 1526 contentses.push_back(item); |
1527 } | 1527 } |
1528 | 1528 |
1529 Browser* new_browser = | 1529 Browser* new_browser = |
1530 GetModel(source_tabstrip_)->delegate()->CreateNewStripWithContents( | 1530 GetModel(source_tabstrip_)->delegate()->CreateNewStripWithContents( |
1531 contentses, window_bounds, widget->IsMaximized()); | 1531 contentses, window_bounds, widget->IsMaximized()); |
1532 ResetSelection(new_browser->tab_strip_model()); | 1532 ResetSelection(new_browser->tab_strip_model()); |
1533 new_browser->window()->Show(); | 1533 new_browser->window()->Show(true /* user_gesture */); |
1534 } | 1534 } |
1535 } | 1535 } |
1536 | 1536 |
1537 void TabDragController::MaximizeAttachedWindow() { | 1537 void TabDragController::MaximizeAttachedWindow() { |
1538 GetAttachedBrowserWidget()->Maximize(); | 1538 GetAttachedBrowserWidget()->Maximize(); |
1539 #if defined(USE_ASH) | 1539 #if defined(USE_ASH) |
1540 if (was_source_fullscreen_ && | 1540 if (was_source_fullscreen_ && |
1541 host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { | 1541 host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { |
1542 // In fullscreen mode it is only possible to get here if the source | 1542 // In fullscreen mode it is only possible to get here if the source |
1543 // was in "immersive fullscreen" mode, so toggle it back on. | 1543 // was in "immersive fullscreen" mode, so toggle it back on. |
(...skipping 252 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 |