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

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

Issue 1003863005: Fix tab drag and drop with hi-dpi. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tab drag and drop with hi-dpi. Created 5 years, 9 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
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/compositor/dip_util.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 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 TabStrip* owning_tabstrip = attached_tabstrip_ ? 1776 TabStrip* owning_tabstrip = attached_tabstrip_ ?
1776 attached_tabstrip_ : source_tabstrip_; 1777 attached_tabstrip_ : source_tabstrip_;
1777 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); 1778 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView();
1778 1779
1779 gfx::Point point = point_in_screen; 1780 gfx::Point point = point_in_screen;
1780 views::View::ConvertPointFromScreen(toplevel_view, &point); 1781 views::View::ConvertPointFromScreen(toplevel_view, &point);
1781 return point.OffsetFromOrigin(); 1782 return point.OffsetFromOrigin();
1782 } 1783 }
1783 1784
1784 gfx::NativeWindow TabDragController::GetLocalProcessWindow( 1785 gfx::NativeWindow TabDragController::GetLocalProcessWindow(
1785 const gfx::Point& screen_point, 1786 gfx::Point screen_point,
1786 bool exclude_dragged_view) { 1787 bool exclude_dragged_view) {
1787 std::set<gfx::NativeWindow> exclude; 1788 std::set<gfx::NativeWindow> exclude;
1788 if (exclude_dragged_view) { 1789 if (exclude_dragged_view) {
1789 gfx::NativeWindow dragged_window = 1790 gfx::NativeWindow dragged_window =
1790 attached_tabstrip_->GetWidget()->GetNativeWindow(); 1791 attached_tabstrip_->GetWidget()->GetNativeWindow();
1791 if (dragged_window) 1792 if (dragged_window)
1792 exclude.insert(dragged_window); 1793 exclude.insert(dragged_window);
1793 } 1794 }
1794 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 1795 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
1795 // Exclude windows which are pending deletion via Browser::TabStripEmpty(). 1796 // Exclude windows which are pending deletion via Browser::TabStripEmpty().
1796 // These windows can be returned in the Linux Aura port because the browser 1797 // These windows can be returned in the Linux Aura port because the browser
1797 // window which was used for dragging is not hidden once all of its tabs are 1798 // window which was used for dragging is not hidden once all of its tabs are
1798 // attached to another browser window in DragBrowserToNewTabStrip(). 1799 // attached to another browser window in DragBrowserToNewTabStrip().
1799 // TODO(pkotwicz): Fix this properly (crbug.com/358482) 1800 // TODO(pkotwicz): Fix this properly (crbug.com/358482)
1800 BrowserList* browser_list = BrowserList::GetInstance( 1801 BrowserList* browser_list = BrowserList::GetInstance(
1801 chrome::HOST_DESKTOP_TYPE_NATIVE); 1802 chrome::HOST_DESKTOP_TYPE_NATIVE);
1802 for (BrowserList::const_iterator it = browser_list->begin(); 1803 for (BrowserList::const_iterator it = browser_list->begin();
1803 it != browser_list->end(); ++it) { 1804 it != browser_list->end(); ++it) {
1804 if ((*it)->tab_strip_model()->empty()) 1805 if ((*it)->tab_strip_model()->empty())
1805 exclude.insert((*it)->window()->GetNativeWindow()); 1806 exclude.insert((*it)->window()->GetNativeWindow());
1806 } 1807 }
1807 #endif 1808 #endif
1809
1810 #if defined(OS_LINUX) && defined(USE_AURA)
1811 gfx::NativeWindow dragged_window =
1812 attached_tabstrip_->GetWidget()->GetNativeWindow();
1813 screen_point = ui::ConvertPointToPixel(dragged_window->layer(), screen_point);
1814 #endif
sadrul 2015/03/20 17:40:24 This should actually happen in window_finder_x11.c
stapelberg 2015/03/20 21:48:06 Done. I really hope you won’t suggest _another_ lo
sadrul 2015/03/20 22:02:03 Heh no. The new patchset looks good. We need to m
1815
1808 return GetLocalProcessWindowAtPoint(host_desktop_type_, 1816 return GetLocalProcessWindowAtPoint(host_desktop_type_,
1809 screen_point, 1817 screen_point,
1810 exclude); 1818 exclude);
1811
1812 } 1819 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698