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/gtk/tabs/dragged_tab_controller_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "chrome/browser/platform_util.h" | 12 #include "chrome/browser/platform_util.h" |
13 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" | 13 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 15 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
16 #include "chrome/browser/ui/gtk/gtk_util.h" | 16 #include "chrome/browser/ui/gtk/gtk_util.h" |
17 #include "chrome/browser/ui/gtk/tabs/dragged_view_gtk.h" | 17 #include "chrome/browser/ui/gtk/tabs/dragged_view_gtk.h" |
18 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" | 18 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
20 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
21 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 24 #include "content/public/browser/web_contents_view.h" |
24 #include "ui/base/gtk/gtk_screen_util.h" | 25 #include "ui/base/gtk/gtk_screen_util.h" |
25 #include "ui/gfx/screen.h" | 26 #include "ui/gfx/screen.h" |
26 | 27 |
27 using content::OpenURLParams; | 28 using content::OpenURLParams; |
28 using content::WebContents; | 29 using content::WebContents; |
29 | 30 |
30 namespace { | 31 namespace { |
31 | 32 |
32 // Delay, in ms, during dragging before we bring a window to front. | 33 // Delay, in ms, during dragging before we bring a window to front. |
33 const int kBringToFrontDelay = 750; | 34 const int kBringToFrontDelay = 750; |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 if (drag_data_->get(i)->contents_ && | 780 if (drag_data_->get(i)->contents_ && |
780 drag_data_->get(i)->contents_->GetDelegate() == this) { | 781 drag_data_->get(i)->contents_->GetDelegate() == this) { |
781 drag_data_->get(i)->ResetDelegate(); | 782 drag_data_->get(i)->ResetDelegate(); |
782 } | 783 } |
783 } | 784 } |
784 } | 785 } |
785 | 786 |
786 void DraggedTabControllerGtk::EnsureDraggedView() { | 787 void DraggedTabControllerGtk::EnsureDraggedView() { |
787 if (!dragged_view_.get()) { | 788 if (!dragged_view_.get()) { |
788 gfx::Rect rect; | 789 gfx::Rect rect; |
789 drag_data_->GetSourceWebContents()->GetContainerBounds(&rect); | 790 drag_data_->GetSourceWebContents()->GetView()->GetContainerBounds(&rect); |
790 dragged_view_.reset(new DraggedViewGtk(drag_data_.get(), mouse_offset_, | 791 dragged_view_.reset(new DraggedViewGtk(drag_data_.get(), mouse_offset_, |
791 rect.size())); | 792 rect.size())); |
792 } | 793 } |
793 } | 794 } |
794 | 795 |
795 gfx::Rect DraggedTabControllerGtk::GetAnimateBounds() { | 796 gfx::Rect DraggedTabControllerGtk::GetAnimateBounds() { |
796 // A hidden widget moved with gtk_fixed_move in a GtkFixed container doesn't | 797 // A hidden widget moved with gtk_fixed_move in a GtkFixed container doesn't |
797 // update its allocation until after the widget is shown, so we have to use | 798 // update its allocation until after the widget is shown, so we have to use |
798 // the tab bounds we keep track of. | 799 // the tab bounds we keep track of. |
799 // | 800 // |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 | 879 |
879 bool DraggedTabControllerGtk::AreTabsConsecutive() { | 880 bool DraggedTabControllerGtk::AreTabsConsecutive() { |
880 for (size_t i = 1; i < drag_data_->size(); ++i) { | 881 for (size_t i = 1; i < drag_data_->size(); ++i) { |
881 if (drag_data_->get(i - 1)->source_model_index_ + 1 != | 882 if (drag_data_->get(i - 1)->source_model_index_ + 1 != |
882 drag_data_->get(i)->source_model_index_) { | 883 drag_data_->get(i)->source_model_index_) { |
883 return false; | 884 return false; |
884 } | 885 } |
885 } | 886 } |
886 return true; | 887 return true; |
887 } | 888 } |
OLD | NEW |