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

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

Issue 260012: Use more images from the pak files... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
OLDNEW
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 "base/mac_util.h" 10 #include "base/mac_util.h"
10 #include "base/sys_string_conversions.h" 11 #include "base/sys_string_conversions.h"
11 #import "chrome/browser/cocoa/download_item_cell.h" 12 #import "chrome/browser/cocoa/download_item_cell.h"
12 #include "chrome/browser/cocoa/download_item_mac.h" 13 #include "chrome/browser/cocoa/download_item_mac.h"
13 #import "chrome/browser/cocoa/download_shelf_controller.h" 14 #import "chrome/browser/cocoa/download_shelf_controller.h"
14 #include "chrome/browser/download/download_item_model.h" 15 #include "chrome/browser/download/download_item_model.h"
15 #include "chrome/browser/download/download_shelf.h" 16 #include "chrome/browser/download/download_shelf.h"
16 #include "chrome/browser/download/download_util.h" 17 #include "chrome/browser/download/download_util.h"
17 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 #include "grit/theme_resources.h"
18 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" 20 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
19 21
20 static const int kTextWidth = 140; // Pixels 22 static const int kTextWidth = 140; // Pixels
21 23
22 namespace { 24 namespace {
23 25
24 // Helper to widen a view. 26 // Helper to widen a view.
25 void WidenView(NSView* view, CGFloat widthChange) { 27 void WidenView(NSView* view, CGFloat widthChange) {
26 // If it is an NSBox, the autoresize of the contentView is the issue. 28 // If it is an NSBox, the autoresize of the contentView is the issue.
27 NSView* contentView = view; 29 NSView* contentView = view;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 DCHECK(buttonTweaker_ != nil); 98 DCHECK(buttonTweaker_ != nil);
97 CGFloat widthChange = [buttonTweaker_ changedWidth]; 99 CGFloat widthChange = [buttonTweaker_ changedWidth];
98 // Grow the parent views 100 // Grow the parent views
99 WidenView([self view], widthChange); 101 WidenView([self view], widthChange);
100 WidenView(dangerousDownloadView_, widthChange); 102 WidenView(dangerousDownloadView_, widthChange);
101 // Slide the two buttons over. 103 // Slide the two buttons over.
102 NSPoint frameOrigin = [buttonTweaker_ frame].origin; 104 NSPoint frameOrigin = [buttonTweaker_ frame].origin;
103 frameOrigin.x += widthChange; 105 frameOrigin.x += widthChange;
104 [buttonTweaker_ setFrameOrigin:frameOrigin]; 106 [buttonTweaker_ setFrameOrigin:frameOrigin];
105 107
108 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
109 NSImage* alertIcon = rb.GetNSImageNamed(IDR_WARNING);
110 DCHECK(alertIcon);
111 [image_ setImage:alertIcon];
112
106 [self setStateFromDownload:bridge_->download_model()]; 113 [self setStateFromDownload:bridge_->download_model()];
107 bridge_->LoadIcon(); 114 bridge_->LoadIcon();
108 } 115 }
109 116
110 - (void)setStateFromDownload:(BaseDownloadItemModel*)downloadModel { 117 - (void)setStateFromDownload:(BaseDownloadItemModel*)downloadModel {
111 DCHECK_EQ(bridge_->download_model(), downloadModel); 118 DCHECK_EQ(bridge_->download_model(), downloadModel);
112 119
113 // Handle dangerous downloads. 120 // Handle dangerous downloads.
114 if (downloadModel->download()->safety_state() == DownloadItem::DANGEROUS) { 121 if (downloadModel->download()->safety_state() == DownloadItem::DANGEROUS) {
115 [self setState:kDangerous]; 122 [self setState:kDangerous];
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 270
264 - (IBAction)handleReveal:(id)sender { 271 - (IBAction)handleReveal:(id)sender {
265 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER); 272 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::SHOW_IN_FOLDER);
266 } 273 }
267 274
268 - (IBAction)handleCancel:(id)sender { 275 - (IBAction)handleCancel:(id)sender {
269 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::CANCEL); 276 menuBridge_->ExecuteItemCommand(DownloadShelfContextMenuMac::CANCEL);
270 } 277 }
271 278
272 @end 279 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/download_item_controller.h ('k') | chrome/browser/cocoa/download_shelf_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698