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

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

Issue 6685069: Disambiguate OnMouseCaptureLost from OnMouseReleased, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments, fix tests, cleanup, etc. Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 } 532 }
533 } 533 }
534 } else if (ExceededDragThreshold( 534 } else if (ExceededDragThreshold(
535 event.location().x() - drag_start_point_.x(), 535 event.location().x() - drag_start_point_.x(),
536 event.location().y() - drag_start_point_.y())) { 536 event.location().y() - drag_start_point_.y())) {
537 dragging_ = true; 537 dragging_ = true;
538 } 538 }
539 return true; 539 return true;
540 } 540 }
541 541
542 void DownloadItemView::OnMouseReleased(const views::MouseEvent& event, 542 void DownloadItemView::OnMouseReleased(const views::MouseEvent& event) {
543 bool canceled) {
544 // Mouse should not activate us in dangerous mode. 543 // Mouse should not activate us in dangerous mode.
545 if (IsDangerousMode()) 544 if (IsDangerousMode())
546 return; 545 return;
547 546
548 if (dragging_) {
549 // Starting a drag results in a MouseReleased, we need to ignore it.
550 dragging_ = false;
551 starting_drag_ = false;
552 return;
553 }
554 if (event.IsOnlyLeftMouseButton() && 547 if (event.IsOnlyLeftMouseButton() &&
555 !InDropDownButtonXCoordinateRange(event.x())) { 548 !InDropDownButtonXCoordinateRange(event.x())) {
556 OpenDownload(); 549 OpenDownload();
557 } 550 }
558 551
559 SetState(NORMAL, NORMAL); 552 SetState(NORMAL, NORMAL);
560 } 553 }
561 554
555 void DownloadItemView::OnMouseCaptureLost() {
556 // Mouse should not activate us in dangerous mode.
557 if (IsDangerousMode())
558 return;
559
560 if (dragging_) {
561 // Starting a drag results in a MouseCaptureLost.
562 dragging_ = false;
563 starting_drag_ = false;
564 } else {
565 SetState(NORMAL, NORMAL);
566 }
567 }
568
562 void DownloadItemView::OnMouseMoved(const views::MouseEvent& event) { 569 void DownloadItemView::OnMouseMoved(const views::MouseEvent& event) {
563 // Mouse should not activate us in dangerous mode. 570 // Mouse should not activate us in dangerous mode.
564 if (IsDangerousMode()) 571 if (IsDangerousMode())
565 return; 572 return;
566 573
567 bool on_body = !InDropDownButtonXCoordinateRange(event.x()); 574 bool on_body = !InDropDownButtonXCoordinateRange(event.x());
568 SetState(on_body ? HOT : NORMAL, on_body ? NORMAL : HOT); 575 SetState(on_body ? HOT : NORMAL, on_body ? NORMAL : HOT);
569 if (on_body) { 576 if (on_body) {
570 body_hover_animation_->Show(); 577 body_hover_animation_->Show();
571 drop_hover_animation_->Hide(); 578 drop_hover_animation_->Hide();
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 // If the name has changed, notify assistive technology that the name 1106 // If the name has changed, notify assistive technology that the name
1100 // has changed so they can announce it immediately. 1107 // has changed so they can announce it immediately.
1101 if (new_name != accessible_name_) { 1108 if (new_name != accessible_name_) {
1102 accessible_name_ = new_name; 1109 accessible_name_ = new_name;
1103 if (GetWidget()) { 1110 if (GetWidget()) {
1104 GetWidget()->NotifyAccessibilityEvent( 1111 GetWidget()->NotifyAccessibilityEvent(
1105 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); 1112 this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true);
1106 } 1113 }
1107 } 1114 }
1108 } 1115 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/download_item_view.h ('k') | chrome/browser/ui/views/location_bar/click_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698