Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller.cc

Issue 1456963002: Make browser windows override_redirect when dragging tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make browser windows override_redirect when dragging tabs. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame.cc ('k') | ui/aura/window_tree_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
1501 if (attached_tabstrip_) { 1502 if (attached_tabstrip_) {
1503 if (is_dragging_new_browser_) {
1504 // Remap the window without override-redirect, so that the window manager
1505 // will pick it up (we use an unmanaged window while dragging).
1506 GetAttachedBrowserWidget()->GetNativeView()->GetHost()->
1507 RemapAsNormalWindow();
1508 }
1509
1502 if (is_dragging_new_browser_ || did_restore_window_) { 1510 if (is_dragging_new_browser_ || did_restore_window_) {
1503 if (IsDockedOrSnapped(attached_tabstrip_)) { 1511 if (IsDockedOrSnapped(attached_tabstrip_)) {
1504 was_source_maximized_ = false; 1512 was_source_maximized_ = false;
1505 was_source_fullscreen_ = false; 1513 was_source_fullscreen_ = false;
1506 } 1514 }
1507 1515
1508 // If source window was maximized - maximize the new window as well. 1516 // If source window was maximized - maximize the new window as well.
1509 if (was_source_maximized_ || was_source_fullscreen_) 1517 if (was_source_maximized_ || was_source_fullscreen_)
1510 MaximizeAttachedWindow(); 1518 MaximizeAttachedWindow();
1511 } 1519 }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 point_in_screen, 1751 point_in_screen,
1744 drag_bounds)); 1752 drag_bounds));
1745 *drag_offset = point_in_screen - new_bounds.origin(); 1753 *drag_offset = point_in_screen - new_bounds.origin();
1746 1754
1747 Profile* profile = 1755 Profile* profile =
1748 Profile::FromBrowserContext(drag_data_[0].contents->GetBrowserContext()); 1756 Profile::FromBrowserContext(drag_data_[0].contents->GetBrowserContext());
1749 Browser::CreateParams create_params(Browser::TYPE_TABBED, 1757 Browser::CreateParams create_params(Browser::TYPE_TABBED,
1750 profile, 1758 profile,
1751 host_desktop_type_); 1759 host_desktop_type_);
1752 create_params.initial_bounds = new_bounds; 1760 create_params.initial_bounds = new_bounds;
1761 create_params.is_being_dragged = true;
1753 Browser* browser = new Browser(create_params); 1762 Browser* browser = new Browser(create_params);
1754 is_dragging_new_browser_ = true; 1763 is_dragging_new_browser_ = true;
1755 SetWindowPositionManaged(browser->window()->GetNativeWindow(), false); 1764 SetWindowPositionManaged(browser->window()->GetNativeWindow(), false);
1756 // If the window is created maximized then the bounds we supplied are ignored. 1765 // If the window is created maximized then the bounds we supplied are ignored.
1757 // We need to reset them again so they are honored. 1766 // We need to reset them again so they are honored.
1758 browser->window()->SetBounds(new_bounds); 1767 browser->window()->SetBounds(new_bounds);
1759 1768
1760 return browser; 1769 return browser;
1761 } 1770 }
1762 1771
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 it != browser_list->end(); ++it) { 1825 it != browser_list->end(); ++it) {
1817 if ((*it)->tab_strip_model()->empty()) 1826 if ((*it)->tab_strip_model()->empty())
1818 exclude.insert((*it)->window()->GetNativeWindow()); 1827 exclude.insert((*it)->window()->GetNativeWindow());
1819 } 1828 }
1820 #endif 1829 #endif
1821 return GetLocalProcessWindowAtPoint(host_desktop_type_, 1830 return GetLocalProcessWindowAtPoint(host_desktop_type_,
1822 screen_point, 1831 screen_point,
1823 exclude); 1832 exclude);
1824 1833
1825 } 1834 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame.cc ('k') | ui/aura/window_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698