Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: chrome/browser/ui/views/tabs/dragged_tab_controller.cc

Issue 6023014: Fixes bug where we would allow dragging tabs in incognito windows too (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698