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

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 754473003: [Extensions Toolbar Mac] More cleanup of BrowserActionsController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/toolbar/toolbar_controller.h" 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 - (void)addAccessibilityDescriptions; 85 - (void)addAccessibilityDescriptions;
86 - (void)initCommandStatus:(CommandUpdater*)commands; 86 - (void)initCommandStatus:(CommandUpdater*)commands;
87 - (void)prefChanged:(const std::string&)prefName; 87 - (void)prefChanged:(const std::string&)prefName;
88 - (BackgroundGradientView*)backgroundGradientView; 88 - (BackgroundGradientView*)backgroundGradientView;
89 - (void)toolbarFrameChanged; 89 - (void)toolbarFrameChanged;
90 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate; 90 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate;
91 - (void)maintainMinimumLocationBarWidth; 91 - (void)maintainMinimumLocationBarWidth;
92 - (void)adjustBrowserActionsContainerForNewWindow:(NSNotification*)notification; 92 - (void)adjustBrowserActionsContainerForNewWindow:(NSNotification*)notification;
93 - (void)browserActionsContainerWillDrag:(NSNotification*)notification; 93 - (void)browserActionsContainerWillDrag:(NSNotification*)notification;
94 - (void)browserActionsContainerDragged:(NSNotification*)notification; 94 - (void)browserActionsContainerDragged:(NSNotification*)notification;
95 - (void)browserActionsContainerDragFinished:(NSNotification*)notification;
96 - (void)browserActionsVisibilityChanged:(NSNotification*)notification; 95 - (void)browserActionsVisibilityChanged:(NSNotification*)notification;
97 - (void)browserActionsContainerWillAnimate:(NSNotification*)notification; 96 - (void)browserActionsContainerWillAnimate:(NSNotification*)notification;
98 - (void)adjustLocationSizeBy:(CGFloat)dX animate:(BOOL)animate; 97 - (void)adjustLocationSizeBy:(CGFloat)dX animate:(BOOL)animate;
99 - (void)updateWrenchButtonSeverity:(WrenchIconPainter::Severity)severity 98 - (void)updateWrenchButtonSeverity:(WrenchIconPainter::Severity)severity
100 animate:(BOOL)animate; 99 animate:(BOOL)animate;
101 @end 100 @end
102 101
103 namespace ToolbarControllerInternal { 102 namespace ToolbarControllerInternal {
104 103
105 // A class registered for C++ notifications. This is used to detect changes in 104 // A class registered for C++ notifications. This is used to detect changes in
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 selector:@selector(browserActionsContainerWillDrag:) 595 selector:@selector(browserActionsContainerWillDrag:)
597 name:kBrowserActionGrippyWillDragNotification 596 name:kBrowserActionGrippyWillDragNotification
598 object:browserActionsContainerView_]; 597 object:browserActionsContainerView_];
599 [[NSNotificationCenter defaultCenter] 598 [[NSNotificationCenter defaultCenter]
600 addObserver:self 599 addObserver:self
601 selector:@selector(browserActionsContainerDragged:) 600 selector:@selector(browserActionsContainerDragged:)
602 name:kBrowserActionGrippyDraggingNotification 601 name:kBrowserActionGrippyDraggingNotification
603 object:browserActionsContainerView_]; 602 object:browserActionsContainerView_];
604 [[NSNotificationCenter defaultCenter] 603 [[NSNotificationCenter defaultCenter]
605 addObserver:self 604 addObserver:self
606 selector:@selector(browserActionsContainerDragFinished:)
607 name:kBrowserActionGrippyDragFinishedNotification
608 object:browserActionsController_];
609 [[NSNotificationCenter defaultCenter]
610 addObserver:self
611 selector:@selector(browserActionsVisibilityChanged:) 605 selector:@selector(browserActionsVisibilityChanged:)
612 name:kBrowserActionVisibilityChangedNotification 606 name:kBrowserActionVisibilityChangedNotification
613 object:browserActionsController_]; 607 object:browserActionsController_];
614 [[NSNotificationCenter defaultCenter] 608 [[NSNotificationCenter defaultCenter]
615 addObserver:self 609 addObserver:self
616 selector:@selector(browserActionsContainerWillAnimate:) 610 selector:@selector(browserActionsContainerWillAnimate:)
617 name:kBrowserActionsContainerWillAnimate 611 name:kBrowserActionsContainerWillAnimate
618 object:browserActionsContainerView_]; 612 object:browserActionsContainerView_];
619 [[NSNotificationCenter defaultCenter] 613 [[NSNotificationCenter defaultCenter]
620 addObserver:self 614 addObserver:self
(...skipping 18 matching lines...) Expand all
639 633
640 - (void)browserActionsContainerDragged:(NSNotification*)notification { 634 - (void)browserActionsContainerDragged:(NSNotification*)notification {
641 CGFloat locationBarWidth = NSWidth([locationBar_ frame]); 635 CGFloat locationBarWidth = NSWidth([locationBar_ frame]);
642 locationBarAtMinSize_ = locationBarWidth <= kMinimumLocationBarWidth; 636 locationBarAtMinSize_ = locationBarWidth <= kMinimumLocationBarWidth;
643 [browserActionsContainerView_ setCanDragLeft:!locationBarAtMinSize_]; 637 [browserActionsContainerView_ setCanDragLeft:!locationBarAtMinSize_];
644 [browserActionsContainerView_ setGrippyPinned:locationBarAtMinSize_]; 638 [browserActionsContainerView_ setGrippyPinned:locationBarAtMinSize_];
645 [self adjustLocationSizeBy: 639 [self adjustLocationSizeBy:
646 [browserActionsContainerView_ resizeDeltaX] animate:NO]; 640 [browserActionsContainerView_ resizeDeltaX] animate:NO];
647 } 641 }
648 642
649 - (void)browserActionsContainerDragFinished:(NSNotification*)notification {
650 [browserActionsController_ resizeContainerAndAnimate:YES];
651 }
652
653 - (void)browserActionsContainerWillDrag:(NSNotification*)notification { 643 - (void)browserActionsContainerWillDrag:(NSNotification*)notification {
654 CGFloat deltaX = [[notification.userInfo objectForKey:kTranslationWithDelta] 644 CGFloat deltaX = [[notification.userInfo objectForKey:kTranslationWithDelta]
655 floatValue]; 645 floatValue];
656 CGFloat locationBarWidth = NSWidth([locationBar_ frame]); 646 CGFloat locationBarWidth = NSWidth([locationBar_ frame]);
657 BOOL locationBarWillBeAtMinSize = 647 BOOL locationBarWillBeAtMinSize =
658 (locationBarWidth + deltaX) <= kMinimumLocationBarWidth; 648 (locationBarWidth + deltaX) <= kMinimumLocationBarWidth;
659 649
660 // Prevent the |browserActionsContainerView_| from dragging if the width of 650 // Prevent the |browserActionsContainerView_| from dragging if the width of
661 // location bar will reach the minimum. 651 // location bar will reach the minimum.
662 [browserActionsContainerView_ setCanDragLeft:!locationBarWillBeAtMinSize]; 652 [browserActionsContainerView_ setCanDragLeft:!locationBarWillBeAtMinSize];
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 - (void)hideDropURLsIndicatorInView:(NSView*)view { 847 - (void)hideDropURLsIndicatorInView:(NSView*)view {
858 // Do nothing. 848 // Do nothing.
859 } 849 }
860 850
861 // (URLDropTargetController protocol) 851 // (URLDropTargetController protocol)
862 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 852 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
863 return drag_util::IsUnsupportedDropData(profile_, info); 853 return drag_util::IsUnsupportedDropData(profile_, info);
864 } 854 }
865 855
866 @end 856 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698