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

Side by Side Diff: chrome/browser/views/tabs/tab_strip.cc

Issue 7317: Change all ConvertPointTo* methods to use gfx::Point instead of CPoint.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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 | « chrome/browser/views/tabs/tab_strip.h ('k') | chrome/browser/views/toolbar_star_toggle.cc » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/tab_strip.h" 5 #include "chrome/browser/views/tabs/tab_strip.h"
6 6
7 #include "base/gfx/size.h" 7 #include "base/gfx/size.h"
8 #include "chrome/app/theme/theme_resources.h" 8 #include "chrome/app/theme/theme_resources.h"
9 #include "chrome/browser/profile.h" 9 #include "chrome/browser/profile.h"
10 #include "chrome/browser/tab_contents.h" 10 #include "chrome/browser/tab_contents.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 void TabStrip::ShowApplicationMenu(const gfx::Point& p) { 520 void TabStrip::ShowApplicationMenu(const gfx::Point& p) {
521 TabStripModelDelegate* delegate = model_->delegate(); 521 TabStripModelDelegate* delegate = model_->delegate();
522 if (delegate) 522 if (delegate)
523 delegate->ShowApplicationMenu(p); 523 delegate->ShowApplicationMenu(p);
524 } 524 }
525 525
526 bool TabStrip::CanProcessInputEvents() const { 526 bool TabStrip::CanProcessInputEvents() const {
527 return IsAnimating() == NULL; 527 return IsAnimating() == NULL;
528 } 528 }
529 529
530 bool TabStrip::PointIsWithinWindowCaption(const CPoint& point) { 530 bool TabStrip::PointIsWithinWindowCaption(const gfx::Point& point) {
531 ChromeViews::View* v = GetViewForPoint(point); 531 ChromeViews::View* v = GetViewForPoint(point.ToPOINT());
532 532
533 // If there is no control at this location, claim the hit was in the title 533 // If there is no control at this location, claim the hit was in the title
534 // bar to get a move action. 534 // bar to get a move action.
535 if (v == this) 535 if (v == this)
536 return true; 536 return true;
537 537
538 // If the point is within the bounds of a Tab, the point can be considered 538 // If the point is within the bounds of a Tab, the point can be considered
539 // part of the caption if there are no available drag operations for the Tab. 539 // part of the caption if there are no available drag operations for the Tab.
540 if (v->GetClassName() == Tab::kTabClassName && !HasAvailableDragActions()) 540 if (v->GetClassName() == Tab::kTabClassName && !HasAvailableDragActions())
541 return true; 541 return true;
542 542
543 // Check to see if the point is within the non-button parts of the new tab 543 // Check to see if the point is within the non-button parts of the new tab
544 // button. The button has a non-rectangular shape, so if it's not in the 544 // button. The button has a non-rectangular shape, so if it's not in the
545 // visual portions of the button we treat it as a click to the caption. 545 // visual portions of the button we treat it as a click to the caption.
546 CPoint point_in_newtab_coords(point); 546 gfx::Point point_in_newtab_coords(point);
547 View::ConvertPointToView(this, newtab_button_, &point_in_newtab_coords); 547 View::ConvertPointToView(this, newtab_button_, &point_in_newtab_coords);
548 if (newtab_button_->bounds().Contains(gfx::Point(point)) && 548 if (newtab_button_->bounds().Contains(point) &&
549 !newtab_button_->HitTest(point_in_newtab_coords)) { 549 !newtab_button_->HitTest(point_in_newtab_coords.ToPOINT())) {
550 return true; 550 return true;
551 } 551 }
552 552
553 // All other regions, including the new Tab button, should be considered part 553 // All other regions, including the new Tab button, should be considered part
554 // of the containing Window's client area so that regular events can be 554 // of the containing Window's client area so that regular events can be
555 // processed for them. 555 // processed for them.
556 return false; 556 return false;
557 } 557 }
558 558
559 bool TabStrip::IsCompatibleWith(TabStrip* other) { 559 bool TabStrip::IsCompatibleWith(TabStrip* other) {
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 1234
1235 // We only want to run the animation if we're not already at the desired 1235 // We only want to run the animation if we're not already at the desired
1236 // size. 1236 // size.
1237 if (abs(first_tab->width() - w) > 1) 1237 if (abs(first_tab->width() - w) > 1)
1238 StartResizeLayoutAnimation(); 1238 StartResizeLayoutAnimation();
1239 } 1239 }
1240 1240
1241 bool TabStrip::IsCursorInTabStripZone() { 1241 bool TabStrip::IsCursorInTabStripZone() {
1242 CRect bounds; 1242 CRect bounds;
1243 GetLocalBounds(&bounds, true); 1243 GetLocalBounds(&bounds, true);
1244 CPoint tabstrip_topleft = bounds.TopLeft(); 1244 gfx::Point tabstrip_topleft(bounds.TopLeft());
1245 View::ConvertPointToScreen(this, &tabstrip_topleft); 1245 View::ConvertPointToScreen(this, &tabstrip_topleft);
1246 bounds.MoveToXY(tabstrip_topleft); 1246 bounds.MoveToXY(tabstrip_topleft.ToPOINT());
1247 bounds.bottom += kTabStripAnimationVSlop; 1247 bounds.bottom += kTabStripAnimationVSlop;
1248 1248
1249 CPoint cursor_point; 1249 CPoint cursor_point;
1250 GetCursorPos(&cursor_point); 1250 GetCursorPos(&cursor_point);
1251 1251
1252 return !!bounds.PtInRect(cursor_point); 1252 return !!bounds.PtInRect(cursor_point);
1253 } 1253 }
1254 1254
1255 void TabStrip::AddMessageLoopObserver() { 1255 void TabStrip::AddMessageLoopObserver() {
1256 if (!added_as_message_loop_observer_) { 1256 if (!added_as_message_loop_observer_) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 center_x = tab->x() + (tab->width() / 2); 1302 center_x = tab->x() + (tab->width() / 2);
1303 } else { 1303 } else {
1304 Tab* last_tab = GetTabAt(drop_index - 1); 1304 Tab* last_tab = GetTabAt(drop_index - 1);
1305 center_x = last_tab->x() + last_tab->width() + (kTabHOffset / 2); 1305 center_x = last_tab->x() + last_tab->width() + (kTabHOffset / 2);
1306 } 1306 }
1307 1307
1308 // Mirror the center point if necessary. 1308 // Mirror the center point if necessary.
1309 center_x = MirroredXCoordinateInsideView(center_x); 1309 center_x = MirroredXCoordinateInsideView(center_x);
1310 1310
1311 // Determine the screen bounds. 1311 // Determine the screen bounds.
1312 CPoint drop_loc(center_x - drop_indicator_width / 2, -drop_indicator_height); 1312 gfx::Point drop_loc(center_x - drop_indicator_width / 2,
1313 -drop_indicator_height);
1313 ConvertPointToScreen(this, &drop_loc); 1314 ConvertPointToScreen(this, &drop_loc);
1314 gfx::Rect drop_bounds(drop_loc.x, drop_loc.y, drop_indicator_width, 1315 gfx::Rect drop_bounds(drop_loc.x(), drop_loc.y(), drop_indicator_width,
1315 drop_indicator_height); 1316 drop_indicator_height);
1316 1317
1317 // If the rect doesn't fit on the monitor, push the arrow to the bottom. 1318 // If the rect doesn't fit on the monitor, push the arrow to the bottom.
1318 gfx::Rect monitor_bounds = win_util::GetMonitorBoundsForRect(drop_bounds); 1319 gfx::Rect monitor_bounds = win_util::GetMonitorBoundsForRect(drop_bounds);
1319 *is_beneath = (monitor_bounds.IsEmpty() || 1320 *is_beneath = (monitor_bounds.IsEmpty() ||
1320 !monitor_bounds.Contains(drop_bounds)); 1321 !monitor_bounds.Contains(drop_bounds));
1321 if (*is_beneath) 1322 if (*is_beneath)
1322 drop_bounds.Offset(0, drop_bounds.height() + height()); 1323 drop_bounds.Offset(0, drop_bounds.height() + height());
1323 1324
1324 return drop_bounds; 1325 return drop_bounds;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 } 1560 }
1560 } 1561 }
1561 return -1; 1562 return -1;
1562 } 1563 }
1563 1564
1564 int TabStrip::GetAvailableWidthForTabs(Tab* last_tab) const { 1565 int TabStrip::GetAvailableWidthForTabs(Tab* last_tab) const {
1565 return last_tab->x() + last_tab->width(); 1566 return last_tab->x() + last_tab->width();
1566 } 1567 }
1567 1568
1568 bool TabStrip::IsPointInTab(Tab* tab, const CPoint& point_in_tabstrip_coords) { 1569 bool TabStrip::IsPointInTab(Tab* tab, const CPoint& point_in_tabstrip_coords) {
1569 CPoint point_in_tab_coords(point_in_tabstrip_coords); 1570 gfx::Point point_in_tab_coords(point_in_tabstrip_coords);
1570 View::ConvertPointToView(this, tab, &point_in_tab_coords); 1571 View::ConvertPointToView(this, tab, &point_in_tab_coords);
1571 return tab->HitTest(point_in_tab_coords); 1572 return tab->HitTest(point_in_tab_coords.ToPOINT());
1572 } 1573 }
1573 1574
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/tab_strip.h ('k') | chrome/browser/views/toolbar_star_toggle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698