Chromium Code Reviews| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 #include "ui/gfx/canvas.h" | 45 #include "ui/gfx/canvas.h" |
| 46 #include "ui/gfx/image/image_skia.h" | 46 #include "ui/gfx/image/image_skia.h" |
| 47 #include "ui/gfx/screen.h" | 47 #include "ui/gfx/screen.h" |
| 48 #include "ui/views/focus/view_storage.h" | 48 #include "ui/views/focus/view_storage.h" |
| 49 #include "ui/views/widget/root_view.h" | 49 #include "ui/views/widget/root_view.h" |
| 50 #include "ui/views/widget/widget.h" | 50 #include "ui/views/widget/widget.h" |
| 51 | 51 |
| 52 #if defined(USE_ASH) | 52 #if defined(USE_ASH) |
| 53 #include "ash/shell.h" | 53 #include "ash/shell.h" |
| 54 #include "ash/shell_delegate.h" | 54 #include "ash/shell_delegate.h" |
| 55 #include "ash/shell_window_ids.h" | |
| 55 #include "ash/wm/coordinate_conversion.h" | 56 #include "ash/wm/coordinate_conversion.h" |
| 56 #include "ash/wm/window_state.h" | 57 #include "ash/wm/window_state.h" |
| 57 #include "ui/aura/env.h" | 58 #include "ui/aura/env.h" |
| 58 #include "ui/aura/root_window.h" | 59 #include "ui/aura/root_window.h" |
| 59 #include "ui/events/gestures/gesture_recognizer.h" | 60 #include "ui/events/gestures/gesture_recognizer.h" |
| 60 #endif | 61 #endif |
| 61 | 62 |
| 62 #if defined(OS_WIN) && defined(USE_AURA) | 63 #if defined(OS_WIN) && defined(USE_AURA) |
| 63 #include "ui/aura/window.h" | 64 #include "ui/aura/window.h" |
| 64 #include "ui/events/gestures/gesture_recognizer.h" | 65 #include "ui/events/gestures/gesture_recognizer.h" |
| (...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1866 data->source_model_index, data->contents, | 1867 data->source_model_index, data->contents, |
| 1867 (data->pinned ? TabStripModel::ADD_PINNED : 0)); | 1868 (data->pinned ? TabStripModel::ADD_PINNED : 0)); |
| 1868 } | 1869 } |
| 1869 } | 1870 } |
| 1870 | 1871 |
| 1871 void TabDragController::CompleteDrag() { | 1872 void TabDragController::CompleteDrag() { |
| 1872 DCHECK(started_drag_); | 1873 DCHECK(started_drag_); |
| 1873 | 1874 |
| 1874 if (attached_tabstrip_) { | 1875 if (attached_tabstrip_) { |
| 1875 if (is_dragging_new_browser_) { | 1876 if (is_dragging_new_browser_) { |
| 1877 #if defined(USE_ASH) | |
| 1878 if (attached_tabstrip_->GetWidget()->GetNativeWindow()->parent()->id() == | |
| 1879 ash::internal::kShellWindowId_DockedContainer) { | |
| 1880 was_source_maximized_ = false; | |
| 1881 was_source_fullscreen_ = false; | |
| 1882 } | |
| 1883 #endif | |
| 1876 // If source window was maximized - maximize the new window as well. | 1884 // If source window was maximized - maximize the new window as well. |
| 1877 if (was_source_maximized_) | 1885 if (was_source_maximized_) |
| 1878 attached_tabstrip_->GetWidget()->Maximize(); | 1886 attached_tabstrip_->GetWidget()->Maximize(); |
| 1879 #if defined(USE_ASH) | 1887 #if defined(USE_ASH) |
| 1880 if (was_source_fullscreen_ && | 1888 if (was_source_fullscreen_ && |
| 1881 host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { | 1889 host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { |
| 1882 // In fullscreen mode it is only possible to get here if the source | 1890 // In fullscreen mode it is only possible to get here if the source |
| 1883 // was in "immersive fullscreen" mode, so toggle it back on. | 1891 // was in "immersive fullscreen" mode, so toggle it back on. |
| 1884 ash::Shell::GetInstance()->delegate()->ToggleFullscreen(); | 1892 ash::Shell::GetInstance()->delegate()->ToggleFullscreen(); |
| 1885 } | 1893 } |
| 1886 #endif | 1894 #endif |
| 1895 } else { | |
| 1896 #if defined(USE_ASH) | |
| 1897 // When dragging results in maximized or fullscreen browser window getting | |
| 1898 // docked, restore it. | |
| 1899 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH && | |
|
oshima
2013/10/25 16:12:32
I think this check isn't necessary as the paren'ts
varkha
2013/10/25 17:05:04
Done.
| |
| 1900 (was_source_fullscreen_ || was_source_maximized_) && | |
| 1901 (attached_tabstrip_->GetWidget()->GetNativeWindow()->parent()->id() == | |
| 1902 ash::internal::kShellWindowId_DockedContainer)) { | |
| 1903 attached_tabstrip_->GetWidget()->Restore(); | |
| 1904 } | |
| 1905 #endif | |
| 1887 } | 1906 } |
| 1888 attached_tabstrip_->StoppedDraggingTabs( | 1907 attached_tabstrip_->StoppedDraggingTabs( |
| 1889 GetTabsMatchingDraggedContents(attached_tabstrip_), | 1908 GetTabsMatchingDraggedContents(attached_tabstrip_), |
| 1890 initial_tab_positions_, | 1909 initial_tab_positions_, |
| 1891 move_behavior_ == MOVE_VISIBILE_TABS, | 1910 move_behavior_ == MOVE_VISIBILE_TABS, |
| 1892 true); | 1911 true); |
| 1893 } else { | 1912 } else { |
| 1894 if (dock_info_.type() != DockInfo::NONE) { | 1913 if (dock_info_.type() != DockInfo::NONE) { |
| 1895 switch (dock_info_.type()) { | 1914 switch (dock_info_.type()) { |
| 1896 case DockInfo::LEFT_OF_WINDOW: | 1915 case DockInfo::LEFT_OF_WINDOW: |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2258 gfx::Vector2d TabDragController::GetWindowOffset( | 2277 gfx::Vector2d TabDragController::GetWindowOffset( |
| 2259 const gfx::Point& point_in_screen) { | 2278 const gfx::Point& point_in_screen) { |
| 2260 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? | 2279 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? |
| 2261 attached_tabstrip_ : source_tabstrip_; | 2280 attached_tabstrip_ : source_tabstrip_; |
| 2262 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); | 2281 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); |
| 2263 | 2282 |
| 2264 gfx::Point point = point_in_screen; | 2283 gfx::Point point = point_in_screen; |
| 2265 views::View::ConvertPointFromScreen(toplevel_view, &point); | 2284 views::View::ConvertPointFromScreen(toplevel_view, &point); |
| 2266 return point.OffsetFromOrigin(); | 2285 return point.OffsetFromOrigin(); |
| 2267 } | 2286 } |
| OLD | NEW |