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

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

Issue 209613002: Download shelf autohides on showing in shell, just same as regular open Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added browser and unit tests. Renamed 'UserActed' to 'OpenedOrShown'. Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 - (void)updateVisibility:(id)sender { 242 - (void)updateVisibility:(id)sender {
243 if ([[self view] window]) 243 if ([[self view] window])
244 [self updateTheme:[[[self view] window] themeProvider]]; 244 [self updateTheme:[[[self view] window] themeProvider]];
245 245
246 NSView* view = [self view]; 246 NSView* view = [self view];
247 NSRect containerFrame = [[view superview] frame]; 247 NSRect containerFrame = [[view superview] frame];
248 [view setHidden:(NSMaxX([view frame]) > NSWidth(containerFrame))]; 248 [view setHidden:(NSMaxX([view frame]) > NSWidth(containerFrame))];
249 } 249 }
250 250
251 - (void)downloadWasOpened { 251 - (void)downloadWasOpenedOrShown {
252 [shelf_ downloadWasOpened:self]; 252 [shelf_ downloadWasOpenedOrShown:self];
253 } 253 }
254 254
255 - (IBAction)handleButtonClick:(id)sender { 255 - (IBAction)handleButtonClick:(id)sender {
256 NSEvent* event = [NSApp currentEvent]; 256 NSEvent* event = [NSApp currentEvent];
257 DownloadItem* download = [self download]; 257 DownloadItem* download = [self download];
258 if ([event modifierFlags] & NSCommandKeyMask) { 258 if ([event modifierFlags] & NSCommandKeyMask) {
259 // Let cmd-click show the file in Finder, like e.g. in Safari and Spotlight. 259 // Let cmd-click show the file in Finder, like e.g. in Safari and Spotlight.
260 download->ShowDownloadInShell(); 260 download->ShowDownloadInShell();
261 } else { 261 } else {
262 download->OpenDownload(); 262 download->OpenDownload();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 DownloadItem* download = bridge_->download_model()->download(); 360 DownloadItem* download = bridge_->download_model()->download();
361 download->Remove(); 361 download->Remove();
362 // WARNING: we are deleted at this point. Don't access 'this'. 362 // WARNING: we are deleted at this point. Don't access 'this'.
363 } 363 }
364 364
365 - (IBAction)showContextMenu:(id)sender { 365 - (IBAction)showContextMenu:(id)sender {
366 [progressView_ showContextMenu]; 366 [progressView_ showContextMenu];
367 } 367 }
368 368
369 @end 369 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698