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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 } | 506 } |
507 } | 507 } |
508 } | 508 } |
509 | 509 |
510 - (void)removeViewForAction:(ToolbarActionViewController*)action { | 510 - (void)removeViewForAction:(ToolbarActionViewController*)action { |
511 // We're about to remove the button view from the container as well as from | 511 // We're about to remove the button view from the container as well as from |
512 // |buttons_|, so make sure we retain a reference. | 512 // |buttons_|, so make sure we retain a reference. |
513 base::scoped_nsobject<BrowserActionButton> button( | 513 base::scoped_nsobject<BrowserActionButton> button( |
514 [[self buttonForId:action->GetId()] retain]); | 514 [[self buttonForId:action->GetId()] retain]); |
515 | 515 |
| 516 [button hidePopup]; |
| 517 |
516 // Note: We remove the button from the view and the buttons list first because | 518 // Note: We remove the button from the view and the buttons list first because |
517 // destroying it (or calling -onRemoved) can cause redraws, and we don't want | 519 // destroying it (or calling -onRemoved) can cause redraws, and we don't want |
518 // to include it when the view is gone. | 520 // to include it when the view is gone. |
519 [button removeFromSuperview]; | 521 [button removeFromSuperview]; |
520 [buttons_ removeObject:button]; | 522 [buttons_ removeObject:button]; |
521 | 523 |
522 [self updateMaxWidth]; | 524 [self updateMaxWidth]; |
523 [button onRemoved]; | 525 [button onRemoved]; |
524 } | 526 } |
525 | 527 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 } | 850 } |
849 | 851 |
850 #pragma mark - | 852 #pragma mark - |
851 #pragma mark Testing Methods | 853 #pragma mark Testing Methods |
852 | 854 |
853 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { | 855 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { |
854 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; | 856 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; |
855 } | 857 } |
856 | 858 |
857 @end | 859 @end |
OLD | NEW |