| OLD | NEW |
| 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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 // Post a task to release the button. When we call the Run method on the menu | 1023 // Post a task to release the button. When we call the Run method on the menu |
| 1024 // below, it runs an inner message loop that might cause us to be deleted. | 1024 // below, it runs an inner message loop that might cause us to be deleted. |
| 1025 // Posting a task with a WeakPtr lets us safely handle the button release. | 1025 // Posting a task with a WeakPtr lets us safely handle the button release. |
| 1026 base::MessageLoop::current()->PostNonNestableTask( | 1026 base::MessageLoop::current()->PostNonNestableTask( |
| 1027 FROM_HERE, | 1027 FROM_HERE, |
| 1028 base::Bind(&DownloadItemView::ReleaseDropDown, | 1028 base::Bind(&DownloadItemView::ReleaseDropDown, |
| 1029 weak_ptr_factory_.GetWeakPtr())); | 1029 weak_ptr_factory_.GetWeakPtr())); |
| 1030 views::View::ConvertPointToScreen(this, &point); | 1030 views::View::ConvertPointToScreen(this, &point); |
| 1031 | 1031 |
| 1032 if (!context_menu_.get()) { | 1032 if (!context_menu_.get()) { |
| 1033 context_menu_.reset( | 1033 context_menu_.reset(new DownloadShelfContextMenuView( |
| 1034 new DownloadShelfContextMenuView(download(), shelf_->GetNavigator())); | 1034 download(), shelf_->browser()->profile())); |
| 1035 } | 1035 } |
| 1036 context_menu_->Run(GetWidget()->GetTopLevelWidget(), | 1036 context_menu_->Run(GetWidget()->GetTopLevelWidget(), |
| 1037 gfx::Rect(point, size), source_type); | 1037 gfx::Rect(point, size), source_type); |
| 1038 // We could be deleted now. | 1038 // We could be deleted now. |
| 1039 } | 1039 } |
| 1040 | 1040 |
| 1041 void DownloadItemView::HandlePressEvent(const ui::LocatedEvent& event, | 1041 void DownloadItemView::HandlePressEvent(const ui::LocatedEvent& event, |
| 1042 bool active_event) { | 1042 bool active_event) { |
| 1043 // The event should not activate us in dangerous mode. | 1043 // The event should not activate us in dangerous mode. |
| 1044 if (mode_ == DANGEROUS_MODE) | 1044 if (mode_ == DANGEROUS_MODE) |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 void DownloadItemView::AnimateStateTransition(State from, State to, | 1392 void DownloadItemView::AnimateStateTransition(State from, State to, |
| 1393 gfx::SlideAnimation* animation) { | 1393 gfx::SlideAnimation* animation) { |
| 1394 if (from == NORMAL && to == HOT) { | 1394 if (from == NORMAL && to == HOT) { |
| 1395 animation->Show(); | 1395 animation->Show(); |
| 1396 } else if (from == HOT && to == NORMAL) { | 1396 } else if (from == HOT && to == NORMAL) { |
| 1397 animation->Hide(); | 1397 animation->Hide(); |
| 1398 } else if (from != to) { | 1398 } else if (from != to) { |
| 1399 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1399 animation->Reset((to == HOT) ? 1.0 : 0.0); |
| 1400 } | 1400 } |
| 1401 } | 1401 } |
| OLD | NEW |