OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_item_view.h" | 5 #include "chrome/browser/ui/views/download_item_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 } | 525 } |
526 } | 526 } |
527 } else if (ExceededDragThreshold( | 527 } else if (ExceededDragThreshold( |
528 event.location().x() - drag_start_point_.x(), | 528 event.location().x() - drag_start_point_.x(), |
529 event.location().y() - drag_start_point_.y())) { | 529 event.location().y() - drag_start_point_.y())) { |
530 dragging_ = true; | 530 dragging_ = true; |
531 } | 531 } |
532 return true; | 532 return true; |
533 } | 533 } |
534 | 534 |
535 void DownloadItemView::OnMouseReleased(const views::MouseEvent& event, | 535 void DownloadItemView::OnMouseReleased(const views::MouseEvent& event) { |
536 bool canceled) { | |
537 // Mouse should not activate us in dangerous mode. | 536 // Mouse should not activate us in dangerous mode. |
538 if (IsDangerousMode()) | 537 if (IsDangerousMode()) |
539 return; | 538 return; |
540 | 539 |
541 if (dragging_) { | 540 if (dragging_) { |
542 // Starting a drag results in a MouseReleased, we need to ignore it. | 541 // Starting a drag results in a MouseReleased, we need to ignore it. |
543 dragging_ = false; | 542 dragging_ = false; |
544 starting_drag_ = false; | 543 starting_drag_ = false; |
545 return; | 544 return; |
546 } | 545 } |
547 if (event.IsOnlyLeftMouseButton() && | 546 if (event.IsOnlyLeftMouseButton() && |
548 !InDropDownButtonXCoordinateRange(event.x())) { | 547 !InDropDownButtonXCoordinateRange(event.x())) { |
549 OpenDownload(); | 548 OpenDownload(); |
550 } | 549 } |
551 | 550 |
552 SetState(NORMAL, NORMAL); | 551 SetState(NORMAL, NORMAL); |
553 } | 552 } |
554 | 553 |
554 void DownloadItemView::OnMouseCaptureLost() { | |
555 // Mouse should not activate us in dangerous mode. | |
556 if (IsDangerousMode()) | |
557 return; | |
558 | |
559 if (dragging_) { | |
560 // Starting a drag results in a MouseReleased, we need to ignore it. | |
561 dragging_ = false; | |
562 starting_drag_ = false; | |
563 return; | |
564 } | |
565 | |
sadrul
2011/03/19 09:15:30
Code duplication like this needs to be avoided. Se
msw
2011/03/26 00:09:50
Done. In this instance, the |dragging_| block wasn
| |
566 SetState(NORMAL, NORMAL); | |
567 } | |
568 | |
555 void DownloadItemView::OnMouseMoved(const views::MouseEvent& event) { | 569 void DownloadItemView::OnMouseMoved(const views::MouseEvent& event) { |
556 // Mouse should not activate us in dangerous mode. | 570 // Mouse should not activate us in dangerous mode. |
557 if (IsDangerousMode()) | 571 if (IsDangerousMode()) |
558 return; | 572 return; |
559 | 573 |
560 bool on_body = !InDropDownButtonXCoordinateRange(event.x()); | 574 bool on_body = !InDropDownButtonXCoordinateRange(event.x()); |
561 SetState(on_body ? HOT : NORMAL, on_body ? NORMAL : HOT); | 575 SetState(on_body ? HOT : NORMAL, on_body ? NORMAL : HOT); |
562 if (on_body) { | 576 if (on_body) { |
563 body_hover_animation_->Show(); | 577 body_hover_animation_->Show(); |
564 drop_hover_animation_->Hide(); | 578 drop_hover_animation_->Hide(); |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1090 // If the name has changed, notify assistive technology that the name | 1104 // If the name has changed, notify assistive technology that the name |
1091 // has changed so they can announce it immediately. | 1105 // has changed so they can announce it immediately. |
1092 if (new_name != accessible_name_) { | 1106 if (new_name != accessible_name_) { |
1093 accessible_name_ = new_name; | 1107 accessible_name_ = new_name; |
1094 if (GetWidget()) { | 1108 if (GetWidget()) { |
1095 GetWidget()->NotifyAccessibilityEvent( | 1109 GetWidget()->NotifyAccessibilityEvent( |
1096 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); | 1110 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); |
1097 } | 1111 } |
1098 } | 1112 } |
1099 } | 1113 } |
OLD | NEW |