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

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

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: Implement a separate callbacks flow for 'shown in shell' event to not mix with 'opened' Created 6 years, 7 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 SetEnabled(false); 328 SetEnabled(false);
329 base::MessageLoop::current()->PostDelayedTask( 329 base::MessageLoop::current()->PostDelayedTask(
330 FROM_HERE, 330 FROM_HERE,
331 base::Bind(&DownloadItemView::Reenable, weak_ptr_factory_.GetWeakPtr()), 331 base::Bind(&DownloadItemView::Reenable, weak_ptr_factory_.GetWeakPtr()),
332 base::TimeDelta::FromMilliseconds(kDisabledOnOpenDuration)); 332 base::TimeDelta::FromMilliseconds(kDisabledOnOpenDuration));
333 333
334 // Notify our parent. 334 // Notify our parent.
335 shelf_->OpenedDownload(this); 335 shelf_->OpenedDownload(this);
336 } 336 }
337 337
338 void DownloadItemView::OnDownloadShown(DownloadItem* download) {
339 shelf_->ShownDownload(this);
340 }
341
338 // View overrides 342 // View overrides
339 343
340 // In dangerous mode we have to layout our buttons. 344 // In dangerous mode we have to layout our buttons.
341 void DownloadItemView::Layout() { 345 void DownloadItemView::Layout() {
342 if (IsShowingWarningDialog()) { 346 if (IsShowingWarningDialog()) {
343 BodyImageSet* body_image_set = 347 BodyImageSet* body_image_set =
344 (mode_ == DANGEROUS_MODE) ? &dangerous_mode_body_image_set_ : 348 (mode_ == DANGEROUS_MODE) ? &dangerous_mode_body_image_set_ :
345 &malicious_mode_body_image_set_; 349 &malicious_mode_body_image_set_;
346 int x = kLeftPadding + body_image_set->top_left->width() + 350 int x = kLeftPadding + body_image_set->top_left->width() +
347 warning_icon_->width() + kLabelPadding; 351 warning_icon_->width() + kLabelPadding;
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 void DownloadItemView::AnimateStateTransition(State from, State to, 1347 void DownloadItemView::AnimateStateTransition(State from, State to,
1344 gfx::SlideAnimation* animation) { 1348 gfx::SlideAnimation* animation) {
1345 if (from == NORMAL && to == HOT) { 1349 if (from == NORMAL && to == HOT) {
1346 animation->Show(); 1350 animation->Show();
1347 } else if (from == HOT && to == NORMAL) { 1351 } else if (from == HOT && to == NORMAL) {
1348 animation->Hide(); 1352 animation->Hide();
1349 } else if (from != to) { 1353 } else if (from != to) {
1350 animation->Reset((to == HOT) ? 1.0 : 0.0); 1354 animation->Reset((to == HOT) ? 1.0 : 0.0);
1351 } 1355 }
1352 } 1356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698