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

Side by Side Diff: chrome/browser/ui/views/download/download_item_view_md.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
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_md.h" 5 #include "chrome/browser/ui/views/download/download_item_view_md.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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 // We're about to show the menu from a mouse press. By showing from the 820 // We're about to show the menu from a mouse press. By showing from the
821 // mouse press event we block RootView in mouse dispatching. This also 821 // mouse press event we block RootView in mouse dispatching. This also
822 // appears to cause RootView to get a mouse pressed BEFORE the mouse 822 // appears to cause RootView to get a mouse pressed BEFORE the mouse
823 // release is seen, which means RootView sends us another mouse press no 823 // release is seen, which means RootView sends us another mouse press no
824 // matter where the user pressed. To force RootView to recalculate the 824 // matter where the user pressed. To force RootView to recalculate the
825 // mouse target during the mouse press we explicitly set the mouse handler 825 // mouse target during the mouse press we explicitly set the mouse handler
826 // to NULL. 826 // to NULL.
827 static_cast<views::internal::RootView*>(GetWidget()->GetRootView()) 827 static_cast<views::internal::RootView*>(GetWidget()->GetRootView())
828 ->SetMouseHandler(NULL); 828 ->SetMouseHandler(NULL);
829 829
830 // Post a task to release the button. When we call the Run method on the menu
831 // below, it runs an inner message loop that might cause us to be deleted.
832 // Posting a task with a WeakPtr lets us safely handle the button release.
833 base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
834 FROM_HERE, base::Bind(&DownloadItemViewMd::ReleaseDropdown,
835 weak_ptr_factory_.GetWeakPtr()));
836
837 if (!context_menu_.get()) 830 if (!context_menu_.get())
838 context_menu_.reset(new DownloadShelfContextMenuView(download())); 831 context_menu_.reset(new DownloadShelfContextMenuView(download()));
839 context_menu_->Run(GetWidget()->GetTopLevelWidget(), rect, source_type); 832 context_menu_->Run(GetWidget()->GetTopLevelWidget(), rect, source_type,
840 // We could be deleted now. 833 base::Bind(&DownloadItemViewMd::ReleaseDropdown,
834 weak_ptr_factory_.GetWeakPtr()));
841 } 835 }
842 836
843 void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event, 837 void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event,
844 bool active_event) { 838 bool active_event) {
845 // The event should not activate us in dangerous/malicious mode. 839 // The event should not activate us in dangerous/malicious mode.
846 if (IsShowingWarningDialog()) 840 if (IsShowingWarningDialog())
847 return; 841 return;
848 842
849 // Stop any completion animation. 843 // Stop any completion animation.
850 if (complete_animation_.get() && complete_animation_->is_animating()) 844 if (complete_animation_.get() && complete_animation_->is_animating())
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 SchedulePaint(); 1120 SchedulePaint();
1127 } 1121 }
1128 1122
1129 SkColor DownloadItemViewMd::GetTextColor() const { 1123 SkColor DownloadItemViewMd::GetTextColor() const {
1130 return GetTextColorForThemeProvider(GetThemeProvider()); 1124 return GetTextColorForThemeProvider(GetThemeProvider());
1131 } 1125 }
1132 1126
1133 SkColor DownloadItemViewMd::GetDimmedTextColor() const { 1127 SkColor DownloadItemViewMd::GetDimmedTextColor() const {
1134 return SkColorSetA(GetTextColor(), 0xC7); 1128 return SkColorSetA(GetTextColor(), 0xC7);
1135 } 1129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698