| 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/download/download_item_controller.h" | 5 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 return [progressView_ frame].size; | 238 return [progressView_ frame].size; |
| 239 DCHECK_EQ(kDangerous, state_); | 239 DCHECK_EQ(kDangerous, state_); |
| 240 return [dangerousDownloadView_ frame].size; | 240 return [dangerousDownloadView_ frame].size; |
| 241 } | 241 } |
| 242 | 242 |
| 243 - (DownloadItem*)download { | 243 - (DownloadItem*)download { |
| 244 return bridge_->download_model()->download(); | 244 return bridge_->download_model()->download(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 - (void)updateToolTip { | 247 - (void)updateToolTip { |
| 248 string16 elidedFilename = ui::ElideFilename( | 248 string16 tooltip_text = ui::ElideFilename( |
| 249 [self download]->GetFileNameToReportUser(), *font_, kToolTipMaxWidth); | 249 [self download]->GetFileNameToReportUser(), *font_, kToolTipMaxWidth); |
| 250 [progressView_ setToolTip:base::SysUTF16ToNSString(elidedFilename)]; | 250 |
| 251 if ([self download]->GetState() == content::DownloadItem::INTERRUPTED) { |
| 252 content::DownloadInterruptReason reason = [self download]->GetLastReason(); |
| 253 DCHECK_NE(0, reason); |
| 254 |
| 255 // Add the status on another line. |
| 256 tooltip_text += ASCIIToUTF16("\n"); |
| 257 tooltip_text += DownloadItemModel::InterruptReasonStatusMessage(reason); |
| 258 } |
| 259 |
| 260 [progressView_ setToolTip:base::SysUTF16ToNSString(tooltip_text)]; |
| 251 } | 261 } |
| 252 | 262 |
| 253 - (void)clearDangerousMode { | 263 - (void)clearDangerousMode { |
| 254 [self setState:kNormal]; | 264 [self setState:kNormal]; |
| 255 // The state change hide the dangerouse download view and is now showing the | 265 // The state change hide the dangerouse download view and is now showing the |
| 256 // download progress view. This means the view is likely to be a different | 266 // download progress view. This means the view is likely to be a different |
| 257 // size, so trigger a shelf layout to fix up spacing. | 267 // size, so trigger a shelf layout to fix up spacing. |
| 258 [shelf_ layoutItems]; | 268 [shelf_ layoutItems]; |
| 259 } | 269 } |
| 260 | 270 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 [sender setTitle:l10n_util::GetNSStringWithFixup( | 377 [sender setTitle:l10n_util::GetNSStringWithFixup( |
| 368 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; | 378 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; |
| 369 } else { | 379 } else { |
| 370 [sender setTitle:l10n_util::GetNSStringWithFixup( | 380 [sender setTitle:l10n_util::GetNSStringWithFixup( |
| 371 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; | 381 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; |
| 372 } | 382 } |
| 373 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); | 383 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); |
| 374 } | 384 } |
| 375 | 385 |
| 376 @end | 386 @end |
| OLD | NEW |