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

Side by Side Diff: chrome/browser/ui/views/download/download_item_view.cc

Issue 966983002: downloads: clicking "remove" on chrome://downloads should also hide shelf item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +tests Created 5 years, 9 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
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 #include "chrome/browser/ui/views/download/download_item_view.h" 5 #include "chrome/browser/ui/views/download/download_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 shelf_->SchedulePaint(); 267 shelf_->SchedulePaint();
268 } 268 }
269 269
270 // DownloadObserver interface. 270 // DownloadObserver interface.
271 271
272 // Update the progress graphic on the icon and our text status label 272 // Update the progress graphic on the icon and our text status label
273 // to reflect our current bytes downloaded, time remaining. 273 // to reflect our current bytes downloaded, time remaining.
274 void DownloadItemView::OnDownloadUpdated(DownloadItem* download_item) { 274 void DownloadItemView::OnDownloadUpdated(DownloadItem* download_item) {
275 DCHECK_EQ(download(), download_item); 275 DCHECK_EQ(download(), download_item);
276 276
277 if (!model_.ShouldShowInShelf()) {
278 shelf_->RemoveDownloadView(this); // This will delete us!
279 return;
280 }
281
277 if (IsShowingWarningDialog() && !model_.IsDangerous()) { 282 if (IsShowingWarningDialog() && !model_.IsDangerous()) {
278 // We have been approved. 283 // We have been approved.
279 ClearWarningDialog(); 284 ClearWarningDialog();
280 } else if (!IsShowingWarningDialog() && model_.IsDangerous()) { 285 } else if (!IsShowingWarningDialog() && model_.IsDangerous()) {
281 ShowWarningDialog(); 286 ShowWarningDialog();
282 // Force the shelf to layout again as our size has changed. 287 // Force the shelf to layout again as our size has changed.
283 shelf_->Layout(); 288 shelf_->Layout();
284 SchedulePaint(); 289 SchedulePaint();
285 } else { 290 } else {
286 base::string16 status_text = model_.GetStatusText(); 291 base::string16 status_text = model_.GetStatusText();
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 void DownloadItemView::AnimateStateTransition(State from, State to, 1397 void DownloadItemView::AnimateStateTransition(State from, State to,
1393 gfx::SlideAnimation* animation) { 1398 gfx::SlideAnimation* animation) {
1394 if (from == NORMAL && to == HOT) { 1399 if (from == NORMAL && to == HOT) {
1395 animation->Show(); 1400 animation->Show();
1396 } else if (from == HOT && to == NORMAL) { 1401 } else if (from == HOT && to == NORMAL) {
1397 animation->Hide(); 1402 animation->Hide();
1398 } else if (from != to) { 1403 } else if (from != to) {
1399 animation->Reset((to == HOT) ? 1.0 : 0.0); 1404 animation->Reset((to == HOT) ? 1.0 : 0.0);
1400 } 1405 }
1401 } 1406 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_item_mac.mm ('k') | chrome/browser/ui/views/download/download_shelf_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698