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

Side by Side Diff: chrome/browser/cocoa/tab_strip_controller.mm

Issue 466051: Mac: Make a stop-gap visual indicator for dropping URLs on the tab strip. (Closed)
Patch Set: We don't have 10 pixels, so 5 for the DCHECK(). It won't look like at cat though. Created 11 years 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
« no previous file with comments | « no previous file | chrome/browser/cocoa/tab_strip_view.h » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import "chrome/browser/cocoa/tab_strip_controller.h" 5 #import "chrome/browser/cocoa/tab_strip_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 tabModel_->SelectTabContentsAt(index, true); 1501 tabModel_->SelectTabContentsAt(index, true);
1502 break; 1502 break;
1503 default: 1503 default:
1504 NOTIMPLEMENTED(); 1504 NOTIMPLEMENTED();
1505 } 1505 }
1506 } 1506 }
1507 1507
1508 // Update (possibly showing) the indicator which indicates where an URL drop 1508 // Update (possibly showing) the indicator which indicates where an URL drop
1509 // would happen. 1509 // would happen.
1510 - (void)indicateDropURLsAt:(NSPoint)location { 1510 - (void)indicateDropURLsAt:(NSPoint)location {
1511 // TODO(viettrungluu): Make the tabs move around, show an indicator, etc. This 1511 // The minimum y-coordinate at which one should consider place the arrow.
1512 // requires a re-work of the tabs code.... 1512 const CGFloat arrowBaseY = 25;
1513 #if 0 1513
1514 NSInteger index; 1514 NSInteger index;
1515 WindowOpenDisposition disposition; 1515 WindowOpenDisposition disposition;
1516 [self droppingURLsAt:location 1516 [self droppingURLsAt:location
1517 givesIndex:&index 1517 givesIndex:&index
1518 disposition:&disposition]; 1518 disposition:&disposition];
1519 1519
1520 NSPoint arrowPos = NSMakePoint(0, arrowBaseY);
1520 if (index == -1) { 1521 if (index == -1) {
1521 // Append a tab at the end. 1522 // Append a tab at the end.
1522 DCHECK(disposition == NEW_FOREGROUND_TAB); 1523 DCHECK(disposition == NEW_FOREGROUND_TAB);
1523 // TODO(viettrungluu): ... 1524 NSInteger lastIndex = [tabArray_ count] - 1;
1525 NSRect overRect = [[[tabArray_ objectAtIndex:lastIndex] view] frame];
1526 arrowPos.x = overRect.origin.x + overRect.size.width - kTabOverlap / 2.0;
1524 } else { 1527 } else {
1525 NSRect overRect = [[[tabArray_ objectAtIndex:index] view] frame]; 1528 NSRect overRect = [[[tabArray_ objectAtIndex:index] view] frame];
1526 switch (disposition) { 1529 switch (disposition) {
1527 case NEW_FOREGROUND_TAB: 1530 case NEW_FOREGROUND_TAB:
1528 // Insert tab (to the left of the given tab). 1531 // Insert tab (to the left of the given tab).
1529 // TODO(viettrungluu): ... 1532 arrowPos.x = overRect.origin.x + kTabOverlap / 2.0;
1530 break; 1533 break;
1531 case CURRENT_TAB: 1534 case CURRENT_TAB:
1532 // Overwrite the given tab. 1535 // Overwrite the given tab.
1533 // TODO(viettrungluu): ... 1536 arrowPos.x = overRect.origin.x + overRect.size.width / 2.0;
1534 break; 1537 break;
1535 default: 1538 default:
1536 NOTREACHED(); 1539 NOTREACHED();
1537 } 1540 }
1538 } 1541 }
1539 1542
1540 // TODO(viettrungluu): ... 1543 [tabView_ setDropArrowPosition:arrowPos];
1541 #endif 1544 [tabView_ setDropArrowShown:YES];
1545 [tabView_ setNeedsDisplay:YES];
1542 } 1546 }
1543 1547
1544 // Hide the indicator which indicates where an URL drop would happen. 1548 // Hide the indicator which indicates where an URL drop would happen.
1545 - (void)hideDropURLsIndicator { 1549 - (void)hideDropURLsIndicator {
1546 // TODO(viettrungluu): See TODO in |-indicateDropURLsAt:| above. 1550 if ([tabView_ dropArrowShown]) {
1551 [tabView_ setDropArrowShown:NO];
1552 [tabView_ setNeedsDisplay:YES];
1553 }
1547 } 1554 }
1548 1555
1549 - (GTMWindowSheetController*)sheetController { 1556 - (GTMWindowSheetController*)sheetController {
1550 if (!sheetController_.get()) 1557 if (!sheetController_.get())
1551 sheetController_.reset([[GTMWindowSheetController alloc] 1558 sheetController_.reset([[GTMWindowSheetController alloc]
1552 initWithWindow:[switchView_ window] delegate:self]); 1559 initWithWindow:[switchView_ window] delegate:self]);
1553 return sheetController_.get(); 1560 return sheetController_.get();
1554 } 1561 }
1555 1562
1556 - (void)gtm_systemRequestsVisibilityForView:(NSView*)view { 1563 - (void)gtm_systemRequestsVisibilityForView:(NSView*)view {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 // Show next sheet 1648 // Show next sheet
1642 NSWindowController* controller = [[tab window] windowController]; 1649 NSWindowController* controller = [[tab window] windowController];
1643 DCHECK([controller isKindOfClass:[BrowserWindowController class]]); 1650 DCHECK([controller isKindOfClass:[BrowserWindowController class]]);
1644 windows.front()->Realize( 1651 windows.front()->Realize(
1645 static_cast<BrowserWindowController*>(controller)); 1652 static_cast<BrowserWindowController*>(controller));
1646 } 1653 }
1647 } 1654 }
1648 } 1655 }
1649 1656
1650 @end 1657 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/tab_strip_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698