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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 | 1014 |
1015 gfx::Point tab_loc(x, y); | 1015 gfx::Point tab_loc(x, y); |
1016 views::View::ConvertPointToView(NULL, attached_tabstrip_, &tab_loc); | 1016 views::View::ConvertPointToView(NULL, attached_tabstrip_, &tab_loc); |
1017 | 1017 |
1018 x = tab_loc.x(); | 1018 x = tab_loc.x(); |
1019 y = tab_loc.y(); | 1019 y = tab_loc.y(); |
1020 | 1020 |
1021 const gfx::Size& tab_size = attached_tab_->bounds().size(); | 1021 const gfx::Size& tab_size = attached_tab_->bounds().size(); |
1022 | 1022 |
1023 if (attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) { | 1023 if (attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) { |
1024 int max_x = attached_tabstrip_->bounds().right() - tab_size.width(); | 1024 int max_x = attached_tabstrip_->width() - tab_size.width(); |
1025 x = std::min(std::max(x, 0), max_x); | 1025 x = std::min(std::max(x, 0), max_x); |
1026 y = 0; | 1026 y = 0; |
1027 } else { | 1027 } else { |
1028 x = SideTabStrip::kTabStripInset; | 1028 x = SideTabStrip::kTabStripInset; |
1029 int max_y = attached_tabstrip_->bounds().bottom() - tab_size.height(); | 1029 int max_y = attached_tabstrip_->height() - tab_size.height(); |
1030 y = std::min(std::max(y, SideTabStrip::kTabStripInset), max_y); | 1030 y = std::min(std::max(y, SideTabStrip::kTabStripInset), max_y); |
1031 } | 1031 } |
1032 return gfx::Point(x, y); | 1032 return gfx::Point(x, y); |
1033 } | 1033 } |
1034 | 1034 |
1035 BaseTab* DraggedTabController::GetTabMatchingDraggedContents( | 1035 BaseTab* DraggedTabController::GetTabMatchingDraggedContents( |
1036 BaseTabStrip* tabstrip) const { | 1036 BaseTabStrip* tabstrip) const { |
1037 int model_index = | 1037 int model_index = |
1038 GetModel(tabstrip)->GetIndexOfTabContents(dragged_contents_); | 1038 GetModel(tabstrip)->GetIndexOfTabContents(dragged_contents_); |
1039 return model_index == TabStripModel::kNoTab ? | 1039 return model_index == TabStripModel::kNoTab ? |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 #else | 1336 #else |
1337 NOTIMPLEMENTED(); | 1337 NOTIMPLEMENTED(); |
1338 #endif | 1338 #endif |
1339 } | 1339 } |
1340 } | 1340 } |
1341 | 1341 |
1342 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { | 1342 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { |
1343 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> | 1343 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> |
1344 model(); | 1344 model(); |
1345 } | 1345 } |
OLD | NEW |