Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_folder_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 // [NSObject cancelPreviousPerformRequestsWithTarget:self]; | 325 // [NSObject cancelPreviousPerformRequestsWithTarget:self]; |
| 326 // Because all of our performSelector: calls use withDelay: which | 326 // Because all of our performSelector: calls use withDelay: which |
| 327 // retains us. | 327 // retains us. |
| 328 [super dealloc]; | 328 [super dealloc]; |
| 329 } | 329 } |
| 330 | 330 |
| 331 - (void)awakeFromNib { | 331 - (void)awakeFromNib { |
| 332 NSRect windowFrame = [[self window] frame]; | 332 NSRect windowFrame = [[self window] frame]; |
| 333 NSRect scrollViewFrame = [scrollView_ frame]; | 333 NSRect scrollViewFrame = [scrollView_ frame]; |
| 334 padding_ = NSWidth(windowFrame) - NSWidth(scrollViewFrame); | 334 padding_ = NSWidth(windowFrame) - NSWidth(scrollViewFrame); |
| 335 // In Material Design, each menu row spans the entire width of the menu. | |
| 336 if (ui::MaterialDesignController::IsModeMaterial()) { | |
| 337 scrollViewFrame.size.width += 2 * padding_; | |
| 338 scrollViewFrame.origin.x = 0; | |
| 339 [scrollView_ setFrame:scrollViewFrame]; | |
|
tapted
2016/08/04 02:00:55
I think has the unwanted side-effect of causing th
shrike
2016/08/04 20:54:47
Thanks for catching that. This new patchset should
| |
| 340 padding_ = 0; | |
| 341 } | |
| 335 verticalScrollArrowHeight_ = NSHeight([scrollUpArrowView_ frame]); | 342 verticalScrollArrowHeight_ = NSHeight([scrollUpArrowView_ frame]); |
| 336 | 343 |
| 337 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 344 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 338 NSImage* image = rb.GetNativeImageNamed(IDR_MENU_OVERFLOW_DOWN).ToNSImage(); | 345 NSImage* image = rb.GetNativeImageNamed(IDR_MENU_OVERFLOW_DOWN).ToNSImage(); |
| 339 [[scrollUpArrowView_.subviews objectAtIndex:0] setImage:image]; | 346 [[scrollUpArrowView_.subviews objectAtIndex:0] setImage:image]; |
| 340 | 347 |
| 341 image = rb.GetNativeImageNamed(IDR_MENU_OVERFLOW_UP).ToNSImage(); | 348 image = rb.GetNativeImageNamed(IDR_MENU_OVERFLOW_UP).ToNSImage(); |
| 342 [[scrollDownArrowView_.subviews objectAtIndex:0] setImage:image]; | 349 [[scrollDownArrowView_.subviews objectAtIndex:0] setImage:image]; |
| 343 } | 350 } |
| 344 | 351 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 forADarkTheme:NO] | 390 forADarkTheme:NO] |
| 384 : nil; | 391 : nil; |
| 385 BookmarkContextMenuCocoaController* menuController = | 392 BookmarkContextMenuCocoaController* menuController = |
| 386 [barController_ menuController]; | 393 [barController_ menuController]; |
| 387 BookmarkBarFolderButtonCell* cell = | 394 BookmarkBarFolderButtonCell* cell = |
| 388 [BookmarkBarFolderButtonCell buttonCellForNode:child | 395 [BookmarkBarFolderButtonCell buttonCellForNode:child |
| 389 text:nil | 396 text:nil |
| 390 image:image | 397 image:image |
| 391 menuController:menuController]; | 398 menuController:menuController]; |
| 392 if (ui::MaterialDesignController::IsModeMaterial()) { | 399 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 393 [cell setTag:kMaterialStandardButtonTypeWithLimitedClickFeedback]; | 400 [cell setTag:kMaterialMenuButtonTypeWithLimitedClickFeedback]; |
| 394 } else { | 401 } else { |
| 395 [cell setTag:kStandardButtonTypeWithLimitedClickFeedback]; | 402 [cell setTag:kStandardButtonTypeWithLimitedClickFeedback]; |
| 396 } | 403 } |
| 397 return cell; | 404 return cell; |
| 398 } | 405 } |
| 399 | 406 |
| 400 // Redirect to our logic shared with BookmarkBarController. | 407 // Redirect to our logic shared with BookmarkBarController. |
| 401 - (IBAction)openBookmarkFolderFromButton:(id)sender { | 408 - (IBAction)openBookmarkFolderFromButton:(id)sender { |
| 402 [folderTarget_ openBookmarkFolderFromButton:sender]; | 409 [folderTarget_ openBookmarkFolderFromButton:sender]; |
| 403 } | 410 } |
| (...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2089 | 2096 |
| 2090 - (void)setIgnoreAnimations:(BOOL)ignore { | 2097 - (void)setIgnoreAnimations:(BOOL)ignore { |
| 2091 ignoreAnimations_ = ignore; | 2098 ignoreAnimations_ = ignore; |
| 2092 } | 2099 } |
| 2093 | 2100 |
| 2094 - (BookmarkButton*)buttonThatMouseIsIn { | 2101 - (BookmarkButton*)buttonThatMouseIsIn { |
| 2095 return buttonThatMouseIsIn_; | 2102 return buttonThatMouseIsIn_; |
| 2096 } | 2103 } |
| 2097 | 2104 |
| 2098 @end // BookmarkBarFolderController | 2105 @end // BookmarkBarFolderController |
| OLD | NEW |