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

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

Issue 583223002: Open just folder menu on middle clicking chevron button. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/cocoa/bookmarks/bookmark_bar_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 // Common function to open a bookmark folder of any type. 709 // Common function to open a bookmark folder of any type.
710 - (void)openBookmarkFolder:(id)sender { 710 - (void)openBookmarkFolder:(id)sender {
711 DCHECK([sender isKindOfClass:[BookmarkButton class]]); 711 DCHECK([sender isKindOfClass:[BookmarkButton class]]);
712 DCHECK([[sender cell] isKindOfClass:[BookmarkButtonCell class]]); 712 DCHECK([[sender cell] isKindOfClass:[BookmarkButtonCell class]]);
713 713
714 // Only record the action if it's the initial folder being opened. 714 // Only record the action if it's the initial folder being opened.
715 if (!showFolderMenus_) 715 if (!showFolderMenus_)
716 RecordBookmarkFolderOpen([self bookmarkLaunchLocation]); 716 RecordBookmarkFolderOpen([self bookmarkLaunchLocation]);
717 showFolderMenus_ = !showFolderMenus_; 717 showFolderMenus_ = !showFolderMenus_;
718 718
719 if (sender == offTheSideButton_) 719 // Middle click on chevron should not open bookmarks under it, instead just
720 // open its folder menu.
721 if (sender == offTheSideButton_) {
720 [[sender cell] setStartingChildIndex:displayedButtonCount_]; 722 [[sender cell] setStartingChildIndex:displayedButtonCount_];
721 723 NSEvent* event = [NSApp currentEvent];
724 if ([event type] == NSOtherMouseUp) {
725 [self openFolderForOffTheSideButton:sender];
726 return;
727 }
728 }
722 // Toggle presentation of bar folder menus. 729 // Toggle presentation of bar folder menus.
723 [folderTarget_ openBookmarkFolderFromButton:sender]; 730 [folderTarget_ openBookmarkFolderFromButton:sender];
724 } 731 }
725 732
733 // Function to open bookmark folder of offTheSideButton.
Alexei Svitkine (slow) 2014/09/19 15:49:59 Nit: This comment doesn't add anything that the na
Gaja 2014/09/20 05:35:44 Acknowledged.
Gaja 2014/09/22 03:34:40 Done.
734 - (void)openFolderForOffTheSideButton:(id)sender {
Alexei Svitkine (slow) 2014/09/19 15:49:59 Nit: Since this can close it too, how about "openO
Gaja 2014/09/20 05:35:44 Acknowledged.
Gaja 2014/09/22 03:34:40 Done.
735 // If clicked on already opened folder, then close it and return.
736 if ([folderController_ parentButton] == sender)
Alexei Svitkine (slow) 2014/09/19 15:49:59 From the code, looks like |sender| will always be
Gaja 2014/09/20 05:35:44 Acknowledged.
Gaja 2014/09/22 03:34:40 Done.
737 [self closeBookmarkFolder:self];
738 else
739 [self addNewFolderControllerWithParentButton:sender];
740 }
741
726 // Click on a bookmark folder button. 742 // Click on a bookmark folder button.
727 - (IBAction)openBookmarkFolderFromButton:(id)sender { 743 - (IBAction)openBookmarkFolderFromButton:(id)sender {
728 [self openBookmarkFolder:sender]; 744 [self openBookmarkFolder:sender];
729 } 745 }
730 746
731 // Click on the "off the side" button (chevron), which opens like a folder 747 // Click on the "off the side" button (chevron), which opens like a folder
732 // button but isn't exactly a parent folder. 748 // button but isn't exactly a parent folder.
733 - (IBAction)openOffTheSideFolderFromButton:(id)sender { 749 - (IBAction)openOffTheSideFolderFromButton:(id)sender {
734 [self openBookmarkFolder:sender]; 750 [self openBookmarkFolder:sender];
735 } 751 }
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after
2798 - (id<BookmarkButtonControllerProtocol>)controllerForNode: 2814 - (id<BookmarkButtonControllerProtocol>)controllerForNode:
2799 (const BookmarkNode*)node { 2815 (const BookmarkNode*)node {
2800 // See if it's in the bar, then if it is in the hierarchy of visible 2816 // See if it's in the bar, then if it is in the hierarchy of visible
2801 // folder menus. 2817 // folder menus.
2802 if (bookmarkModel_->bookmark_bar_node() == node) 2818 if (bookmarkModel_->bookmark_bar_node() == node)
2803 return self; 2819 return self;
2804 return [folderController_ controllerForNode:node]; 2820 return [folderController_ controllerForNode:node];
2805 } 2821 }
2806 2822
2807 @end 2823 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698