| 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/views/view.h" | 5 #include "chrome/views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #ifndef NDEBUG | 9 #ifndef NDEBUG |
| 10 #include <iostream> | 10 #include <iostream> |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 } | 492 } |
| 493 // WARNING: we may have been deleted. | 493 // WARNING: we may have been deleted. |
| 494 return (context_menu_controller != NULL) || possible_drag; | 494 return (context_menu_controller != NULL) || possible_drag; |
| 495 } | 495 } |
| 496 | 496 |
| 497 void View::ProcessMouseReleased(const MouseEvent& e, bool canceled) { | 497 void View::ProcessMouseReleased(const MouseEvent& e, bool canceled) { |
| 498 if (!canceled && context_menu_controller_ && e.IsOnlyRightMouseButton()) { | 498 if (!canceled && context_menu_controller_ && e.IsOnlyRightMouseButton()) { |
| 499 // Assume that if there is a context menu controller we won't be deleted | 499 // Assume that if there is a context menu controller we won't be deleted |
| 500 // from mouse released. | 500 // from mouse released. |
| 501 gfx::Point location(e.location()); | 501 gfx::Point location(e.location()); |
| 502 ConvertPointToScreen(this, &location); | |
| 503 OnMouseReleased(e, canceled); | 502 OnMouseReleased(e, canceled); |
| 504 ShowContextMenu(location.x(), location.y(), true); | 503 if (HitTest(location)) { |
| 504 ConvertPointToScreen(this, &location); |
| 505 ShowContextMenu(location.x(), location.y(), true); |
| 506 } |
| 505 } else { | 507 } else { |
| 506 OnMouseReleased(e, canceled); | 508 OnMouseReleased(e, canceled); |
| 507 } | 509 } |
| 508 // WARNING: we may have been deleted. | 510 // WARNING: we may have been deleted. |
| 509 } | 511 } |
| 510 | 512 |
| 511 void View::AddChildView(View* v) { | 513 void View::AddChildView(View* v) { |
| 512 AddChildView(static_cast<int>(child_views_.size()), v, false); | 514 AddChildView(static_cast<int>(child_views_.size()), v, false); |
| 513 } | 515 } |
| 514 | 516 |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 start_x = start_y = 0; | 1612 start_x = start_y = 0; |
| 1611 } | 1613 } |
| 1612 | 1614 |
| 1613 void View::DragInfo::PossibleDrag(int x, int y) { | 1615 void View::DragInfo::PossibleDrag(int x, int y) { |
| 1614 possible_drag = true; | 1616 possible_drag = true; |
| 1615 start_x = x; | 1617 start_x = x; |
| 1616 start_y = y; | 1618 start_y = y; |
| 1617 } | 1619 } |
| 1618 | 1620 |
| 1619 } // namespace | 1621 } // namespace |
| OLD | NEW |