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

Unified Diff: chrome/browser/ui/cocoa/download/download_shelf_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: Move the 'user acted' flag into DownloadItemModelData and get rid of SetOpened/SetShown in Download… Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/download/download_shelf_controller.mm
diff --git a/chrome/browser/ui/cocoa/download/download_shelf_controller.mm b/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
index 51c70f7d44dc904954a25c729fa5191ea0bddce2..4b2fa10c80cd71cab0fc69d0bed7bc25a8ecf02b 100644
--- a/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
+++ b/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
@@ -7,6 +7,7 @@
#include "base/mac/bundle_locations.h"
#include "base/mac/mac_util.h"
#include "base/strings/sys_string_conversions.h"
+#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_stats.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_service.h"
@@ -215,6 +216,12 @@ const NSSize kHoverCloseButtonDefaultSize = { 18, 18 };
[self maybeAutoCloseAfterDelay];
}
+- (void)downloadWasShown:(DownloadItemController*)item_controller {
+ // This should only be called on the main thead.
+ DCHECK([NSThread isMainThread]);
+ [self maybeAutoCloseAfterDelay];
+}
+
// We need to explicitly release our download controllers here since they need
// to remove themselves as observers before the remaining shutdown happens.
- (void)exiting {
@@ -380,9 +387,9 @@ const NSSize kHoverCloseButtonDefaultSize = { 18, 18 };
[self removeDownload:itemController
isShelfClosing:YES];
} else {
- // Treat the item as opened when we close. This way if we get shown again
+ // Treat the item as 'acted' when we close. This way if we get shown again
// the user need not open this item for the shelf to auto-close.
- download->SetOpened(true);
+ DownloadItemModel(download).SetUserActed(true);
++i;
}
}
@@ -427,7 +434,8 @@ const NSSize kHoverCloseButtonDefaultSize = { 18, 18 };
for (NSUInteger i = 0; i < [downloadItemControllers_ count]; ++i) {
DownloadItemController* itemController =
[downloadItemControllers_ objectAtIndex:i];
- if (![itemController download]->GetOpened())
+ DownloadItem* download = [itemController download];
+ if (!DownloadItemModel(download).GetUserActed())
return;
}

Powered by Google App Engine
This is Rietveld 408576698