Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Side by Side Diff: chrome/browser/ui/cocoa/download/download_item_controller.mm

Issue 9968090: Added download error descriptions to tooltips for Mac & Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed tooltip to using the short error status string. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/download/download_item_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(reason != 0);
Nico 2012/04/06 16:14:05 DCHECK_NE(reason, DOWNLOAD_INTERRUPT_REASON_NONE);
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/download/download_item_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698