OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/tabs/dragged_tab_controller_gtk.h" | 5 #include "chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 | 432 |
433 // Detaching resets the delegate, but we still want to be the delegate. | 433 // Detaching resets the delegate, but we still want to be the delegate. |
434 dragged_contents_->set_delegate(this); | 434 dragged_contents_->set_delegate(this); |
435 | 435 |
436 attached_tabstrip_ = NULL; | 436 attached_tabstrip_ = NULL; |
437 } | 437 } |
438 | 438 |
439 gfx::Point DraggedTabControllerGtk::ConvertScreenPointToTabStripPoint( | 439 gfx::Point DraggedTabControllerGtk::ConvertScreenPointToTabStripPoint( |
440 TabStripGtk* tabstrip, const gfx::Point& screen_point) { | 440 TabStripGtk* tabstrip, const gfx::Point& screen_point) { |
441 gint x, y; | 441 gfx::Point tabstrip_screen_point = |
442 gdk_window_get_origin(tabstrip->tabstrip_->window, &x, &y); | 442 gtk_util::GetWidgetScreenPosition(tabstrip->tabstrip_.get()); |
443 return gfx::Point(screen_point.x() - x, screen_point.y() - y); | 443 return screen_point.Subtract(tabstrip_screen_point); |
444 } | 444 } |
445 | 445 |
446 gfx::Rect DraggedTabControllerGtk::GetDraggedTabTabStripBounds( | 446 gfx::Rect DraggedTabControllerGtk::GetDraggedTabTabStripBounds( |
447 const gfx::Point& screen_point) { | 447 const gfx::Point& screen_point) { |
448 gfx::Point client_point = | 448 gfx::Point client_point = |
449 ConvertScreenPointToTabStripPoint(attached_tabstrip_, screen_point); | 449 ConvertScreenPointToTabStripPoint(attached_tabstrip_, screen_point); |
450 gfx::Size tab_size = dragged_tab_->attached_tab_size(); | 450 gfx::Size tab_size = dragged_tab_->attached_tab_size(); |
451 return gfx::Rect(client_point.x(), client_point.y(), | 451 return gfx::Rect(client_point.x(), client_point.y(), |
452 tab_size.width(), tab_size.height()); | 452 tab_size.width(), tab_size.height()); |
453 } | 453 } |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 gfx::NativeView dragged_tab = dragged_tab_->widget(); | 772 gfx::NativeView dragged_tab = dragged_tab_->widget(); |
773 dock_windows_.insert(dragged_tab); | 773 dock_windows_.insert(dragged_tab); |
774 window = DockInfo::GetLocalProcessWindowAtPoint(GetCursorScreenPoint(), | 774 window = DockInfo::GetLocalProcessWindowAtPoint(GetCursorScreenPoint(), |
775 dock_windows_); | 775 dock_windows_); |
776 dock_windows_.erase(dragged_tab); | 776 dock_windows_.erase(dragged_tab); |
777 } | 777 } |
778 | 778 |
779 if (window) | 779 if (window) |
780 gtk_window_present(GTK_WINDOW(window)); | 780 gtk_window_present(GTK_WINDOW(window)); |
781 } | 781 } |
OLD | NEW |