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 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 data->source_model_index, data->contents, | 1866 data->source_model_index, data->contents, |
1867 (data->pinned ? TabStripModel::ADD_PINNED : 0)); | 1867 (data->pinned ? TabStripModel::ADD_PINNED : 0)); |
1868 } | 1868 } |
1869 } | 1869 } |
1870 | 1870 |
1871 void TabDragController::CompleteDrag() { | 1871 void TabDragController::CompleteDrag() { |
1872 DCHECK(started_drag_); | 1872 DCHECK(started_drag_); |
1873 | 1873 |
1874 if (attached_tabstrip_) { | 1874 if (attached_tabstrip_) { |
1875 if (is_dragging_new_browser_) { | 1875 if (is_dragging_new_browser_) { |
| 1876 if (attached_tabstrip_->GetWidget()->IsDocked()) { |
| 1877 DCHECK_EQ(host_desktop_type_, chrome::HOST_DESKTOP_TYPE_ASH); |
| 1878 was_source_maximized_ = false; |
| 1879 was_source_fullscreen_ = false; |
| 1880 } |
1876 // If source window was maximized - maximize the new window as well. | 1881 // If source window was maximized - maximize the new window as well. |
1877 if (was_source_maximized_) | 1882 if (was_source_maximized_) |
1878 attached_tabstrip_->GetWidget()->Maximize(); | 1883 attached_tabstrip_->GetWidget()->Maximize(); |
1879 #if defined(USE_ASH) | 1884 #if defined(USE_ASH) |
1880 if (was_source_fullscreen_ && | 1885 if (was_source_fullscreen_ && |
1881 host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { | 1886 host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { |
1882 // In fullscreen mode it is only possible to get here if the source | 1887 // In fullscreen mode it is only possible to get here if the source |
1883 // was in "immersive fullscreen" mode, so toggle it back on. | 1888 // was in "immersive fullscreen" mode, so toggle it back on. |
1884 ash::Shell::GetInstance()->delegate()->ToggleFullscreen(); | 1889 ash::Shell::GetInstance()->delegate()->ToggleFullscreen(); |
1885 } | 1890 } |
1886 #endif | 1891 #endif |
| 1892 } else { |
| 1893 // When dragging results in maximized or fullscreen browser window getting |
| 1894 // docked, restore it. |
| 1895 if ((was_source_fullscreen_ || was_source_maximized_) && |
| 1896 (attached_tabstrip_->GetWidget()->IsDocked())) { |
| 1897 DCHECK_EQ(host_desktop_type_, chrome::HOST_DESKTOP_TYPE_ASH); |
| 1898 attached_tabstrip_->GetWidget()->Restore(); |
| 1899 } |
1887 } | 1900 } |
1888 attached_tabstrip_->StoppedDraggingTabs( | 1901 attached_tabstrip_->StoppedDraggingTabs( |
1889 GetTabsMatchingDraggedContents(attached_tabstrip_), | 1902 GetTabsMatchingDraggedContents(attached_tabstrip_), |
1890 initial_tab_positions_, | 1903 initial_tab_positions_, |
1891 move_behavior_ == MOVE_VISIBILE_TABS, | 1904 move_behavior_ == MOVE_VISIBILE_TABS, |
1892 true); | 1905 true); |
1893 } else { | 1906 } else { |
1894 if (dock_info_.type() != DockInfo::NONE) { | 1907 if (dock_info_.type() != DockInfo::NONE) { |
1895 switch (dock_info_.type()) { | 1908 switch (dock_info_.type()) { |
1896 case DockInfo::LEFT_OF_WINDOW: | 1909 case DockInfo::LEFT_OF_WINDOW: |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 gfx::Vector2d TabDragController::GetWindowOffset( | 2271 gfx::Vector2d TabDragController::GetWindowOffset( |
2259 const gfx::Point& point_in_screen) { | 2272 const gfx::Point& point_in_screen) { |
2260 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? | 2273 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? |
2261 attached_tabstrip_ : source_tabstrip_; | 2274 attached_tabstrip_ : source_tabstrip_; |
2262 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); | 2275 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); |
2263 | 2276 |
2264 gfx::Point point = point_in_screen; | 2277 gfx::Point point = point_in_screen; |
2265 views::View::ConvertPointFromScreen(toplevel_view, &point); | 2278 views::View::ConvertPointFromScreen(toplevel_view, &point); |
2266 return point.OffsetFromOrigin(); | 2279 return point.OffsetFromOrigin(); |
2267 } | 2280 } |
OLD | NEW |