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 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 const gfx::Point& point_in_screen, | 1726 const gfx::Point& point_in_screen, |
1727 gfx::Vector2d* drag_offset, | 1727 gfx::Vector2d* drag_offset, |
1728 std::vector<gfx::Rect>* drag_bounds) { | 1728 std::vector<gfx::Rect>* drag_bounds) { |
1729 gfx::Rect new_bounds(CalculateDraggedBrowserBounds(source, | 1729 gfx::Rect new_bounds(CalculateDraggedBrowserBounds(source, |
1730 point_in_screen, | 1730 point_in_screen, |
1731 drag_bounds)); | 1731 drag_bounds)); |
1732 *drag_offset = point_in_screen - new_bounds.origin(); | 1732 *drag_offset = point_in_screen - new_bounds.origin(); |
1733 | 1733 |
1734 Profile* profile = | 1734 Profile* profile = |
1735 Profile::FromBrowserContext(drag_data_[0].contents->GetBrowserContext()); | 1735 Profile::FromBrowserContext(drag_data_[0].contents->GetBrowserContext()); |
1736 Browser::CreateParams create_params(Browser::TYPE_TABBED, profile); | 1736 Browser::CreateParams create_params(Browser::TYPE_TABBED, profile, true); |
1737 create_params.initial_bounds = new_bounds; | 1737 create_params.initial_bounds = new_bounds; |
1738 Browser* browser = new Browser(create_params); | 1738 Browser* browser = new Browser(create_params); |
1739 is_dragging_new_browser_ = true; | 1739 is_dragging_new_browser_ = true; |
1740 // If the window is created maximized then the bounds we supplied are ignored. | 1740 // If the window is created maximized then the bounds we supplied are ignored. |
1741 // We need to reset them again so they are honored. | 1741 // We need to reset them again so they are honored. |
1742 browser->window()->SetBounds(new_bounds); | 1742 browser->window()->SetBounds(new_bounds); |
1743 | 1743 |
1744 return browser; | 1744 return browser; |
1745 } | 1745 } |
1746 | 1746 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1795 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1795 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
1796 for (auto* browser : *BrowserList::GetInstance()) { | 1796 for (auto* browser : *BrowserList::GetInstance()) { |
1797 if (browser->tab_strip_model()->empty()) | 1797 if (browser->tab_strip_model()->empty()) |
1798 exclude.insert(browser->window()->GetNativeWindow()); | 1798 exclude.insert(browser->window()->GetNativeWindow()); |
1799 } | 1799 } |
1800 #endif | 1800 #endif |
1801 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 1801 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
1802 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); | 1802 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); |
1803 return ref ? Liveness::ALIVE : Liveness::DELETED; | 1803 return ref ? Liveness::ALIVE : Liveness::DELETED; |
1804 } | 1804 } |
OLD | NEW |