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 = |
249 [self download]->GetFileNameToReportUser(), *font_, kToolTipMaxWidth); | 249 bridge_->download_model()->GetTooltipText(*font_, kToolTipMaxWidth); |
250 [progressView_ setToolTip:base::SysUTF16ToNSString(elidedFilename)]; | 250 [progressView_ setToolTip:base::SysUTF16ToNSString(tooltip_text)]; |
251 } | 251 } |
252 | 252 |
253 - (void)clearDangerousMode { | 253 - (void)clearDangerousMode { |
254 [self setState:kNormal]; | 254 [self setState:kNormal]; |
255 // The state change hide the dangerouse download view and is now showing the | 255 // 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 | 256 // download progress view. This means the view is likely to be a different |
257 // size, so trigger a shelf layout to fix up spacing. | 257 // size, so trigger a shelf layout to fix up spacing. |
258 [shelf_ layoutItems]; | 258 [shelf_ layoutItems]; |
259 } | 259 } |
260 | 260 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 [sender setTitle:l10n_util::GetNSStringWithFixup( | 367 [sender setTitle:l10n_util::GetNSStringWithFixup( |
368 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; | 368 IDS_DOWNLOAD_MENU_PAUSE_ITEM)]; |
369 } else { | 369 } else { |
370 [sender setTitle:l10n_util::GetNSStringWithFixup( | 370 [sender setTitle:l10n_util::GetNSStringWithFixup( |
371 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; | 371 IDS_DOWNLOAD_MENU_RESUME_ITEM)]; |
372 } | 372 } |
373 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); | 373 menuBridge_->ExecuteCommand(DownloadShelfContextMenuMac::TOGGLE_PAUSE); |
374 } | 374 } |
375 | 375 |
376 @end | 376 @end |
OLD | NEW |