| Index: chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
|
| diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
|
| index e08c0a22f459d63156276799c76041c272f181e5..93b3866313d11fb440ca497bab00e6f3111bda08 100644
|
| --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
|
| +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
|
| @@ -10,7 +10,9 @@
|
| #include "base/mac/foundation_util.h"
|
| #import "base/mac/scoped_nsobject.h"
|
| #include "base/mac/sdk_forward_declarations.h"
|
| +#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
|
| #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h"
|
| +#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view_cocoa.h"
|
| #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h"
|
| #import "chrome/browser/ui/cocoa/bookmarks/bookmark_folder_target.h"
|
| #import "chrome/browser/ui/cocoa/browser_window_controller.h"
|
| @@ -20,6 +22,7 @@
|
| #include "ui/base/clipboard/clipboard_util_mac.h"
|
| #include "ui/base/cocoa/cocoa_base_utils.h"
|
| #import "ui/base/cocoa/nsview_additions.h"
|
| +#include "ui/base/material_design/material_design_controller.h"
|
| #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
|
|
|
| using base::UserMetricsAction;
|
| @@ -357,6 +360,16 @@ BookmarkButton* gDraggedButton = nil; // Weak
|
| [delegate_ mouseExitedButton:self event:event];
|
| }
|
|
|
| +- (void)mouseDown:(NSEvent*)theEvent {
|
| + // Clicking on a bookmark button in Material Design should highlight it.
|
| + const int kCellTag = [[self cell] tag];
|
| + if (kCellTag == kMaterialStandardButtonTypeWithLimitedClickFeedback &&
|
| + [self isEnabled]) {
|
| + [self highlight:YES];
|
| + }
|
| + [super mouseDown:theEvent];
|
| +}
|
| +
|
| - (void)mouseMoved:(NSEvent*)theEvent {
|
| if ([delegate_ respondsToSelector:@selector(mouseMoved:)])
|
| [id(delegate_) mouseMoved:theEvent];
|
| @@ -425,12 +438,27 @@ BookmarkButton* gDraggedButton = nil; // Weak
|
| [super drawRect:rect];
|
| }
|
|
|
| +- (void)updateIconToMatchTheme {
|
| + if (!ui::MaterialDesignController::IsModeMaterial() || ![self isFolder]) {
|
| + return;
|
| + }
|
| +
|
| + BookmarkBarView* bookmarkBarView = (BookmarkBarView*)[self superview];
|
| + BookmarkBarController* bookmarkBarController = [bookmarkBarView controller];
|
| + BOOL darkTheme = [[self window] hasDarkTheme];
|
| + NSImage* theImage =
|
| + [bookmarkBarController faviconForNode:[self bookmarkNode]
|
| + forADarkTheme:darkTheme];
|
| + [[self cell] setImage:theImage];
|
| +}
|
| +
|
| - (void)viewDidMoveToWindow {
|
| [super viewDidMoveToWindow];
|
| if ([self window]) {
|
| // The new window may have different main window status.
|
| // This happens when the view is moved into a TabWindowOverlayWindow for
|
| // tab dragging.
|
| + [self updateIconToMatchTheme];
|
| [self windowDidChangeActive];
|
| }
|
| }
|
| @@ -438,6 +466,7 @@ BookmarkButton* gDraggedButton = nil; // Weak
|
| // ThemedWindowDrawing implementation.
|
|
|
| - (void)windowDidChangeTheme {
|
| + [self updateIconToMatchTheme];
|
| [self setNeedsDisplay:YES];
|
| }
|
|
|
|
|