| 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 "chrome/browser/cocoa/download_shelf_controller.h" | 5 #import "chrome/browser/cocoa/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 "base/mac_util.h" | 9 #include "base/mac_util.h" |
| 9 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/browser.h" | 11 #include "chrome/browser/browser.h" |
| 11 #import "chrome/browser/cocoa/browser_window_controller.h" | 12 #import "chrome/browser/cocoa/browser_window_controller.h" |
| 12 #include "chrome/browser/cocoa/browser_window_cocoa.h" | 13 #include "chrome/browser/cocoa/browser_window_cocoa.h" |
| 13 #include "chrome/browser/cocoa/download_item_controller.h" | 14 #include "chrome/browser/cocoa/download_item_controller.h" |
| 14 #include "chrome/browser/cocoa/download_shelf_mac.h" | 15 #include "chrome/browser/cocoa/download_shelf_mac.h" |
| 15 #import "chrome/browser/cocoa/download_shelf_view.h" | 16 #import "chrome/browser/cocoa/download_shelf_view.h" |
| 16 #include "chrome/browser/download/download_manager.h" | 17 #include "chrome/browser/download/download_manager.h" |
| 17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 font, NSFontAttributeName, | 81 font, NSFontAttributeName, |
| 81 nil]; | 82 nil]; |
| 82 NSString* text = | 83 NSString* text = |
| 83 base::SysWideToNSString(l10n_util::GetString(IDS_SHOW_ALL_DOWNLOADS)); | 84 base::SysWideToNSString(l10n_util::GetString(IDS_SHOW_ALL_DOWNLOADS)); |
| 84 scoped_nsobject<NSAttributedString> linkText([[NSAttributedString alloc] | 85 scoped_nsobject<NSAttributedString> linkText([[NSAttributedString alloc] |
| 85 initWithString:text attributes:linkAttributes]); | 86 initWithString:text attributes:linkAttributes]); |
| 86 | 87 |
| 87 [[showAllDownloadsLink_ textStorage] setAttributedString:linkText.get()]; | 88 [[showAllDownloadsLink_ textStorage] setAttributedString:linkText.get()]; |
| 88 [showAllDownloadsLink_ setDelegate:self]; | 89 [showAllDownloadsLink_ setDelegate:self]; |
| 89 | 90 |
| 91 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 92 NSImage* favicon = rb.GetNSImageNamed(IDR_DOWNLOADS_FAVICON); |
| 93 DCHECK(favicon); |
| 94 [image_ setImage:favicon]; |
| 95 |
| 90 [self resizeDownloadLinkToFit]; | 96 [self resizeDownloadLinkToFit]; |
| 91 } | 97 } |
| 92 | 98 |
| 93 - (void)dealloc { | 99 - (void)dealloc { |
| 94 // The controllers will unregister themselves as observers when they are | 100 // The controllers will unregister themselves as observers when they are |
| 95 // deallocated. No need to do that here. | 101 // deallocated. No need to do that here. |
| 96 [super dealloc]; | 102 [super dealloc]; |
| 97 } | 103 } |
| 98 | 104 |
| 99 - (void)resizeDownloadLinkToFit { | 105 - (void)resizeDownloadLinkToFit { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 if (isTransferDone && | 284 if (isTransferDone && |
| 279 [itemController download]->safety_state() != DownloadItem::DANGEROUS) { | 285 [itemController download]->safety_state() != DownloadItem::DANGEROUS) { |
| 280 [self remove:itemController]; | 286 [self remove:itemController]; |
| 281 } else { | 287 } else { |
| 282 ++i; | 288 ++i; |
| 283 } | 289 } |
| 284 } | 290 } |
| 285 } | 291 } |
| 286 | 292 |
| 287 @end | 293 @end |
| OLD | NEW |