| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/download/download_shelf_controller.h" | 5 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| 11 #include "chrome/browser/download/download_item.h" | 11 #include "chrome/browser/download/download_item.h" |
| 12 #include "chrome/browser/download/download_manager.h" | 12 #include "chrome/browser/download/download_manager.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/themes/browser_theme_provider.h" | 14 #include "chrome/browser/themes/browser_theme_provider.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #import "chrome/browser/ui/cocoa/animatable_view.h" | 16 #import "chrome/browser/ui/cocoa/animatable_view.h" |
| 17 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 17 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 18 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 18 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 19 #include "chrome/browser/ui/cocoa/download/download_item_controller.h" | 19 #include "chrome/browser/ui/cocoa/download/download_item_controller.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 - (void)installTrackingArea; | 76 - (void)installTrackingArea; |
| 77 - (void)cancelAutoCloseAndRemoveTrackingArea; | 77 - (void)cancelAutoCloseAndRemoveTrackingArea; |
| 78 @end | 78 @end |
| 79 | 79 |
| 80 | 80 |
| 81 @implementation DownloadShelfController | 81 @implementation DownloadShelfController |
| 82 | 82 |
| 83 - (id)initWithBrowser:(Browser*)browser | 83 - (id)initWithBrowser:(Browser*)browser |
| 84 resizeDelegate:(id<ViewResizer>)resizeDelegate { | 84 resizeDelegate:(id<ViewResizer>)resizeDelegate { |
| 85 if ((self = [super initWithNibName:@"DownloadShelf" | 85 if ((self = [super initWithNibName:@"DownloadShelf" |
| 86 bundle:mac_util::MainAppBundle()])) { | 86 bundle:base::mac::MainAppBundle()])) { |
| 87 resizeDelegate_ = resizeDelegate; | 87 resizeDelegate_ = resizeDelegate; |
| 88 maxShelfHeight_ = NSHeight([[self view] bounds]); | 88 maxShelfHeight_ = NSHeight([[self view] bounds]); |
| 89 currentShelfHeight_ = maxShelfHeight_; | 89 currentShelfHeight_ = maxShelfHeight_; |
| 90 | 90 |
| 91 // Reset the download shelf's frame height to zero. It will be properly | 91 // Reset the download shelf's frame height to zero. It will be properly |
| 92 // positioned and sized the first time we try to set its height. (Just | 92 // positioned and sized the first time we try to set its height. (Just |
| 93 // setting the rect to NSZeroRect does not work: it confuses Cocoa's view | 93 // setting the rect to NSZeroRect does not work: it confuses Cocoa's view |
| 94 // layout logic. If the shelf's width is too small, cocoa makes the download | 94 // layout logic. If the shelf's width is too small, cocoa makes the download |
| 95 // item container view wider than the browser window). | 95 // item container view wider than the browser window). |
| 96 NSRect frame = [[self view] frame]; | 96 NSRect frame = [[self view] frame]; |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 selector:@selector(hide:) | 417 selector:@selector(hide:) |
| 418 object:self]; | 418 object:self]; |
| 419 | 419 |
| 420 if (trackingArea_.get()) { | 420 if (trackingArea_.get()) { |
| 421 [[self view] removeTrackingArea:trackingArea_]; | 421 [[self view] removeTrackingArea:trackingArea_]; |
| 422 trackingArea_.reset(nil); | 422 trackingArea_.reset(nil); |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 | 425 |
| 426 @end | 426 @end |
| OLD | NEW |