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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
6 | 6 |
7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 // If we haven't yet been placed in an onscreen view hierarchy, we can't be | 939 // If we haven't yet been placed in an onscreen view hierarchy, we can't be |
940 // hovered. | 940 // hovered. |
941 if (!GetWidget()) | 941 if (!GetWidget()) |
942 return false; | 942 return false; |
943 | 943 |
944 // If mouse events are disabled, then the mouse cursor is invisible and | 944 // If mouse events are disabled, then the mouse cursor is invisible and |
945 // is therefore not hovering over this button. | 945 // is therefore not hovering over this button. |
946 if (!GetWidget()->IsMouseEventsEnabled()) | 946 if (!GetWidget()->IsMouseEventsEnabled()) |
947 return false; | 947 return false; |
948 | 948 |
949 gfx::Point cursor_pos(gfx::Screen::GetScreenFor( | 949 gfx::Point cursor_pos(gfx::Screen::GetScreen()->GetCursorScreenPoint()); |
950 GetWidget()->GetNativeView())->GetCursorScreenPoint()); | |
951 ConvertPointFromScreen(this, &cursor_pos); | 950 ConvertPointFromScreen(this, &cursor_pos); |
952 return HitTestPoint(cursor_pos); | 951 return HitTestPoint(cursor_pos); |
953 } | 952 } |
954 | 953 |
955 bool View::OnMousePressed(const ui::MouseEvent& event) { | 954 bool View::OnMousePressed(const ui::MouseEvent& event) { |
956 return false; | 955 return false; |
957 } | 956 } |
958 | 957 |
959 bool View::OnMouseDragged(const ui::MouseEvent& event) { | 958 bool View::OnMouseDragged(const ui::MouseEvent& event) { |
960 return false; | 959 return false; |
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2404 // Message the RootView to do the drag and drop. That way if we're removed | 2403 // Message the RootView to do the drag and drop. That way if we're removed |
2405 // the RootView can detect it and avoid calling us back. | 2404 // the RootView can detect it and avoid calling us back. |
2406 gfx::Point widget_location(event.location()); | 2405 gfx::Point widget_location(event.location()); |
2407 ConvertPointToWidget(this, &widget_location); | 2406 ConvertPointToWidget(this, &widget_location); |
2408 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2407 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2409 // WARNING: we may have been deleted. | 2408 // WARNING: we may have been deleted. |
2410 return true; | 2409 return true; |
2411 } | 2410 } |
2412 | 2411 |
2413 } // namespace views | 2412 } // namespace views |
OLD | NEW |