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/extensions/browser_actions_controller.h" | 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 // container view. | 488 // container view. |
489 [button removeFromSuperview]; | 489 [button removeFromSuperview]; |
490 [button setAlphaValue:0.0]; | 490 [button setAlphaValue:0.0]; |
491 } | 491 } |
492 } | 492 } |
493 } | 493 } |
494 | 494 |
495 - (void)removeViewForAction:(ToolbarActionViewController*)action { | 495 - (void)removeViewForAction:(ToolbarActionViewController*)action { |
496 // We're about to remove the button view from the container as well as from | 496 // We're about to remove the button view from the container as well as from |
497 // |buttons_|, so make sure we retain a reference. | 497 // |buttons_|, so make sure we retain a reference. |
498 base::scoped_nsobject<BrowserActionButton> button = | 498 base::scoped_nsobject<BrowserActionButton> button( |
499 [[self buttonForId:action->GetId()] retain]; | 499 [[self buttonForId:action->GetId()] retain]); |
500 | 500 |
501 // Note: We remove the button from the view and the buttons list first because | 501 // Note: We remove the button from the view and the buttons list first because |
502 // destroying it (or calling -onRemoved) can cause redraws, and we don't want | 502 // destroying it (or calling -onRemoved) can cause redraws, and we don't want |
503 // to include it when the view is gone. | 503 // to include it when the view is gone. |
504 [button removeFromSuperview]; | 504 [button removeFromSuperview]; |
505 [buttons_ removeObject:button]; | 505 [buttons_ removeObject:button]; |
506 | 506 |
507 [button onRemoved]; | 507 [button onRemoved]; |
508 | 508 |
509 [containerView_ setMaxDesiredWidth:toolbarActionsBar_->GetMaximumWidth()]; | 509 [containerView_ setMaxDesiredWidth:toolbarActionsBar_->GetMaximumWidth()]; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 } | 840 } |
841 | 841 |
842 #pragma mark - | 842 #pragma mark - |
843 #pragma mark Testing Methods | 843 #pragma mark Testing Methods |
844 | 844 |
845 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { | 845 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { |
846 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; | 846 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; |
847 } | 847 } |
848 | 848 |
849 @end | 849 @end |
OLD | NEW |