| 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/views/tabs/dragged_tab_controller.h" | 5 #include "chrome/browser/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 "app/animation.h" | 10 #include "app/animation.h" |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 // Update the Model. | 876 // Update the Model. |
| 877 TabRendererData tab_data = attached_tab_->data(); | 877 TabRendererData tab_data = attached_tab_->data(); |
| 878 TabStripModel* attached_model = GetModel(attached_tabstrip_); | 878 TabStripModel* attached_model = GetModel(attached_tabstrip_); |
| 879 int index = attached_model->GetIndexOfTabContents(dragged_contents_); | 879 int index = attached_model->GetIndexOfTabContents(dragged_contents_); |
| 880 DCHECK(index != -1); | 880 DCHECK(index != -1); |
| 881 // Hide the tab so that the user doesn't see it animate closed. | 881 // Hide the tab so that the user doesn't see it animate closed. |
| 882 attached_tab_->SetVisible(false); | 882 attached_tab_->SetVisible(false); |
| 883 attached_model->DetachTabContentsAt(index); | 883 attached_model->DetachTabContentsAt(index); |
| 884 | 884 |
| 885 // If we've removed the last Tab from the TabStrip, hide the frame now. | 885 // If we've removed the last Tab from the TabStrip, hide the frame now. |
| 886 if (!attached_model->HasNonPhantomTabs()) | 886 if (attached_model->empty()) |
| 887 HideFrame(); | 887 HideFrame(); |
| 888 | 888 |
| 889 // Set up the photo booth to start capturing the contents of the dragged | 889 // Set up the photo booth to start capturing the contents of the dragged |
| 890 // TabContents. | 890 // TabContents. |
| 891 if (!photobooth_.get()) { | 891 if (!photobooth_.get()) { |
| 892 photobooth_.reset( | 892 photobooth_.reset( |
| 893 NativeViewPhotobooth::Create(dragged_contents_->GetNativeView())); | 893 NativeViewPhotobooth::Create(dragged_contents_->GetNativeView())); |
| 894 } | 894 } |
| 895 | 895 |
| 896 // Create the dragged view. | 896 // Create the dragged view. |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 // the drag session is aborted we can restore them. | 1274 // the drag session is aborted we can restore them. |
| 1275 restore_bounds_ = gfx::Rect(wr); | 1275 restore_bounds_ = gfx::Rect(wr); |
| 1276 #else | 1276 #else |
| 1277 NOTIMPLEMENTED(); | 1277 NOTIMPLEMENTED(); |
| 1278 #endif | 1278 #endif |
| 1279 } | 1279 } |
| 1280 | 1280 |
| 1281 void DraggedTabController::CleanUpHiddenFrame() { | 1281 void DraggedTabController::CleanUpHiddenFrame() { |
| 1282 // If the model we started dragging from is now empty, we must ask the | 1282 // If the model we started dragging from is now empty, we must ask the |
| 1283 // delegate to close the frame. | 1283 // delegate to close the frame. |
| 1284 if (!GetModel(source_tabstrip_)->HasNonPhantomTabs()) | 1284 if (GetModel(source_tabstrip_)->empty()) |
| 1285 GetModel(source_tabstrip_)->delegate()->CloseFrameAfterDragSession(); | 1285 GetModel(source_tabstrip_)->delegate()->CloseFrameAfterDragSession(); |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 void DraggedTabController::DockDisplayerDestroyed( | 1288 void DraggedTabController::DockDisplayerDestroyed( |
| 1289 DockDisplayer* controller) { | 1289 DockDisplayer* controller) { |
| 1290 DockWindows::iterator dock_i = | 1290 DockWindows::iterator dock_i = |
| 1291 dock_windows_.find(controller->popup_view()); | 1291 dock_windows_.find(controller->popup_view()); |
| 1292 if (dock_i != dock_windows_.end()) | 1292 if (dock_i != dock_windows_.end()) |
| 1293 dock_windows_.erase(dock_i); | 1293 dock_windows_.erase(dock_i); |
| 1294 else | 1294 else |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 #else | 1326 #else |
| 1327 NOTIMPLEMENTED(); | 1327 NOTIMPLEMENTED(); |
| 1328 #endif | 1328 #endif |
| 1329 } | 1329 } |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { | 1332 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { |
| 1333 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> | 1333 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> |
| 1334 model(); | 1334 model(); |
| 1335 } | 1335 } |
| OLD | NEW |