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

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

Issue 6380007: Don't allow new windows to be created outside the monitor's work area.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
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) 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 window_create_point_.Offset(mouse_offset_.x(), mouse_offset_.y()); 530 window_create_point_.Offset(mouse_offset_.x(), mouse_offset_.y());
531 } 531 }
532 532
533 gfx::Point DraggedTabController::GetWindowCreatePoint() const { 533 gfx::Point DraggedTabController::GetWindowCreatePoint() const {
534 gfx::Point cursor_point = GetCursorScreenPoint(); 534 gfx::Point cursor_point = GetCursorScreenPoint();
535 if (dock_info_.type() != DockInfo::NONE) { 535 if (dock_info_.type() != DockInfo::NONE) {
536 // If we're going to dock, we need to return the exact coordinate, 536 // If we're going to dock, we need to return the exact coordinate,
537 // otherwise we may attempt to maximize on the wrong monitor. 537 // otherwise we may attempt to maximize on the wrong monitor.
538 return cursor_point; 538 return cursor_point;
539 } 539 }
540 // If the cursor is outside the monitor area, move it inside. For example,
541 // dropping a tab onto the task bar on Windows produces this situation.
542 DockInfo dock_info_for_cursor = DockInfo::GetDockInfoAtPoint(cursor_point,
543 std::set<gfx::NativeView>());
sky 2011/01/21 18:55:19 this should be indented by 4. Using DockInfo to g
544 if (cursor_point.x() < dock_info_for_cursor.monitor_bounds().x())
545 cursor_point.set_x(dock_info_for_cursor.monitor_bounds().x());
546 else if (cursor_point.x() > dock_info_for_cursor.monitor_bounds().right())
547 cursor_point.set_x(dock_info_for_cursor.monitor_bounds().right());
548 if (cursor_point.y() < dock_info_for_cursor.monitor_bounds().y())
549 cursor_point.set_y(dock_info_for_cursor.monitor_bounds().y());
550 else if (cursor_point.y() > dock_info_for_cursor.monitor_bounds().bottom())
551 cursor_point.set_y(dock_info_for_cursor.monitor_bounds().bottom());
540 return gfx::Point(cursor_point.x() - window_create_point_.x(), 552 return gfx::Point(cursor_point.x() - window_create_point_.x(),
541 cursor_point.y() - window_create_point_.y()); 553 cursor_point.y() - window_create_point_.y());
542 } 554 }
543 555
544 void DraggedTabController::UpdateDockInfo(const gfx::Point& screen_point) { 556 void DraggedTabController::UpdateDockInfo(const gfx::Point& screen_point) {
545 // Update the DockInfo for the current mouse coordinates. 557 // Update the DockInfo for the current mouse coordinates.
546 DockInfo dock_info = GetDockInfoAtPoint(screen_point); 558 DockInfo dock_info = GetDockInfoAtPoint(screen_point);
547 if (source_tabstrip_->type() == BaseTabStrip::VERTICAL_TAB_STRIP && 559 if (source_tabstrip_->type() == BaseTabStrip::VERTICAL_TAB_STRIP &&
548 ((dock_info.type() == DockInfo::LEFT_OF_WINDOW && 560 ((dock_info.type() == DockInfo::LEFT_OF_WINDOW &&
549 !base::i18n::IsRTL()) || 561 !base::i18n::IsRTL()) ||
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 #else 1348 #else
1337 NOTIMPLEMENTED(); 1349 NOTIMPLEMENTED();
1338 #endif 1350 #endif
1339 } 1351 }
1340 } 1352 }
1341 1353
1342 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { 1354 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const {
1343 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> 1355 return static_cast<BrowserTabStripController*>(tabstrip->controller())->
1344 model(); 1356 model();
1345 } 1357 }
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