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

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

Issue 251091: Mac: Eliminate unintended "menu" method overrides. (Closed)
Patch Set: Created 11 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
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 #include "app/l10n_util_mac.h" 5 #include "app/l10n_util_mac.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_editor.h" 8 #include "chrome/browser/bookmarks/bookmark_editor.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 // When resized we may need to add new buttons, or remove them (if 101 // When resized we may need to add new buttons, or remove them (if
102 // no longer visible), or add/remove the "off the side" menu. 102 // no longer visible), or add/remove the "off the side" menu.
103 [[self view] setPostsFrameChangedNotifications:YES]; 103 [[self view] setPostsFrameChangedNotifications:YES];
104 [[NSNotificationCenter defaultCenter] 104 [[NSNotificationCenter defaultCenter]
105 addObserver:self 105 addObserver:self
106 selector:@selector(frameDidChange) 106 selector:@selector(frameDidChange)
107 name:NSViewFrameDidChangeNotification 107 name:NSViewFrameDidChangeNotification
108 object:[self view]]; 108 object:[self view]];
109 109
110 DCHECK([offTheSideButton_ menu]); 110 DCHECK([offTheSideButton_ attachedMenu]);
111 } 111 }
112 112
113 - (void)showIfNeeded { 113 - (void)showIfNeeded {
114 if (profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar)) 114 if (profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar))
115 [self showBookmarkBar:YES immediately:YES]; 115 [self showBookmarkBar:YES immediately:YES];
116 } 116 }
117 117
118 // Check if we should enable the off-the-side button. 118 // Check if we should enable the off-the-side button.
119 // TODO(jrg): when we are smarter about creating buttons (e.g. don't 119 // TODO(jrg): when we are smarter about creating buttons (e.g. don't
120 // bother creating buttons which aren't visible), we'll have to be 120 // bother creating buttons which aren't visible), we'll have to be
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 for (NSButton* each_button in buttons_.get()) { 327 for (NSButton* each_button in buttons_.get()) {
328 if (NSMaxX([each_button frame]) > 328 if (NSMaxX([each_button frame]) >
329 NSMaxX([[each_button superview] frame])) { 329 NSMaxX([[each_button superview] frame])) {
330 [self addNode:[self nodeFromButton:each_button] toMenu:menu]; 330 [self addNode:[self nodeFromButton:each_button] toMenu:menu];
331 } 331 }
332 } 332 }
333 } 333 }
334 334
335 // Get the off-the-side menu. 335 // Get the off-the-side menu.
336 - (NSMenu*)offTheSideMenu { 336 - (NSMenu*)offTheSideMenu {
337 return [offTheSideButton_ menu]; 337 return [offTheSideButton_ attachedMenu];
338 } 338 }
339 339
340 // Called by any menus which have set us as their delegate (right now just the 340 // Called by any menus which have set us as their delegate (right now just the
341 // off-the-side menu?). 341 // off-the-side menu?).
342 - (void)menuNeedsUpdate:(NSMenu*)menu { 342 - (void)menuNeedsUpdate:(NSMenu*)menu {
343 if (menu == [self offTheSideMenu]) 343 if (menu == [self offTheSideMenu])
344 [self buildOffTheSideMenu]; 344 [self buildOffTheSideMenu];
345 } 345 }
346 346
347 // As a convention we set the menu's delegate to be the button's cell 347 // As a convention we set the menu's delegate to be the button's cell
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 686
687 - (void)setUrlDelegate:(id<BookmarkURLOpener>)urlDelegate { 687 - (void)setUrlDelegate:(id<BookmarkURLOpener>)urlDelegate {
688 urlDelegate_ = urlDelegate; 688 urlDelegate_ = urlDelegate;
689 } 689 }
690 690
691 - (NSArray*)buttons { 691 - (NSArray*)buttons {
692 return buttons_.get(); 692 return buttons_.get();
693 } 693 }
694 694
695 @end 695 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/back_forward_menu_controller.mm ('k') | chrome/browser/cocoa/delayedmenu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698