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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm

Issue 881573004: [Extensions Toolbar Mac] Adjust button threshold for hiding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | no next file » | 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/extensions/browser_actions_controller.h" 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } 624 }
625 625
626 - (void)containerDragFinished:(NSNotification*)notification { 626 - (void)containerDragFinished:(NSNotification*)notification {
627 for (BrowserActionButton* button in buttons_.get()) { 627 for (BrowserActionButton* button in buttons_.get()) {
628 NSRect buttonFrame = [button frame]; 628 NSRect buttonFrame = [button frame];
629 if (NSContainsRect([containerView_ bounds], buttonFrame)) 629 if (NSContainsRect([containerView_ bounds], buttonFrame))
630 continue; 630 continue;
631 631
632 CGFloat intersectionWidth = 632 CGFloat intersectionWidth =
633 NSWidth(NSIntersectionRect([containerView_ bounds], buttonFrame)); 633 NSWidth(NSIntersectionRect([containerView_ bounds], buttonFrame));
634 // Pad the threshold by 5 pixels in order to have the buttons hide more 634 // Hide the button if it's not "mostly" visible. "Mostly" here equates to
635 // easily. 635 // having three or fewer pixels hidden.
636 if (([containerView_ grippyPinned] && intersectionWidth > 0) || 636 if (([containerView_ grippyPinned] && intersectionWidth > 0) ||
637 (intersectionWidth <= (NSWidth(buttonFrame) / 2) + 5.0)) { 637 (intersectionWidth <= NSWidth(buttonFrame) - 3.0)) {
638 [button setAlphaValue:0.0]; 638 [button setAlphaValue:0.0];
639 [button removeFromSuperview]; 639 [button removeFromSuperview];
640 } 640 }
641 } 641 }
642 642
643 toolbarActionsBar_->OnResizeComplete( 643 toolbarActionsBar_->OnResizeComplete(
644 toolbarActionsBar_->IconCountToWidth([self visibleButtonCount])); 644 toolbarActionsBar_->IconCountToWidth([self visibleButtonCount]));
645 645
646 [self updateGrippyCursors]; 646 [self updateGrippyCursors];
647 [self resizeContainerToWidth:toolbarActionsBar_->GetPreferredSize().width()]; 647 [self resizeContainerToWidth:toolbarActionsBar_->GetPreferredSize().width()];
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 - (ToolbarActionsBar*)toolbarActionsBar { 838 - (ToolbarActionsBar*)toolbarActionsBar {
839 return toolbarActionsBar_.get(); 839 return toolbarActionsBar_.get();
840 } 840 }
841 841
842 + (BrowserActionsController*)fromToolbarActionsBarDelegate: 842 + (BrowserActionsController*)fromToolbarActionsBarDelegate:
843 (ToolbarActionsBarDelegate*)delegate { 843 (ToolbarActionsBarDelegate*)delegate {
844 return static_cast<ToolbarActionsBarBridge*>(delegate)->controller_for_test(); 844 return static_cast<ToolbarActionsBarBridge*>(delegate)->controller_for_test();
845 } 845 }
846 846
847 @end 847 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698