| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "download_shelf_controller.h" | 5 #import "download_shelf_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #import "chrome/browser/cocoa/browser_window_controller.h" | 10 #import "chrome/browser/cocoa/browser_window_controller.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 - (void)resizeDownloadShelf { | 85 - (void)resizeDownloadShelf { |
| 86 NSRect barFrame = [[self view] frame]; | 86 NSRect barFrame = [[self view] frame]; |
| 87 barFrame.origin.y = 0; | 87 barFrame.origin.y = 0; |
| 88 barFrame.size.height = NSMinY([contentArea_ frame]); | 88 barFrame.size.height = NSMinY([contentArea_ frame]); |
| 89 [[self view] setFrame:barFrame]; | 89 [[self view] setFrame:barFrame]; |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Show or hide the bar based on the value of |enable|. Handles animating the | 92 // Show or hide the bar based on the value of |enable|. Handles animating the |
| 93 // resize of the content view. | 93 // resize of the content view. |
| 94 - (void)showDownloadShelf:(BOOL)enable { | 94 - (void)showDownloadShelf:(BOOL)enable { |
| 95 if ([self isVisible] == enable) |
| 96 return; |
| 97 |
| 95 contentAreaHasOffset_ = enable; | 98 contentAreaHasOffset_ = enable; |
| 96 [[self view] setHidden:enable ? NO : YES]; | 99 [[self view] setHidden:enable ? NO : YES]; |
| 97 [self applyContentAreaOffset:enable]; | 100 [self applyContentAreaOffset:enable]; |
| 98 | 101 |
| 99 barIsVisible_ = enable; | 102 barIsVisible_ = enable; |
| 100 } | 103 } |
| 101 | 104 |
| 102 // Apply a contents box offset to make (or remove) room for the | 105 // Apply a contents box offset to make (or remove) room for the |
| 103 // download shelf. If apply==YES, always make room (the contentView_ is | 106 // download shelf. If apply==YES, always make room (the contentView_ is |
| 104 // "full size"). If apply==NO we are trying to undo an offset. If no | 107 // "full size"). If apply==NO we are trying to undo an offset. If no |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 140 |
| 138 - (void)hide:(id)sender { | 141 - (void)hide:(id)sender { |
| 139 [self showDownloadShelf:NO]; | 142 [self showDownloadShelf:NO]; |
| 140 } | 143 } |
| 141 | 144 |
| 142 - (void)addDownloadItem:(NSView*)view { | 145 - (void)addDownloadItem:(NSView*)view { |
| 143 [[self view] addSubview:view]; | 146 [[self view] addSubview:view]; |
| 144 } | 147 } |
| 145 | 148 |
| 146 @end | 149 @end |
| OLD | NEW |