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 1305143008: [Mac] Implement LocationBarViewMac::UpdateLocationBarVisibility() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restoring popup windows to their original look Created 5 years, 1 month 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/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 #include "ui/base/l10n/l10n_util_mac.h" 63 #include "ui/base/l10n/l10n_util_mac.h"
64 #include "ui/gfx/geometry/rect.h" 64 #include "ui/gfx/geometry/rect.h"
65 #include "ui/gfx/image/image.h" 65 #include "ui/gfx/image/image.h"
66 66
67 using content::OpenURLParams; 67 using content::OpenURLParams;
68 using content::Referrer; 68 using content::Referrer;
69 using content::WebContents; 69 using content::WebContents;
70 70
71 namespace { 71 namespace {
72 72
73 // Duration of the toolbar animation.
74 const NSTimeInterval kToolBarAnimationDuration = 0.12;
75
73 // Height of the toolbar in pixels when the bookmark bar is closed. 76 // Height of the toolbar in pixels when the bookmark bar is closed.
74 const CGFloat kBaseToolbarHeightNormal = 35.0; 77 const CGFloat kBaseToolbarHeightNormal = 35.0;
75 78
79 // Height of the location bar. Used for animating the toolbar in and out when
80 // the location bar is displayed stand-alone for bookmark apps.
81 const CGFloat kLocationBarHeight = 29.0;
82
76 // The padding above the toolbar elements. This is calculated from the values 83 // The padding above the toolbar elements. This is calculated from the values
77 // in Toolbar.xib: the height of the toolbar (35) minus the height of the child 84 // in Toolbar.xib: the height of the toolbar (35) minus the height of the child
78 // elements (29) minus the y-origin of the elements (4). 85 // elements (29) minus the y-origin of the elements (4).
79 const CGFloat kToolbarElementTopPadding = 2.0; 86 const CGFloat kToolbarElementTopPadding = 2.0;
80 87
81 // The minimum width of the location bar in pixels. 88 // The minimum width of the location bar in pixels.
82 const CGFloat kMinimumLocationBarWidth = 100.0; 89 const CGFloat kMinimumLocationBarWidth = 100.0;
83 90
84 // The amount of left padding that the wrench menu should have. 91 // The amount of left padding that the wrench menu should have.
85 const CGFloat kWrenchMenuLeftPadding = 3.0; 92 const CGFloat kWrenchMenuLeftPadding = 3.0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 128 }
122 129
123 } // namespace 130 } // namespace
124 131
125 @interface ToolbarController() 132 @interface ToolbarController()
126 @property(assign, nonatomic) Browser* browser; 133 @property(assign, nonatomic) Browser* browser;
127 - (void)cleanUp; 134 - (void)cleanUp;
128 - (void)addAccessibilityDescriptions; 135 - (void)addAccessibilityDescriptions;
129 - (void)initCommandStatus:(CommandUpdater*)commands; 136 - (void)initCommandStatus:(CommandUpdater*)commands;
130 - (void)prefChanged:(const std::string&)prefName; 137 - (void)prefChanged:(const std::string&)prefName;
131 - (BackgroundGradientView*)backgroundGradientView; 138 - (ToolbarView*)toolbarView;
132 - (void)toolbarFrameChanged; 139 - (void)toolbarFrameChanged;
140 - (void)showLocationBarOnly;
133 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate; 141 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate;
134 - (void)maintainMinimumLocationBarWidth; 142 - (void)maintainMinimumLocationBarWidth;
135 - (void)adjustBrowserActionsContainerForNewWindow:(NSNotification*)notification; 143 - (void)adjustBrowserActionsContainerForNewWindow:(NSNotification*)notification;
136 - (void)browserActionsContainerDragged:(NSNotification*)notification; 144 - (void)browserActionsContainerDragged:(NSNotification*)notification;
137 - (void)browserActionsVisibilityChanged:(NSNotification*)notification; 145 - (void)browserActionsVisibilityChanged:(NSNotification*)notification;
138 - (void)browserActionsContainerWillAnimate:(NSNotification*)notification; 146 - (void)browserActionsContainerWillAnimate:(NSNotification*)notification;
139 - (void)adjustLocationSizeBy:(CGFloat)dX animate:(BOOL)animate; 147 - (void)adjustLocationSizeBy:(CGFloat)dX animate:(BOOL)animate;
140 - (void)updateWrenchButtonSeverity:(WrenchIconPainter::Severity)severity 148 - (void)updateWrenchButtonSeverity:(WrenchIconPainter::Severity)severity
141 animate:(BOOL)animate; 149 animate:(BOOL)animate;
150
tapted 2015/10/26 04:40:55 nit: remove blank line
dominickn 2015/10/26 06:42:43 Done.
142 @end 151 @end
143 152
144 namespace ToolbarControllerInternal { 153 namespace ToolbarControllerInternal {
145 154
146 // A C++ bridge class that handles listening for updates to commands and 155 // A C++ bridge class that handles listening for updates to commands and
147 // passing them back to ToolbarController. ToolbarController will create one of 156 // passing them back to ToolbarController. ToolbarController will create one of
148 // these bridges, pass them to CommandUpdater::AddCommandObserver, and then wait 157 // these bridges, pass them to CommandUpdater::AddCommandObserver, and then wait
149 // for update notifications, delivered via 158 // for update notifications, delivered via
150 // -enabledStateChangedForCommand:enabled:. 159 // -enabledStateChangedForCommand:enabled:.
151 class CommandObserverBridge : public CommandObserver { 160 class CommandObserverBridge : public CommandObserver {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 211
203 } // namespace ToolbarControllerInternal 212 } // namespace ToolbarControllerInternal
204 213
205 @implementation ToolbarController 214 @implementation ToolbarController
206 215
207 @synthesize browser = browser_; 216 @synthesize browser = browser_;
208 217
209 - (id)initWithCommands:(CommandUpdater*)commands 218 - (id)initWithCommands:(CommandUpdater*)commands
210 profile:(Profile*)profile 219 profile:(Profile*)profile
211 browser:(Browser*)browser 220 browser:(Browser*)browser
212 nibFileNamed:(NSString*)nibName { 221 resizeDelegate:(id<ViewResizer>)resizeDelegate {
213 DCHECK(commands && profile && [nibName length]); 222 DCHECK(commands && profile);
214 if ((self = [super initWithNibName:nibName 223 if ((self = [super initWithNibName:@"Toolbar"
215 bundle:base::mac::FrameworkBundle()])) { 224 bundle:base::mac::FrameworkBundle()])) {
216 commands_ = commands; 225 commands_ = commands;
217 profile_ = profile; 226 profile_ = profile;
218 browser_ = browser; 227 browser_ = browser;
219 hasToolbar_ = YES; 228 hasToolbar_ = YES;
220 hasLocationBar_ = YES; 229 hasLocationBar_ = YES;
221 230
222 // Register for notifications about state changes for the toolbar buttons 231 // Register for notifications about state changes for the toolbar buttons
223 commandObserver_.reset( 232 commandObserver_.reset(
224 new ToolbarControllerInternal::CommandObserverBridge(self)); 233 new ToolbarControllerInternal::CommandObserverBridge(self));
225 234
226 commands->AddCommandObserver(IDC_BACK, commandObserver_.get()); 235 commands->AddCommandObserver(IDC_BACK, commandObserver_.get());
227 commands->AddCommandObserver(IDC_FORWARD, commandObserver_.get()); 236 commands->AddCommandObserver(IDC_FORWARD, commandObserver_.get());
228 commands->AddCommandObserver(IDC_RELOAD, commandObserver_.get()); 237 commands->AddCommandObserver(IDC_RELOAD, commandObserver_.get());
229 commands->AddCommandObserver(IDC_HOME, commandObserver_.get()); 238 commands->AddCommandObserver(IDC_HOME, commandObserver_.get());
230 commands->AddCommandObserver(IDC_BOOKMARK_PAGE, commandObserver_.get()); 239 commands->AddCommandObserver(IDC_BOOKMARK_PAGE, commandObserver_.get());
231 // NOTE: Don't remove the command observers. ToolbarController is 240 // NOTE: Don't remove the command observers. ToolbarController is
232 // autoreleased at about the same time as the CommandUpdater (owned by the 241 // autoreleased at about the same time as the CommandUpdater (owned by the
233 // Browser), so |commands_| may not be valid any more. 242 // Browser), so |commands_| may not be valid any more.
234 }
235 return self;
236 }
237 243
238 - (id)initWithCommands:(CommandUpdater*)commands 244 [[self toolbarView] setResizeDelegate:resizeDelegate];
239 profile:(Profile*)profile 245
240 browser:(Browser*)browser {
241 if ((self = [self initWithCommands:commands
242 profile:profile
243 browser:browser
244 nibFileNamed:@"Toolbar"])) {
245 // Start global error services now so we badge the menu correctly. 246 // Start global error services now so we badge the menu correctly.
246 SyncGlobalErrorFactory::GetForProfile(profile); 247 SyncGlobalErrorFactory::GetForProfile(profile);
247 } 248 }
248 return self; 249 return self;
249 } 250 }
250 251
251 // Called after the view is done loading and the outlets have been hooked up. 252 // Called after the view is done loading and the outlets have been hooked up.
252 // Now we can hook up bridges that rely on UI objects such as the location bar 253 // Now we can hook up bridges that rely on UI objects such as the location bar
253 // and button state. -viewDidLoad is the recommended way to do this in 10.10 254 // and button state. -viewDidLoad is the recommended way to do this in 10.10
254 // SDK. When running on 10.10 or above -awakeFromNib still works but for some 255 // SDK. When running on 10.10 or above -awakeFromNib still works but for some
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 // Create the controllers for the back/forward menus. 343 // Create the controllers for the back/forward menus.
343 backMenuController_.reset([[BackForwardMenuController alloc] 344 backMenuController_.reset([[BackForwardMenuController alloc]
344 initWithBrowser:browser_ 345 initWithBrowser:browser_
345 modelType:BACK_FORWARD_MENU_TYPE_BACK 346 modelType:BACK_FORWARD_MENU_TYPE_BACK
346 button:backButton_]); 347 button:backButton_]);
347 forwardMenuController_.reset([[BackForwardMenuController alloc] 348 forwardMenuController_.reset([[BackForwardMenuController alloc]
348 initWithBrowser:browser_ 349 initWithBrowser:browser_
349 modelType:BACK_FORWARD_MENU_TYPE_FORWARD 350 modelType:BACK_FORWARD_MENU_TYPE_FORWARD
350 button:forwardButton_]); 351 button:forwardButton_]);
351 352
352 // For a popup window, the toolbar is really just a location bar
353 // (see override for [ToolbarController view], below). When going
354 // fullscreen, we remove the toolbar controller's view from the view
355 // hierarchy. Calling [locationBar_ removeFromSuperview] when going
356 // fullscreen causes it to get released, making us unhappy
357 // (http://crbug.com/18551). We avoid the problem by incrementing
358 // the retain count of the location bar; use of the scoped object
359 // helps us remember to release it.
360 locationBarRetainer_.reset([locationBar_ retain]);
361 trackingArea_.reset( 353 trackingArea_.reset(
362 [[CrTrackingArea alloc] initWithRect:NSZeroRect // Ignored 354 [[CrTrackingArea alloc] initWithRect:NSZeroRect // Ignored
363 options:NSTrackingMouseMoved | 355 options:NSTrackingMouseMoved |
364 NSTrackingInVisibleRect | 356 NSTrackingInVisibleRect |
365 NSTrackingMouseEnteredAndExited | 357 NSTrackingMouseEnteredAndExited |
366 NSTrackingActiveAlways 358 NSTrackingActiveAlways
367 owner:self 359 owner:self
368 userInfo:nil]); 360 userInfo:nil]);
369 NSView* toolbarView = [self view]; 361 NSView* toolbarView = [self view];
370 [toolbarView addTrackingArea:trackingArea_.get()]; 362 [toolbarView addTrackingArea:trackingArea_.get()];
(...skipping 17 matching lines...) Expand all
388 380
389 [self addAccessibilityDescriptions]; 381 [self addAccessibilityDescriptions];
390 } 382 }
391 383
392 - (void)dealloc { 384 - (void)dealloc {
393 [self cleanUp]; 385 [self cleanUp];
394 [super dealloc]; 386 [super dealloc];
395 } 387 }
396 388
397 - (void)browserWillBeDestroyed { 389 - (void)browserWillBeDestroyed {
390 // Clear resize delegate so it doesn't get called during stopAnimation, and
391 // stop any in-flight animation.
392 [[self toolbarView] setResizeDelegate:nil];
393 [[self toolbarView] stopAnimation];
394
398 // Pass this call onto other reference counted objects. 395 // Pass this call onto other reference counted objects.
399 [backMenuController_ browserWillBeDestroyed]; 396 [backMenuController_ browserWillBeDestroyed];
400 [forwardMenuController_ browserWillBeDestroyed]; 397 [forwardMenuController_ browserWillBeDestroyed];
401 [browserActionsController_ browserWillBeDestroyed]; 398 [browserActionsController_ browserWillBeDestroyed];
402 [wrenchMenuController_ browserWillBeDestroyed]; 399 [wrenchMenuController_ browserWillBeDestroyed];
403 400
404 [self cleanUp]; 401 [self cleanUp];
405 } 402 }
406 403
407 - (void)cleanUp { 404 - (void)cleanUp {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 577
581 hasToolbar_ = toolbar; 578 hasToolbar_ = toolbar;
582 579
583 // If there's a toolbar, there must be a location bar. 580 // If there's a toolbar, there must be a location bar.
584 DCHECK((toolbar && locBar) || !toolbar); 581 DCHECK((toolbar && locBar) || !toolbar);
585 hasLocationBar_ = toolbar ? YES : locBar; 582 hasLocationBar_ = toolbar ? YES : locBar;
586 583
587 // Decide whether to hide/show based on whether there's a location bar. 584 // Decide whether to hide/show based on whether there's a location bar.
588 [[self view] setHidden:!hasLocationBar_]; 585 [[self view] setHidden:!hasLocationBar_];
589 586
590 // Make location bar not editable when in a pop-up. 587 // Make location bar not editable when in a pop-up or an app window.
591 locationBarView_->SetEditable(toolbar); 588 locationBarView_->SetEditable(toolbar);
589
590 // Display the toolbar with only the location bar inside it. No-ops if the
591 // toolbar view is already in this state.
592 if (!hasToolbar_ && hasLocationBar_)
593 [self showLocationBarOnly];
592 } 594 }
593 595
594 - (NSView*)view { 596 // (Private) Returns the backdrop to the toolbar as a ToolbarView.
595 if (hasToolbar_) 597 - (ToolbarView*)toolbarView{
596 return [super view]; 598 return base::mac::ObjCCastStrict<ToolbarView>([self view]);
597 return locationBar_;
598 }
599
600 // (Private) Returns the backdrop to the toolbar.
601 - (BackgroundGradientView*)backgroundGradientView {
602 // We really do mean |[super view]|; see our override of |-view|.
603 DCHECK([[super view] isKindOfClass:[BackgroundGradientView class]]);
604 return (BackgroundGradientView*)[super view];
605 } 599 }
606 600
607 - (id)customFieldEditorForObject:(id)obj { 601 - (id)customFieldEditorForObject:(id)obj {
608 if (obj == locationBar_) { 602 if (obj == locationBar_) {
609 // Lazilly construct Field editor, Cocoa UI code always runs on the 603 // Lazilly construct Field editor, Cocoa UI code always runs on the
610 // same thread, so there shoudn't be a race condition here. 604 // same thread, so there shoudn't be a race condition here.
611 if (autocompleteTextFieldEditor_.get() == nil) { 605 if (autocompleteTextFieldEditor_.get() == nil) {
612 autocompleteTextFieldEditor_.reset( 606 autocompleteTextFieldEditor_.reset(
613 [[AutocompleteTextFieldEditor alloc] init]); 607 [[AutocompleteTextFieldEditor alloc] init]);
614 } 608 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 [[NSNotificationCenter defaultCenter] 713 [[NSNotificationCenter defaultCenter]
720 addObserver:self 714 addObserver:self
721 selector:@selector(adjustBrowserActionsContainerForNewWindow:) 715 selector:@selector(adjustBrowserActionsContainerForNewWindow:)
722 name:NSWindowDidBecomeKeyNotification 716 name:NSWindowDidBecomeKeyNotification
723 object:[[self view] window]]; 717 object:[[self view] window]];
724 } 718 }
725 if (![browserActionsContainerView_ isHidden]) 719 if (![browserActionsContainerView_ isHidden])
726 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; 720 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO];
727 } 721 }
728 722
723 - (void)updateVisibility:(BOOL)visible withAnimation:(BOOL)animate {
724 // |visible| being YES is equivalent to [[toolbarController_ view] isHidden]
725 // being NO, and vice-versa. That is, when |visible| and |isHidden| have the
726 // same value, a state change is needed.
727 ToolbarView* view = [self toolbarView];
728
729 if ([view isHidden] == visible) {
730 [self setHasToolbar:hasToolbar_ hasLocationBar:visible];
731
732 CGFloat newHeight = visible ? kLocationBarHeight : 0;
733
734 // Perform the animation, which will cause the BrowserWindowController to
735 // resize this view in the browser layout as required.
736 if (animate) {
737 [view animateToNewHeight:newHeight
738 duration:kToolBarAnimationDuration];
739 } else {
740 [view setHeight:newHeight];
741 }
742 }
743 }
744
729 - (void)adjustBrowserActionsContainerForNewWindow: 745 - (void)adjustBrowserActionsContainerForNewWindow:
730 (NSNotification*)notification { 746 (NSNotification*)notification {
731 [self toolbarFrameChanged]; 747 [self toolbarFrameChanged];
732 [[NSNotificationCenter defaultCenter] 748 [[NSNotificationCenter defaultCenter]
733 removeObserver:self 749 removeObserver:self
734 name:NSWindowDidBecomeKeyNotification 750 name:NSWindowDidBecomeKeyNotification
735 object:[[self view] window]]; 751 object:[[self view] window]];
736 } 752 }
737 753
738 - (void)browserActionsContainerDragged:(NSNotification*)notification { 754 - (void)browserActionsContainerDragged:(NSNotification*)notification {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 containerFrame = NSOffsetRect(containerFrame, 838 containerFrame = NSOffsetRect(containerFrame,
823 NSWidth(containerFrame) - savedContainerWidth, 0); 839 NSWidth(containerFrame) - savedContainerWidth, 0);
824 containerFrame.size.width = savedContainerWidth; 840 containerFrame.size.width = savedContainerWidth;
825 [browserActionsContainerView_ setGrippyPinned:NO]; 841 [browserActionsContainerView_ setGrippyPinned:NO];
826 } 842 }
827 [browserActionsContainerView_ setFrame:containerFrame]; 843 [browserActionsContainerView_ setFrame:containerFrame];
828 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; 844 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO];
829 } 845 }
830 } 846 }
831 847
848 // Hide the back, forward, reload, home, and wrench buttons of the toolbar.
849 // This allows the location bar to occupy the entire width. There is no way to
850 // undo this operation, and once it is called, no other programmatic changes
851 // to the toolbar or location bar width should be made. This message is
852 // invalid if the toolbar is shown or the location bar is hidden.
853 - (void)showLocationBarOnly {
854 DCHECK(!hasToolbar_ && hasLocationBar_);
855
856 // If the toolbar buttons are already hidden, return. Assumes that the back,
857 // forward, reload, and wrench buttons are either shown or hidden together.
858 if ([backButton_ isHidden]) {
859 DCHECK_EQ(YES, [backButton_ isHidden] && [forwardButton_ isHidden] &&
860 [reloadButton_ isHidden] && [wrenchButton_ isHidden]);
861 return;
862 }
863
864 NSRect toolbarFrame = [[self view] frame];
865 NSRect locationFrame = [locationBar_ frame];
tapted 2015/10/26 04:40:55 nit: remove (see below)
dominickn 2015/10/26 06:42:42 Done.
866
867 // Adjust the toolbar frame to match the height of the location bar.
tapted 2015/10/26 04:40:55 perhaps "Ensure the location bar fills the toolbar
dominickn 2015/10/26 06:42:42 Done.
868 toolbarFrame.size.height = locationFrame.size.height;
tapted 2015/10/26 04:40:55 Unless kLocationBarHeight can be made obsolete, I
dominickn 2015/10/26 06:42:42 Done.
869 [[self view] setFrame:toolbarFrame];
870
871 // Adjust the location bar frame to stretch the full width of the toolbar.
872 locationFrame.origin.x = 0;
873 locationFrame.origin.y = 0;
874 locationFrame.size.width = NSWidth([[self view] frame]);
875 [locationBar_ setFrame:locationFrame];
tapted 2015/10/26 04:40:55 Not much from locationFrame ends up getting used,
dominickn 2015/10/26 06:42:42 Done.
876
877 [backButton_ setHidden:YES];
878 [forwardButton_ setHidden:YES];
879 [reloadButton_ setHidden:YES];
880 [wrenchButton_ setHidden:YES];
881 [homeButton_ setHidden:YES];
882 }
883
832 - (void)adjustLocationSizeBy:(CGFloat)dX animate:(BOOL)animate { 884 - (void)adjustLocationSizeBy:(CGFloat)dX animate:(BOOL)animate {
833 // Ensure that the location bar is in its proper place. 885 // Ensure that the location bar is in its proper place.
834 NSRect locationFrame = [locationBar_ frame]; 886 NSRect locationFrame = [locationBar_ frame];
835 locationFrame.size.width += dX; 887 locationFrame.size.width += dX;
836 888
837 [locationBar_ stopAnimation]; 889 [locationBar_ stopAnimation];
838 890
839 if (animate) 891 if (animate)
840 [locationBar_ animateToFrame:locationFrame]; 892 [locationBar_ animateToFrame:locationFrame];
841 else 893 else
(...skipping 22 matching lines...) Expand all
864 916
865 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { 917 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight {
866 // With no toolbar, just ignore the compression. 918 // With no toolbar, just ignore the compression.
867 if (!hasToolbar_) 919 if (!hasToolbar_)
868 return NSHeight([locationBar_ frame]); 920 return NSHeight([locationBar_ frame]);
869 921
870 return kBaseToolbarHeightNormal - compressByHeight; 922 return kBaseToolbarHeightNormal - compressByHeight;
871 } 923 }
872 924
873 - (void)setDividerOpacity:(CGFloat)opacity { 925 - (void)setDividerOpacity:(CGFloat)opacity {
874 BackgroundGradientView* view = [self backgroundGradientView]; 926 ToolbarView* toolbarView = [self toolbarView];
875 [view setShowsDivider:(opacity > 0 ? YES : NO)]; 927 [toolbarView setShowsDivider:(opacity > 0 ? YES : NO)];
876 928 [toolbarView setDividerOpacity:opacity];
877 // We may not have a toolbar view (e.g., popup windows only have a location 929 [toolbarView setNeedsDisplay:YES];
878 // bar).
879 if ([view isKindOfClass:[ToolbarView class]]) {
880 ToolbarView* toolbarView = (ToolbarView*)view;
881 [toolbarView setDividerOpacity:opacity];
882 }
883
884 [view setNeedsDisplay:YES];
885 } 930 }
886 931
887 - (BrowserActionsController*)browserActionsController { 932 - (BrowserActionsController*)browserActionsController {
888 return browserActionsController_.get(); 933 return browserActionsController_.get();
889 } 934 }
890 935
891 - (NSView*)wrenchButton { 936 - (NSView*)wrenchButton {
892 return wrenchButton_; 937 return wrenchButton_;
893 } 938 }
894 939
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 - (void)hideDropURLsIndicatorInView:(NSView*)view { 995 - (void)hideDropURLsIndicatorInView:(NSView*)view {
951 // Do nothing. 996 // Do nothing.
952 } 997 }
953 998
954 // (URLDropTargetController protocol) 999 // (URLDropTargetController protocol)
955 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 1000 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
956 return drag_util::IsUnsupportedDropData(profile_, info); 1001 return drag_util::IsUnsupportedDropData(profile_, info);
957 } 1002 }
958 1003
959 @end 1004 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698