| 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_item_controller.h" | 5 #import "chrome/browser/cocoa/download_item_controller.h" |
| 6 | 6 |
| 7 #include "app/gfx/text_elider.h" | 7 #include "app/gfx/text_elider.h" |
| 8 #include "app/l10n_util_mac.h" | 8 #include "app/l10n_util_mac.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
| 11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
| 12 #import "chrome/browser/cocoa/download_item_button.h" |
| 12 #import "chrome/browser/cocoa/download_item_cell.h" | 13 #import "chrome/browser/cocoa/download_item_cell.h" |
| 13 #include "chrome/browser/cocoa/download_item_mac.h" | 14 #include "chrome/browser/cocoa/download_item_mac.h" |
| 14 #import "chrome/browser/cocoa/download_shelf_controller.h" | 15 #import "chrome/browser/cocoa/download_shelf_controller.h" |
| 15 #import "chrome/browser/cocoa/ui_localizer.h" | 16 #import "chrome/browser/cocoa/ui_localizer.h" |
| 16 #include "chrome/browser/download/download_item_model.h" | 17 #include "chrome/browser/download/download_item_model.h" |
| 17 #include "chrome/browser/download/download_shelf.h" | 18 #include "chrome/browser/download/download_shelf.h" |
| 18 #include "chrome/browser/download/download_util.h" | 19 #include "chrome/browser/download/download_util.h" |
| 19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 20 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 21 #import "third_party/GTM/AppKit/GTMTheme.h" | 22 #import "third_party/GTM/AppKit/GTMTheme.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 downloadModel->download()->original_name(), chromeFont, kTextWidth)); | 155 downloadModel->download()->original_name(), chromeFont, kTextWidth)); |
| 155 dangerousWarning = l10n_util::GetNSStringFWithFixup( | 156 dangerousWarning = l10n_util::GetNSStringFWithFixup( |
| 156 IDS_PROMPT_DANGEROUS_DOWNLOAD, elidedFilename); | 157 IDS_PROMPT_DANGEROUS_DOWNLOAD, elidedFilename); |
| 157 confirmButtonTitle = l10n_util::GetNSStringWithFixup(IDS_SAVE_DOWNLOAD); | 158 confirmButtonTitle = l10n_util::GetNSStringWithFixup(IDS_SAVE_DOWNLOAD); |
| 158 } | 159 } |
| 159 [dangerousDownloadLabel_ setStringValue:dangerousWarning]; | 160 [dangerousDownloadLabel_ setStringValue:dangerousWarning]; |
| 160 [dangerousDownloadConfirmButton_ setTitle:confirmButtonTitle]; | 161 [dangerousDownloadConfirmButton_ setTitle:confirmButtonTitle]; |
| 161 return; | 162 return; |
| 162 } | 163 } |
| 163 | 164 |
| 164 // Set the correct popup menu. | 165 // Set correct popup menu. Also, set draggable download on completion. |
| 165 if (downloadModel->download()->state() == DownloadItem::COMPLETE) | 166 if (downloadModel->download()->state() == DownloadItem::COMPLETE) { |
| 166 currentMenu_ = completeDownloadMenu_; | 167 currentMenu_ = completeDownloadMenu_; |
| 167 else | 168 [progressView_ setDownload:downloadModel->download()->full_path()]; |
| 169 } else { |
| 168 currentMenu_ = activeDownloadMenu_; | 170 currentMenu_ = activeDownloadMenu_; |
| 171 } |
| 169 | 172 |
| 170 [progressView_ setMenu:currentMenu_]; // for context menu | 173 [progressView_ setMenu:currentMenu_]; // for context menu |
| 171 [cell_ setStateFromDownload:downloadModel]; | 174 [cell_ setStateFromDownload:downloadModel]; |
| 172 } | 175 } |
| 173 | 176 |
| 174 - (void)setIcon:(NSImage*)icon { | 177 - (void)setIcon:(NSImage*)icon { |
| 175 [cell_ setImage:icon]; | 178 [cell_ setImage:icon]; |
| 176 } | 179 } |
| 177 | 180 |
| 178 - (void)remove { | 181 - (void)remove { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 326 |
| 324 - (IBAction)handleCancel:(id)sender { | 327 - (IBAction)handleCancel:(id)sender { |
| 325 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::CANCEL); | 328 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::CANCEL); |
| 326 } | 329 } |
| 327 | 330 |
| 328 - (IBAction)handleTogglePause:(id)sender { | 331 - (IBAction)handleTogglePause:(id)sender { |
| 329 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); | 332 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); |
| 330 } | 333 } |
| 331 | 334 |
| 332 @end | 335 @end |
| OLD | NEW |