| 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/views/tabs/dragged_tab_controller.h" | 5 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 drag_data_[i].contents->tab_contents()->delegate() == this) { | 1304 drag_data_[i].contents->tab_contents()->delegate() == this) { |
| 1305 drag_data_[i].contents->tab_contents()->set_delegate( | 1305 drag_data_[i].contents->tab_contents()->set_delegate( |
| 1306 drag_data_[i].original_delegate); | 1306 drag_data_[i].original_delegate); |
| 1307 } | 1307 } |
| 1308 } | 1308 } |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 void DraggedTabController::CreateDraggedView( | 1311 void DraggedTabController::CreateDraggedView( |
| 1312 const std::vector<TabRendererData>& data, | 1312 const std::vector<TabRendererData>& data, |
| 1313 const std::vector<gfx::Rect>& renderer_bounds) { | 1313 const std::vector<gfx::Rect>& renderer_bounds) { |
| 1314 #if !defined(USE_AURA) |
| 1314 DCHECK(!view_.get()); | 1315 DCHECK(!view_.get()); |
| 1315 DCHECK_EQ(data.size(), drag_data_.size()); | 1316 DCHECK_EQ(data.size(), drag_data_.size()); |
| 1316 | 1317 |
| 1317 // Set up the photo booth to start capturing the contents of the dragged | 1318 // Set up the photo booth to start capturing the contents of the dragged |
| 1318 // TabContents. | 1319 // TabContents. |
| 1319 NativeViewPhotobooth* photobooth = | 1320 NativeViewPhotobooth* photobooth = |
| 1320 NativeViewPhotobooth::Create( | 1321 NativeViewPhotobooth::Create( |
| 1321 source_dragged_contents()->tab_contents()->GetNativeView()); | 1322 source_dragged_contents()->tab_contents()->GetNativeView()); |
| 1322 | 1323 |
| 1323 gfx::Rect content_bounds; | 1324 gfx::Rect content_bounds; |
| 1324 source_dragged_contents()->tab_contents()->GetContainerBounds( | 1325 source_dragged_contents()->tab_contents()->GetContainerBounds( |
| 1325 &content_bounds); | 1326 &content_bounds); |
| 1326 | 1327 |
| 1327 std::vector<views::View*> renderers; | 1328 std::vector<views::View*> renderers; |
| 1328 for (size_t i = 0; i < drag_data_.size(); ++i) { | 1329 for (size_t i = 0; i < drag_data_.size(); ++i) { |
| 1329 BaseTab* renderer = source_tabstrip_->CreateTabForDragging(); | 1330 BaseTab* renderer = source_tabstrip_->CreateTabForDragging(); |
| 1330 renderer->SetData(data[i]); | 1331 renderer->SetData(data[i]); |
| 1331 renderers.push_back(renderer); | 1332 renderers.push_back(renderer); |
| 1332 } | 1333 } |
| 1333 // DraggedTabView takes ownership of the renderers. | 1334 // DraggedTabView takes ownership of the renderers. |
| 1334 view_.reset(new DraggedTabView(renderers, renderer_bounds, mouse_offset_, | 1335 view_.reset(new DraggedTabView(renderers, renderer_bounds, mouse_offset_, |
| 1335 content_bounds.size(), photobooth)); | 1336 content_bounds.size(), photobooth)); |
| 1337 #else |
| 1338 // TODO(beng): |
| 1339 NOTIMPLEMENTED(); |
| 1340 #endif |
| 1336 } | 1341 } |
| 1337 | 1342 |
| 1338 gfx::Point DraggedTabController::GetCursorScreenPoint() const { | 1343 gfx::Point DraggedTabController::GetCursorScreenPoint() const { |
| 1339 #if defined(OS_WIN) | 1344 #if defined(OS_WIN) |
| 1340 DWORD pos = GetMessagePos(); | 1345 DWORD pos = GetMessagePos(); |
| 1341 return gfx::Point(pos); | 1346 return gfx::Point(pos); |
| 1342 #elif defined(TOOLKIT_USES_GTK) | 1347 #elif defined(TOOLKIT_USES_GTK) |
| 1343 gint x, y; | 1348 gint x, y; |
| 1344 gdk_display_get_pointer(gdk_display_get_default(), NULL, &x, &y, NULL); | 1349 gdk_display_get_pointer(gdk_display_get_default(), NULL, &x, &y, NULL); |
| 1345 return gfx::Point(x, y); | 1350 return gfx::Point(x, y); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 | 1435 |
| 1431 bool DraggedTabController::AreTabsConsecutive() { | 1436 bool DraggedTabController::AreTabsConsecutive() { |
| 1432 for (size_t i = 1; i < drag_data_.size(); ++i) { | 1437 for (size_t i = 1; i < drag_data_.size(); ++i) { |
| 1433 if (drag_data_[i - 1].source_model_index + 1 != | 1438 if (drag_data_[i - 1].source_model_index + 1 != |
| 1434 drag_data_[i].source_model_index) { | 1439 drag_data_[i].source_model_index) { |
| 1435 return false; | 1440 return false; |
| 1436 } | 1441 } |
| 1437 } | 1442 } |
| 1438 return true; | 1443 return true; |
| 1439 } | 1444 } |
| OLD | NEW |