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

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

Issue 2169623002: [Material][Mac] Fixed Bookmark Items Highlight Issues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No highlight if it's disabled Created 4 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm » ('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) 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #import "base/mac/bundle_locations.h" 9 #import "base/mac/bundle_locations.h"
10 #import "base/mac/foundation_util.h" 10 #import "base/mac/foundation_util.h"
(...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 1964
1965 // Return an autoreleased NSCell suitable for a special button displayed on the 1965 // Return an autoreleased NSCell suitable for a special button displayed on the
1966 // bookmark bar that is not attached to any bookmark node. 1966 // bookmark bar that is not attached to any bookmark node.
1967 // TODO(jrg): move much of the cell config into the BookmarkButtonCell class. 1967 // TODO(jrg): move much of the cell config into the BookmarkButtonCell class.
1968 - (BookmarkButtonCell*)cellForCustomButtonWithText:(NSString*)text 1968 - (BookmarkButtonCell*)cellForCustomButtonWithText:(NSString*)text
1969 image:(NSImage*)image { 1969 image:(NSImage*)image {
1970 BookmarkButtonCell* cell = 1970 BookmarkButtonCell* cell =
1971 [BookmarkButtonCell buttonCellWithText:text 1971 [BookmarkButtonCell buttonCellWithText:text
1972 image:image 1972 image:image
1973 menuController:contextMenuController_]; 1973 menuController:contextMenuController_];
1974 if (ui::MaterialDesignController::IsModeMaterial()) { 1974 if (ui::MaterialDesignController::IsModeMaterial())
1975 [cell setTag:kMaterialStandardButtonTypeWithLimitedClickFeedback]; 1975 [cell setTag:kMaterialStandardButtonTypeWithLimitedClickFeedback];
1976 [cell setHighlightsBy:NSNoCellMask]; 1976 else
1977 } else {
1978 [cell setTag:kStandardButtonTypeWithLimitedClickFeedback]; 1977 [cell setTag:kStandardButtonTypeWithLimitedClickFeedback];
1979 }
1980 1978
1981 // Note: a quirk of setting a cell's text color is that it won't work 1979 // Note: a quirk of setting a cell's text color is that it won't work
1982 // until the cell is associated with a button, so we can't theme the cell yet. 1980 // until the cell is associated with a button, so we can't theme the cell yet.
1983 1981
1984 return cell; 1982 return cell;
1985 } 1983 }
1986 1984
1987 // Returns a frame appropriate for the given bookmark cell, suitable 1985 // Returns a frame appropriate for the given bookmark cell, suitable
1988 // for creating an NSButton that will contain it. |xOffset| is the X 1986 // for creating an NSButton that will contain it. |xOffset| is the X
1989 // offset for the frame; it is increased to be an appropriate X offset 1987 // offset for the frame; it is increased to be an appropriate X offset
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 // http://crbug.com/35966 2628 // http://crbug.com/35966
2631 // If already opened, then we exited but re-entered the button, so do nothing. 2629 // If already opened, then we exited but re-entered the button, so do nothing.
2632 if ([folderController_ parentButton] == sender) 2630 if ([folderController_ parentButton] == sender)
2633 return; 2631 return;
2634 // Else open a new one if it makes sense to do so. 2632 // Else open a new one if it makes sense to do so.
2635 const BookmarkNode* node = [sender bookmarkNode]; 2633 const BookmarkNode* node = [sender bookmarkNode];
2636 if (node && node->is_folder()) { 2634 if (node && node->is_folder()) {
2637 // Update |hoverButton_| so that it corresponds to the open folder. 2635 // Update |hoverButton_| so that it corresponds to the open folder.
2638 hoverButton_.reset([sender retain]); 2636 hoverButton_.reset([sender retain]);
2639 [folderTarget_ openBookmarkFolderFromButton:sender]; 2637 [folderTarget_ openBookmarkFolderFromButton:sender];
2640
2641 const BookmarkButtonCell* cell = [sender cell];
2642 if ([cell tag] == kMaterialStandardButtonTypeWithLimitedClickFeedback)
2643 [cell setHighlighted:YES];
2644 } else { 2638 } else {
2645 // We're over a non-folder bookmark so close any old folders. 2639 // We're over a non-folder bookmark so close any old folders.
2646 [folderController_ close]; 2640 [folderController_ close];
2647 folderController_ = nil; 2641 folderController_ = nil;
2648 } 2642 }
2649 } 2643 }
2650 2644
2651 // BookmarkButtonDelegate protocol implementation. 2645 // BookmarkButtonDelegate protocol implementation.
2652 - (void)mouseExitedButton:(id)sender event:(NSEvent*)event { 2646 - (void)mouseExitedButton:(id)sender event:(NSEvent*)event {
2653 // Don't care; do nothing. 2647 // Don't care; do nothing.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 - (void)closeAllBookmarkFolders { 2679 - (void)closeAllBookmarkFolders {
2686 [self watchForExitEvent:NO]; 2680 [self watchForExitEvent:NO];
2687 2681
2688 // Grab the parent button under Material Design to make sure that the 2682 // Grab the parent button under Material Design to make sure that the
2689 // highlighting that was applied while revealing the menu is turned off. 2683 // highlighting that was applied while revealing the menu is turned off.
2690 BookmarkButton* parentButton = nil; 2684 BookmarkButton* parentButton = nil;
2691 if (ui::MaterialDesignController::IsModeMaterial()) { 2685 if (ui::MaterialDesignController::IsModeMaterial()) {
2692 parentButton = [folderController_ parentButton]; 2686 parentButton = [folderController_ parentButton];
2693 } 2687 }
2694 [folderController_ close]; 2688 [folderController_ close];
2695 [[parentButton cell] setHighlighted:NO];
2696 [parentButton setNeedsDisplay:YES]; 2689 [parentButton setNeedsDisplay:YES];
2697 folderController_ = nil; 2690 folderController_ = nil;
2698 } 2691 }
2699 2692
2700 - (void)closeBookmarkFolder:(id)sender { 2693 - (void)closeBookmarkFolder:(id)sender {
2701 // We're the top level, so close one means close them all. 2694 // We're the top level, so close one means close them all.
2702 [self closeAllBookmarkFolders]; 2695 [self closeAllBookmarkFolders];
2703 } 2696 }
2704 2697
2705 - (BookmarkModel*)bookmarkModel { 2698 - (BookmarkModel*)bookmarkModel {
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 - (id<BookmarkButtonControllerProtocol>)controllerForNode: 3088 - (id<BookmarkButtonControllerProtocol>)controllerForNode:
3096 (const BookmarkNode*)node { 3089 (const BookmarkNode*)node {
3097 // See if it's in the bar, then if it is in the hierarchy of visible 3090 // See if it's in the bar, then if it is in the hierarchy of visible
3098 // folder menus. 3091 // folder menus.
3099 if (bookmarkModel_->bookmark_bar_node() == node) 3092 if (bookmarkModel_->bookmark_bar_node() == node)
3100 return self; 3093 return self;
3101 return [folderController_ controllerForNode:node]; 3094 return [folderController_ controllerForNode:node];
3102 } 3095 }
3103 3096
3104 @end 3097 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698