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

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

Issue 1752020: Remove accidental #if's. Make old folder window menu go away when mousing ove... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 7 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/cocoa/bookmark_bar_controller.mm ('k') | 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 #import "chrome/browser/cocoa/bookmark_bar_folder_controller.h" 5 #import "chrome/browser/cocoa/bookmark_bar_folder_controller.h"
6 #include "base/mac_util.h" 6 #include "base/mac_util.h"
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/bookmarks/bookmark_model.h" 8 #include "chrome/browser/bookmarks/bookmark_model.h"
9 #include "chrome/browser/bookmarks/bookmark_utils.h" 9 #include "chrome/browser/bookmarks/bookmark_utils.h"
10 #import "chrome/browser/browser_theme_provider.h" 10 #import "chrome/browser/browser_theme_provider.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 @implementation BookmarkBarFolderController 67 @implementation BookmarkBarFolderController
68 68
69 - (id)initWithParentButton:(BookmarkButton*)button 69 - (id)initWithParentButton:(BookmarkButton*)button
70 parentController:(BookmarkBarFolderController*)parentController 70 parentController:(BookmarkBarFolderController*)parentController
71 barController:(BookmarkBarController*)barController { 71 barController:(BookmarkBarController*)barController {
72 NSString* nibPath = 72 NSString* nibPath =
73 [mac_util::MainAppBundle() pathForResource:@"BookmarkBarFolderWindow" 73 [mac_util::MainAppBundle() pathForResource:@"BookmarkBarFolderWindow"
74 ofType:@"nib"]; 74 ofType:@"nib"];
75 if ((self = [super initWithWindowNibPath:nibPath owner:self])) { 75 if ((self = [super initWithWindowNibPath:nibPath owner:self])) {
76 parentButton_.reset([button retain]); 76 parentButton_.reset([button retain]);
77 #if 1
78 // We want the button to remain bordered as part of the menu path.
79 [[button cell] setShowsBorderOnlyWhileMouseInside:NO];
80 #endif
81 parentController_.reset([parentController retain]); 77 parentController_.reset([parentController retain]);
82 barController_ = barController; // WEAK 78 barController_ = barController; // WEAK
83 buttons_.reset([[NSMutableArray alloc] init]); 79 buttons_.reset([[NSMutableArray alloc] init]);
84 folderTarget_.reset([[BookmarkFolderTarget alloc] initWithController:self]); 80 folderTarget_.reset([[BookmarkFolderTarget alloc] initWithController:self]);
85 [self configureWindow]; 81 [self configureWindow];
86 hoverState_.reset([[BookmarkBarFolderHoverState alloc] init]); 82 hoverState_.reset([[BookmarkBarFolderHoverState alloc] init]);
87 if (scrollable_) 83 if (scrollable_)
88 [self addOrUpdateScrollTracking]; 84 [self addOrUpdateScrollTracking];
89 } 85 }
90 return self; 86 return self;
91 } 87 }
92 88
93 - (void)dealloc { 89 - (void)dealloc {
94 #if 1
95 // The button is no longer part of the menu path.
96 [[parentButton_ cell] setShowsBorderOnlyWhileMouseInside:YES];
97 [parentButton_ setNeedsDisplay];
98 #endif
99 [self removeScrollTracking]; 90 [self removeScrollTracking];
100 [self endScroll]; 91 [self endScroll];
101 [hoverState_ draggingExited]; 92 [hoverState_ draggingExited];
102 // Note: we don't need to 93 // Note: we don't need to
103 // [NSObject cancelPreviousPerformRequestsWithTarget:self]; 94 // [NSObject cancelPreviousPerformRequestsWithTarget:self];
104 // Because all of our performSelector: calls use withDelay: which 95 // Because all of our performSelector: calls use withDelay: which
105 // retains us. 96 // retains us.
106 [super dealloc]; 97 [super dealloc];
107 } 98 }
108 99
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 // First scroll the "document" area. 534 // First scroll the "document" area.
544 NSPoint scrollPosition = [scrollView_ documentVisibleRect].origin; 535 NSPoint scrollPosition = [scrollView_ documentVisibleRect].origin;
545 scrollPosition.y -= delta; 536 scrollPosition.y -= delta;
546 [[scrollView_ documentView] scrollPoint:scrollPosition]; 537 [[scrollView_ documentView] scrollPoint:scrollPosition];
547 538
548 // On 10.6 event dispatch for an NSButtonCell's 539 // On 10.6 event dispatch for an NSButtonCell's
549 // showsBorderOnlyWhileMouseInside seems broken if scrolling the 540 // showsBorderOnlyWhileMouseInside seems broken if scrolling the
550 // view that contains the button. It appears that a mouseExited: 541 // view that contains the button. It appears that a mouseExited:
551 // gets lost, so the button stays highlit forever. We accomodate 542 // gets lost, so the button stays highlit forever. We accomodate
552 // here. 543 // here.
553 #if 0
554 if (buttonThatMouseIsIn_) { 544 if (buttonThatMouseIsIn_) {
555 [[buttonThatMouseIsIn_ cell] setShowsBorderOnlyWhileMouseInside:NO]; 545 [[buttonThatMouseIsIn_ cell] setShowsBorderOnlyWhileMouseInside:NO];
556 [[buttonThatMouseIsIn_ cell] setShowsBorderOnlyWhileMouseInside:YES]; 546 [[buttonThatMouseIsIn_ cell] setShowsBorderOnlyWhileMouseInside:YES];
557 } 547 }
558 #endif
559 548
560 // We update the window size after shifting the scroll to avoid a race. 549 // We update the window size after shifting the scroll to avoid a race.
561 CGFloat screenHeightMinusMargin = (NSHeight(screenFrame) - 550 CGFloat screenHeightMinusMargin = (NSHeight(screenFrame) -
562 (2 * kScrollWindowVerticalMargin)); 551 (2 * kScrollWindowVerticalMargin));
563 if (delta) { 552 if (delta) {
564 // If we can, grow the window (up). 553 // If we can, grow the window (up).
565 if (NSHeight(windowFrame) < screenHeightMinusMargin) { 554 if (NSHeight(windowFrame) < screenHeightMinusMargin) {
566 CGFloat growAmount = delta; 555 CGFloat growAmount = delta;
567 // Don't scroll more than enough to "finish". 556 // Don't scroll more than enough to "finish".
568 if (scrollPosition.y < 0) 557 if (scrollPosition.y < 0)
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 - (IBAction)openBookmarkInNewForegroundTab:(id)sender { 1085 - (IBAction)openBookmarkInNewForegroundTab:(id)sender {
1097 [barController_ openBookmarkInNewForegroundTab:sender]; 1086 [barController_ openBookmarkInNewForegroundTab:sender];
1098 } 1087 }
1099 1088
1100 - (IBAction)openBookmarkInNewWindow:(id)sender { 1089 - (IBAction)openBookmarkInNewWindow:(id)sender {
1101 [barController_ openBookmarkInNewWindow:sender]; 1090 [barController_ openBookmarkInNewWindow:sender];
1102 } 1091 }
1103 1092
1104 1093
1105 @end // BookmarkBarFolderController 1094 @end // BookmarkBarFolderController
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698