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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/ui/views/tabs/tab.h" | 22 #include "chrome/browser/ui/views/tabs/tab.h" |
23 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 23 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
24 #include "chrome/browser/ui/views/tabs/window_finder.h" | 24 #include "chrome/browser/ui/views/tabs/window_finder.h" |
25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
26 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
27 #include "content/public/browser/notification_source.h" | 27 #include "content/public/browser/notification_source.h" |
28 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
29 #include "content/public/browser/user_metrics.h" | 29 #include "content/public/browser/user_metrics.h" |
30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
31 #include "extensions/browser/extension_function_dispatcher.h" | 31 #include "extensions/browser/extension_function_dispatcher.h" |
| 32 #include "ui/aura/window_tree_host.h" |
32 #include "ui/events/event_constants.h" | 33 #include "ui/events/event_constants.h" |
33 #include "ui/events/gestures/gesture_recognizer.h" | 34 #include "ui/events/gestures/gesture_recognizer.h" |
34 #include "ui/gfx/geometry/point_conversions.h" | 35 #include "ui/gfx/geometry/point_conversions.h" |
35 #include "ui/gfx/screen.h" | 36 #include "ui/gfx/screen.h" |
36 #include "ui/views/event_monitor.h" | 37 #include "ui/views/event_monitor.h" |
37 #include "ui/views/focus/view_storage.h" | 38 #include "ui/views/focus/view_storage.h" |
38 #include "ui/views/widget/root_view.h" | 39 #include "ui/views/widget/root_view.h" |
39 #include "ui/views/widget/widget.h" | 40 #include "ui/views/widget/widget.h" |
40 | 41 |
41 #if defined(USE_ASH) | 42 #if defined(USE_ASH) |
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 // source TabStrip. | 1492 // source TabStrip. |
1492 GetModel(source_tabstrip_)->InsertWebContentsAt( | 1493 GetModel(source_tabstrip_)->InsertWebContentsAt( |
1493 data->source_model_index, data->contents, | 1494 data->source_model_index, data->contents, |
1494 (data->pinned ? TabStripModel::ADD_PINNED : 0)); | 1495 (data->pinned ? TabStripModel::ADD_PINNED : 0)); |
1495 } | 1496 } |
1496 } | 1497 } |
1497 | 1498 |
1498 void TabDragController::CompleteDrag() { | 1499 void TabDragController::CompleteDrag() { |
1499 DCHECK(started_drag_); | 1500 DCHECK(started_drag_); |
1500 | 1501 |
| 1502 // Remap the window without override-redirect, so that the window manager will |
| 1503 // pick it up (we use an unmanaged window while dragging). |
| 1504 GetAttachedBrowserWidget()->GetNativeView()->GetHost()->RemapAsNormalWindow(); |
| 1505 |
1501 if (attached_tabstrip_) { | 1506 if (attached_tabstrip_) { |
1502 if (is_dragging_new_browser_ || did_restore_window_) { | 1507 if (is_dragging_new_browser_ || did_restore_window_) { |
1503 if (IsDockedOrSnapped(attached_tabstrip_)) { | 1508 if (IsDockedOrSnapped(attached_tabstrip_)) { |
1504 was_source_maximized_ = false; | 1509 was_source_maximized_ = false; |
1505 was_source_fullscreen_ = false; | 1510 was_source_fullscreen_ = false; |
1506 } | 1511 } |
1507 | 1512 |
1508 // If source window was maximized - maximize the new window as well. | 1513 // If source window was maximized - maximize the new window as well. |
1509 if (was_source_maximized_ || was_source_fullscreen_) | 1514 if (was_source_maximized_ || was_source_fullscreen_) |
1510 MaximizeAttachedWindow(); | 1515 MaximizeAttachedWindow(); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 point_in_screen, | 1748 point_in_screen, |
1744 drag_bounds)); | 1749 drag_bounds)); |
1745 *drag_offset = point_in_screen - new_bounds.origin(); | 1750 *drag_offset = point_in_screen - new_bounds.origin(); |
1746 | 1751 |
1747 Profile* profile = | 1752 Profile* profile = |
1748 Profile::FromBrowserContext(drag_data_[0].contents->GetBrowserContext()); | 1753 Profile::FromBrowserContext(drag_data_[0].contents->GetBrowserContext()); |
1749 Browser::CreateParams create_params(Browser::TYPE_TABBED, | 1754 Browser::CreateParams create_params(Browser::TYPE_TABBED, |
1750 profile, | 1755 profile, |
1751 host_desktop_type_); | 1756 host_desktop_type_); |
1752 create_params.initial_bounds = new_bounds; | 1757 create_params.initial_bounds = new_bounds; |
| 1758 create_params.is_being_dragged = true; |
1753 Browser* browser = new Browser(create_params); | 1759 Browser* browser = new Browser(create_params); |
1754 is_dragging_new_browser_ = true; | 1760 is_dragging_new_browser_ = true; |
1755 SetWindowPositionManaged(browser->window()->GetNativeWindow(), false); | 1761 SetWindowPositionManaged(browser->window()->GetNativeWindow(), false); |
1756 // If the window is created maximized then the bounds we supplied are ignored. | 1762 // If the window is created maximized then the bounds we supplied are ignored. |
1757 // We need to reset them again so they are honored. | 1763 // We need to reset them again so they are honored. |
1758 browser->window()->SetBounds(new_bounds); | 1764 browser->window()->SetBounds(new_bounds); |
1759 | 1765 |
1760 return browser; | 1766 return browser; |
1761 } | 1767 } |
1762 | 1768 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 it != browser_list->end(); ++it) { | 1822 it != browser_list->end(); ++it) { |
1817 if ((*it)->tab_strip_model()->empty()) | 1823 if ((*it)->tab_strip_model()->empty()) |
1818 exclude.insert((*it)->window()->GetNativeWindow()); | 1824 exclude.insert((*it)->window()->GetNativeWindow()); |
1819 } | 1825 } |
1820 #endif | 1826 #endif |
1821 return GetLocalProcessWindowAtPoint(host_desktop_type_, | 1827 return GetLocalProcessWindowAtPoint(host_desktop_type_, |
1822 screen_point, | 1828 screen_point, |
1823 exclude); | 1829 exclude); |
1824 | 1830 |
1825 } | 1831 } |
OLD | NEW |