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

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

Issue 2295323002: Download Drop Down Highlight Doesn't Stay (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_item_view_md.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 980
981 // If |is_mouse_gesture| is false, |p| is ignored. The menu is shown aligned 981 // If |is_mouse_gesture| is false, |p| is ignored. The menu is shown aligned
982 // to drop down arrow button. 982 // to drop down arrow button.
983 if (source_type != ui::MENU_SOURCE_MOUSE && 983 if (source_type != ui::MENU_SOURCE_MOUSE &&
984 source_type != ui::MENU_SOURCE_TOUCH) { 984 source_type != ui::MENU_SOURCE_TOUCH) {
985 drop_down_pressed_ = true; 985 drop_down_pressed_ = true;
986 SetState(NORMAL, PUSHED); 986 SetState(NORMAL, PUSHED);
987 point.SetPoint(drop_down_x_left_, box_y_); 987 point.SetPoint(drop_down_x_left_, box_y_);
988 size.SetSize(drop_down_x_right_ - drop_down_x_left_, box_height_); 988 size.SetSize(drop_down_x_right_ - drop_down_x_left_, box_height_);
989 } 989 }
990 // Post a task to release the button. When we call the Run method on the menu
991 // below, it runs an inner message loop that might cause us to be deleted.
992 // Posting a task with a WeakPtr lets us safely handle the button release.
993 base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
994 FROM_HERE, base::Bind(&DownloadItemView::ReleaseDropDown,
995 weak_ptr_factory_.GetWeakPtr()));
996 views::View::ConvertPointToScreen(this, &point); 990 views::View::ConvertPointToScreen(this, &point);
997 991
998 if (!context_menu_.get()) 992 if (!context_menu_.get())
999 context_menu_.reset(new DownloadShelfContextMenuView(download())); 993 context_menu_.reset(new DownloadShelfContextMenuView(download()));
1000 994
1001 context_menu_->Run(GetWidget()->GetTopLevelWidget(), 995 context_menu_->Run(GetWidget()->GetTopLevelWidget(), gfx::Rect(point, size),
1002 gfx::Rect(point, size), source_type); 996 source_type, base::Bind(&DownloadItemView::ReleaseDropDown,
1003 // We could be deleted now. 997 weak_ptr_factory_.GetWeakPtr()));
1004 } 998 }
1005 999
1006 void DownloadItemView::HandlePressEvent(const ui::LocatedEvent& event, 1000 void DownloadItemView::HandlePressEvent(const ui::LocatedEvent& event,
1007 bool active_event) { 1001 bool active_event) {
1008 // The event should not activate us in dangerous mode. 1002 // The event should not activate us in dangerous mode.
1009 if (mode_ == DANGEROUS_MODE) 1003 if (mode_ == DANGEROUS_MODE)
1010 return; 1004 return;
1011 1005
1012 // Stop any completion animation. 1006 // Stop any completion animation.
1013 if (complete_animation_.get() && complete_animation_->is_animating()) 1007 if (complete_animation_.get() && complete_animation_->is_animating())
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 animation->Reset((to == HOT) ? 1.0 : 0.0); 1339 animation->Reset((to == HOT) ? 1.0 : 0.0);
1346 } 1340 }
1347 } 1341 }
1348 1342
1349 void DownloadItemView::ProgressTimerFired() { 1343 void DownloadItemView::ProgressTimerFired() {
1350 // Only repaint for the indeterminate size case. Otherwise, we'll repaint only 1344 // Only repaint for the indeterminate size case. Otherwise, we'll repaint only
1351 // when there's an update notified via OnDownloadUpdated(). 1345 // when there's an update notified via OnDownloadUpdated().
1352 if (model_.PercentComplete() < 0) 1346 if (model_.PercentComplete() < 0)
1353 SchedulePaint(); 1347 SchedulePaint();
1354 } 1348 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_item_view_md.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698