| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/download_item_view.h" | 5 #include "chrome/browser/views/download_item_view.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #include "app/gfx/text_elider.h" | 10 #include "app/gfx/text_elider.h" |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 point.set_y(height()); | 813 point.set_y(height()); |
| 814 if (UILayoutIsRightToLeft()) | 814 if (UILayoutIsRightToLeft()) |
| 815 point.set_x(drop_down_x_right_); | 815 point.set_x(drop_down_x_right_); |
| 816 else | 816 else |
| 817 point.set_x(drop_down_x_left_); | 817 point.set_x(drop_down_x_left_); |
| 818 | 818 |
| 819 views::View::ConvertPointToScreen(this, &point); | 819 views::View::ConvertPointToScreen(this, &point); |
| 820 DownloadShelfContextMenuWin menu(model_.get(), | 820 DownloadShelfContextMenuWin menu(model_.get(), |
| 821 GetWidget()->GetNativeView(), | 821 GetWidget()->GetNativeView(), |
| 822 point); | 822 point); |
| 823 drop_down_pressed_ = false; | 823 // If the menu action was to remove the download, this view will also be |
| 824 // Showing the menu blocks. Here we revert the state. | 824 // invalid so we must not access 'this' in this case. |
| 825 SetState(NORMAL, NORMAL); | 825 if (menu.download()) { |
| 826 drop_down_pressed_ = false; |
| 827 // Showing the menu blocks. Here we revert the state. |
| 828 SetState(NORMAL, NORMAL); |
| 829 } |
| 826 } | 830 } |
| 827 return true; | 831 return true; |
| 828 } | 832 } |
| 829 | 833 |
| 830 void DownloadItemView::OnMouseMoved(const views::MouseEvent& event) { | 834 void DownloadItemView::OnMouseMoved(const views::MouseEvent& event) { |
| 831 // Mouse should not activate us in dangerous mode. | 835 // Mouse should not activate us in dangerous mode. |
| 832 if (IsDangerousMode()) | 836 if (IsDangerousMode()) |
| 833 return; | 837 return; |
| 834 | 838 |
| 835 bool on_body = !InDropDownButtonXCoordinateRange(event.x()); | 839 bool on_body = !InDropDownButtonXCoordinateRange(event.x()); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 void DownloadItemView::Reenable() { | 994 void DownloadItemView::Reenable() { |
| 991 disabled_while_opening_ = false; | 995 disabled_while_opening_ = false; |
| 992 SetEnabled(true); // Triggers a repaint. | 996 SetEnabled(true); // Triggers a repaint. |
| 993 } | 997 } |
| 994 | 998 |
| 995 bool DownloadItemView::InDropDownButtonXCoordinateRange(int x) { | 999 bool DownloadItemView::InDropDownButtonXCoordinateRange(int x) { |
| 996 if (x > drop_down_x_left_ && x < drop_down_x_right_) | 1000 if (x > drop_down_x_left_ && x < drop_down_x_right_) |
| 997 return true; | 1001 return true; |
| 998 return false; | 1002 return false; |
| 999 } | 1003 } |
| OLD | NEW |