OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 drag_data_.reset(); | 79 drag_data_.reset(); |
80 } | 80 } |
81 | 81 |
82 void DraggedTabControllerGtk::CaptureDragInfo(const gfx::Point& mouse_offset) { | 82 void DraggedTabControllerGtk::CaptureDragInfo(const gfx::Point& mouse_offset) { |
83 start_screen_point_ = gfx::Screen::GetCursorScreenPoint(); | 83 start_screen_point_ = gfx::Screen::GetCursorScreenPoint(); |
84 mouse_offset_ = mouse_offset; | 84 mouse_offset_ = mouse_offset; |
85 } | 85 } |
86 | 86 |
87 void DraggedTabControllerGtk::Drag() { | 87 void DraggedTabControllerGtk::Drag() { |
88 if (!drag_data_->GetSourceTabData()->tab_ || | 88 if (!drag_data_->GetSourceTabData()->tab_ || |
89 !drag_data_->GetSourceTabContentsWrapper()) { | 89 !drag_data_->GetSourceTabContentsWrapper() || |
| 90 !drag_data_->GetSourceTabContents()) { |
90 return; | 91 return; |
91 } | 92 } |
92 | 93 |
93 bring_to_front_timer_.Stop(); | 94 bring_to_front_timer_.Stop(); |
94 | 95 |
95 EnsureDraggedView(); | 96 EnsureDraggedView(); |
96 | 97 |
97 // Before we get to dragging anywhere, ensure that we consider ourselves | 98 // Before we get to dragging anywhere, ensure that we consider ourselves |
98 // attached to the source tabstrip. | 99 // attached to the source tabstrip. |
99 if (drag_data_->GetSourceTabData()->tab_->IsVisible()) { | 100 if (drag_data_->GetSourceTabData()->tab_->IsVisible()) { |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 | 884 |
884 bool DraggedTabControllerGtk::AreTabsConsecutive() { | 885 bool DraggedTabControllerGtk::AreTabsConsecutive() { |
885 for (size_t i = 1; i < drag_data_->size(); ++i) { | 886 for (size_t i = 1; i < drag_data_->size(); ++i) { |
886 if (drag_data_->get(i - 1)->source_model_index_ + 1 != | 887 if (drag_data_->get(i - 1)->source_model_index_ + 1 != |
887 drag_data_->get(i)->source_model_index_) { | 888 drag_data_->get(i)->source_model_index_) { |
888 return false; | 889 return false; |
889 } | 890 } |
890 } | 891 } |
891 return true; | 892 return true; |
892 } | 893 } |
OLD | NEW |