diff options
author | robliao@chromium.org <robliao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-05 22:49:31 +0000 |
---|---|---|
committer | robliao@chromium.org <robliao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-05 22:49:31 +0000 |
commit | 7804332edadb7aea91137aeac932d512d9104ebd (patch) | |
tree | 10f00b00a044dffbee15ecf53bff1792a38110e9 | |
parent | b315e837d887efecbefed6ad06ef72e655dc4b99 (diff) | |
download | chromium_src-7804332edadb7aea91137aeac932d512d9104ebd.zip chromium_src-7804332edadb7aea91137aeac932d512d9104ebd.tar.gz chromium_src-7804332edadb7aea91137aeac932d512d9104ebd.tar.bz2 |
Revert of Moving coordinate conversion methods from ash/wm to ui/wm. (https://codereview.chromium.org/425363002/)
Reason for revert:
Build break.
../../ash/display/mouse_cursor_event_filter_ozone.cc:21:7:error: no member named 'ConvertPointToScreen' in namespace 'ash::wm'
wm::ConvertPointToScreen(target, &point_in_screen);
~~~~^
../../ash/display/mouse_cursor_event_filter_ozone.cc:45:7:error: no member named 'ConvertPointFromScreen' in namespace 'ash::wm'
wm::ConvertPointFromScreen(root_at_point, &point_in_root);
~~~~^
../../ash/display/mouse_cursor_event_filter_ozone.cc:86:7:error: no member named 'ConvertPointFromScreen' in namespace 'ash::wm'
wm::ConvertPointFromScreen(dst_root, &point_in_dst_screen);
~~~~^
Original issue's description:
> Moving coordinate conversion methods from ash/wm to ui/wm.
>
> Moving ConvertPointToScreen and ConvertPointFromScreen from ash::wm into
> aura::Window. The suggestion to do this was made here:
> https://codereview.chromium.org/420603011/diff/1/athena/wm/coordinate_conversion.h
>
> BUG=NONE
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=287609
TBR=oshima@chromium.org,ben@chromium.org,sky@chromium.org,mfomitchev@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=NONE
Review URL: https://codereview.chromium.org/445703005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287626 0039d316-1c4b-4281-b951-d872f2087c98
24 files changed, 77 insertions, 120 deletions
diff --git a/ash/autoclick/autoclick_controller.cc b/ash/autoclick/autoclick_controller.cc index 95ab012..e356602 100644 --- a/ash/autoclick/autoclick_controller.cc +++ b/ash/autoclick/autoclick_controller.cc @@ -15,7 +15,6 @@ #include "ui/events/event_processor.h" #include "ui/gfx/point.h" #include "ui/gfx/vector2d.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { @@ -129,8 +128,9 @@ void AutoclickControllerImpl::OnMouseEvent(ui::MouseEvent* event) { mouse_event_flags_ = event->flags(); gfx::Point mouse_location = event->root_location(); - ::wm::ConvertPointToScreen(wm::GetRootWindowAt(mouse_location), - &mouse_location); + ash::wm::ConvertPointToScreen( + wm::GetRootWindowAt(mouse_location), + &mouse_location); // The distance between the mouse location and the anchor location // must exceed a certain threshold to initiate a new autoclick countdown. @@ -185,7 +185,7 @@ void AutoclickControllerImpl::DoAutoclick() { gfx::Point click_location(screen_location); anchor_location_ = click_location; - ::wm::ConvertPointFromScreen(root_window, &click_location); + wm::ConvertPointFromScreen(root_window, &click_location); aura::WindowTreeHost* host = root_window->GetHost(); host->ConvertPointToHost(&click_location); diff --git a/ash/display/event_transformation_handler.cc b/ash/display/event_transformation_handler.cc index e1af21f..62a6fa1 100644 --- a/ash/display/event_transformation_handler.cc +++ b/ash/display/event_transformation_handler.cc @@ -9,6 +9,7 @@ #include "ash/display/display_info.h" #include "ash/display/display_manager.h" #include "ash/shell.h" +#include "ash/wm/coordinate_conversion.h" #include "ash/wm/window_util.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" @@ -16,7 +17,6 @@ #include "ui/events/event.h" #include "ui/gfx/display.h" #include "ui/gfx/screen.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { namespace { @@ -41,7 +41,7 @@ void EventTransformationHandler::OnScrollEvent(ui::ScrollEvent* event) { // the event locations etc. are already in DIP. gfx::Point point_in_screen(event->location()); aura::Window* target = static_cast<aura::Window*>(event->target()); - ::wm::ConvertPointToScreen(target, &point_in_screen); + wm::ConvertPointToScreen(target, &point_in_screen); const gfx::Display& display = Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen); diff --git a/ash/display/mouse_cursor_event_filter.cc b/ash/display/mouse_cursor_event_filter.cc index 14a6913..8da1918 100644 --- a/ash/display/mouse_cursor_event_filter.cc +++ b/ash/display/mouse_cursor_event_filter.cc @@ -14,6 +14,7 @@ #include "ash/root_window_controller.h" #include "ash/screen_util.h" #include "ash/shell.h" +#include "ash/wm/coordinate_conversion.h" #include "ash/wm/window_util.h" #include "ui/aura/env.h" #include "ui/aura/window.h" @@ -24,7 +25,6 @@ #include "ui/events/event.h" #include "ui/events/event_utils.h" #include "ui/gfx/screen.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { namespace { @@ -42,7 +42,7 @@ const int kIndicatorThickness = 1; void ConvertPointFromScreenToNative(const aura::Window* root_window, gfx::Point* point) { - ::wm::ConvertPointFromScreen(root_window, point); + wm::ConvertPointFromScreen(root_window, point); root_window->GetHost()->ConvertPointToNativeScreen(point); } @@ -204,7 +204,7 @@ void MouseCursorEventFilter::OnMouseEvent(ui::MouseEvent* event) { void MouseCursorEventFilter::MoveCursorTo(aura::Window* root, const gfx::Point& point_in_screen) { gfx::Point point_in_native = point_in_screen; - ::wm::ConvertPointFromScreen(root, &point_in_native); + wm::ConvertPointFromScreen(root, &point_in_native); root->GetHost()->ConvertPointToNativeScreen(&point_in_native); // now fit the point inside the native bounds. @@ -234,7 +234,7 @@ bool MouseCursorEventFilter::WarpMouseCursorIfNecessary(ui::MouseEvent* event) { gfx::Point point_in_screen = event->location(); aura::Window* target = static_cast<aura::Window*>(event->target()); - ::wm::ConvertPointToScreen(target, &point_in_screen); + wm::ConvertPointToScreen(target, &point_in_screen); return WarpMouseCursorInNativeCoords(point_in_native, point_in_screen); } @@ -379,7 +379,7 @@ bool MouseCursorEventFilter::WarpMouseCursorIfNecessaryForTest( aura::Window* target_root, const gfx::Point& point_in_screen) { gfx::Point native = point_in_screen; - ::wm::ConvertPointFromScreen(target_root, &native); + wm::ConvertPointFromScreen(target_root, &native); target_root->GetHost()->ConvertPointToNativeScreen(&native); return WarpMouseCursorInNativeCoords(native, point_in_screen); } diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 004298c..2ff526f 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc @@ -7,6 +7,7 @@ #include "ash/drag_drop/drag_drop_tracker.h" #include "ash/drag_drop/drag_image_view.h" #include "ash/shell.h" +#include "ash/wm/coordinate_conversion.h" #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -27,7 +28,6 @@ #include "ui/gfx/rect_conversions.h" #include "ui/views/views_delegate.h" #include "ui/views/widget/native_widget_aura.h" -#include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/public/drag_drop_delegate.h" namespace ash { @@ -198,7 +198,7 @@ int DragDropController::StartDragAndDrop( drag_image_vertical_offset = kTouchDragImageVerticalOffset; } gfx::Point start_location = root_location; - ::wm::ConvertPointToScreen(root_window, &start_location); + ash::wm::ConvertPointToScreen(root_window, &start_location); drag_image_final_bounds_for_cancel_animation_ = gfx::Rect( start_location - provider->GetDragImageOffset(), provider->GetDragImage().size()); @@ -292,8 +292,8 @@ void DragDropController::DragUpdate(aura::Window* target, DCHECK(drag_image_.get()); if (drag_image_->visible()) { gfx::Point root_location_in_screen = event.root_location(); - ::wm::ConvertPointToScreen(target->GetRootWindow(), - &root_location_in_screen); + ash::wm::ConvertPointToScreen(target->GetRootWindow(), + &root_location_in_screen); drag_image_->SetScreenPosition( root_location_in_screen - drag_image_offset_); drag_image_->SetTouchDragOperation(op); diff --git a/ash/drag_drop/drag_drop_tracker.cc b/ash/drag_drop/drag_drop_tracker.cc index c1ec244..193dc62 100644 --- a/ash/drag_drop/drag_drop_tracker.cc +++ b/ash/drag_drop/drag_drop_tracker.cc @@ -12,7 +12,6 @@ #include "ui/aura/window_event_dispatcher.h" #include "ui/events/event.h" #include "ui/gfx/screen.h" -#include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/public/activation_delegate.h" namespace ash { @@ -69,11 +68,12 @@ void DragDropTracker::TakeCapture() { aura::Window* DragDropTracker::GetTarget(const ui::LocatedEvent& event) { DCHECK(capture_window_.get()); gfx::Point location_in_screen = event.location(); - ::wm::ConvertPointToScreen(capture_window_.get(), &location_in_screen); + wm::ConvertPointToScreen(capture_window_.get(), + &location_in_screen); aura::Window* root_window_at_point = wm::GetRootWindowAt(location_in_screen); gfx::Point location_in_root = location_in_screen; - ::wm::ConvertPointFromScreen(root_window_at_point, &location_in_root); + wm::ConvertPointFromScreen(root_window_at_point, &location_in_root); return root_window_at_point->GetEventHandlerForPoint(location_in_root); } @@ -85,7 +85,7 @@ ui::LocatedEvent* DragDropTracker::ConvertEvent( aura::Window::ConvertPointToTarget(capture_window_.get(), target, &target_location); gfx::Point location_in_screen = event.location(); - ::wm::ConvertPointToScreen(capture_window_.get(), &location_in_screen); + ash::wm::ConvertPointToScreen(capture_window_.get(), &location_in_screen); gfx::Point target_root_location = event.root_location(); aura::Window::ConvertPointToTarget( capture_window_->GetRootWindow(), diff --git a/ash/shelf/shelf_bezel_event_filter.cc b/ash/shelf/shelf_bezel_event_filter.cc index 9906602..513a949 100644 --- a/ash/shelf/shelf_bezel_event_filter.cc +++ b/ash/shelf/shelf_bezel_event_filter.cc @@ -6,8 +6,8 @@ #include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" +#include "ash/wm/coordinate_conversion.h" #include "ui/aura/window.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { @@ -26,7 +26,7 @@ void ShelfBezelEventFilter::OnGestureEvent( ui::GestureEvent* event) { gfx::Point point_in_screen(event->location()); aura::Window* target = static_cast<aura::Window*>(event->target()); - ::wm::ConvertPointToScreen(target, &point_in_screen); + wm::ConvertPointToScreen(target, &point_in_screen); gfx::Rect screen = Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen).bounds(); if ((!screen.Contains(point_in_screen) && diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc index 5e4f002..cc0e1ae 100644 --- a/ash/shelf/shelf_view.cc +++ b/ash/shelf/shelf_view.cc @@ -55,7 +55,6 @@ #include "ui/views/view_model.h" #include "ui/views/view_model_utils.h" #include "ui/views/widget/widget.h" -#include "ui/wm/core/coordinate_conversion.h" using gfx::Animation; using views::View; @@ -618,8 +617,9 @@ bool ShelfView::StartDrag(const std::string& app_id, gfx::Point pt = drag_and_drop_view->GetBoundsInScreen().CenterPoint(); views::View::ConvertPointFromScreen(drag_and_drop_view, &pt); gfx::Point point_in_root = location_in_screen_coordinates; - ::wm::ConvertPointFromScreen( - ash::wm::GetRootWindowAt(location_in_screen_coordinates), &point_in_root); + ash::wm::ConvertPointFromScreen( + ash::wm::GetRootWindowAt(location_in_screen_coordinates), + &point_in_root); ui::MouseEvent event(ui::ET_MOUSE_PRESSED, pt, point_in_root, 0, 0); PointerPressedOnButton(drag_and_drop_view, ShelfButtonHost::DRAG_AND_DROP, @@ -640,8 +640,9 @@ bool ShelfView::Drag(const gfx::Point& location_in_screen_coordinates) { model_->ItemIndexByID(drag_and_drop_shelf_id_)); ConvertPointFromScreen(drag_and_drop_view, &pt); gfx::Point point_in_root = location_in_screen_coordinates; - ::wm::ConvertPointFromScreen( - ash::wm::GetRootWindowAt(location_in_screen_coordinates), &point_in_root); + ash::wm::ConvertPointFromScreen( + ash::wm::GetRootWindowAt(location_in_screen_coordinates), + &point_in_root); ui::MouseEvent event(ui::ET_MOUSE_DRAGGED, pt, point_in_root, 0, 0); PointerDraggedOnButton(drag_and_drop_view, ShelfButtonHost::DRAG_AND_DROP, @@ -1009,8 +1010,8 @@ bool ShelfView::HandleRipOffDrag(const ui::LocatedEvent& event) { delegate_->GetAppIDForShelfID(model_->items()[current_index].id); gfx::Point screen_location = event.root_location(); - ::wm::ConvertPointToScreen(GetWidget()->GetNativeWindow()->GetRootWindow(), - &screen_location); + ash::wm::ConvertPointToScreen(GetWidget()->GetNativeWindow()->GetRootWindow(), + &screen_location); // To avoid ugly forwards and backwards flipping we use different constants // for ripping off / re-inserting the items. diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index fc9b076..1d7a8d0 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc @@ -29,6 +29,7 @@ #include "ash/test/shell_test_api.h" #include "ash/test/test_shelf_delegate.h" #include "ash/test/test_shelf_item_delegate.h" +#include "ash/wm/coordinate_conversion.h" #include "base/basictypes.h" #include "base/command_line.h" #include "base/compiler_specific.h" @@ -46,7 +47,6 @@ #include "ui/views/view_model.h" #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { namespace test { @@ -1604,7 +1604,7 @@ TEST_F(ShelfViewTest, CheckRipOffFromLeftShelfAlignmentWithMultiMonitor) { // Fetch the start point of dragging. gfx::Point start_point = button->GetBoundsInScreen().CenterPoint(); - ::wm::ConvertPointFromScreen(second_root, &start_point); + wm::ConvertPointFromScreen(second_root, &start_point); ui::test::EventGenerator generator(second_root, start_point); diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 166e2b7..70db370c 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -16,6 +16,7 @@ #include "ash/test/test_session_state_delegate.h" #include "ash/test/test_shell_delegate.h" #include "ash/test/test_system_tray_delegate.h" +#include "ash/wm/coordinate_conversion.h" #include "ash/wm/window_positioner.h" #include "base/command_line.h" #include "ui/aura/client/aura_constants.h" @@ -31,7 +32,6 @@ #include "ui/gfx/display.h" #include "ui/gfx/point.h" #include "ui/gfx/screen.h" -#include "ui/wm/core/coordinate_conversion.h" #if defined(OS_CHROMEOS) #include "ash/system/chromeos/tray_display.h" @@ -262,7 +262,7 @@ aura::Window* AshTestBase::CreateTestWindowInShellWithDelegateAndType( aura::Window* root = ash::Shell::GetInstance()->display_controller()-> GetRootWindowForDisplayId(display.id()); gfx::Point origin = bounds.origin(); - ::wm::ConvertPointFromScreen(root, &origin); + wm::ConvertPointFromScreen(root, &origin); window->SetBounds(gfx::Rect(origin, bounds.size())); aura::client::ParentWindowWithContext(window, root, bounds); } diff --git a/ash/wm/coordinate_conversion.cc b/ash/wm/coordinate_conversion.cc index 258f976..991e7d4 100644 --- a/ash/wm/coordinate_conversion.cc +++ b/ash/wm/coordinate_conversion.cc @@ -31,5 +31,17 @@ aura::Window* GetRootWindowMatching(const gfx::Rect& rect) { GetRootWindowForDisplayId(display.id()); } +void ConvertPointToScreen(const aura::Window* window, gfx::Point* point) { + CHECK(aura::client::GetScreenPositionClient(window->GetRootWindow())); + aura::client::GetScreenPositionClient(window->GetRootWindow())-> + ConvertPointToScreen(window, point); +} + +void ConvertPointFromScreen(const aura::Window* window, + gfx::Point* point_in_screen) { + aura::client::GetScreenPositionClient(window->GetRootWindow())-> + ConvertPointFromScreen(window, point_in_screen); +} + } // namespace wm } // namespace ash diff --git a/ash/wm/coordinate_conversion.h b/ash/wm/coordinate_conversion.h index aa4a848..539e7c0 100644 --- a/ash/wm/coordinate_conversion.h +++ b/ash/wm/coordinate_conversion.h @@ -28,6 +28,16 @@ ASH_EXPORT aura::Window* GetRootWindowAt(const gfx::Point& point); // the virtual scren coordinates. ASH_EXPORT aura::Window* GetRootWindowMatching(const gfx::Rect& rect); +// Converts the |point| from a given |window|'s coordinates into the screen +// coordinates. +ASH_EXPORT void ConvertPointToScreen(const aura::Window* window, + gfx::Point* point); + +// Converts the |point| from the screen coordinates to a given |window|'s +// coordinates. +ASH_EXPORT void ConvertPointFromScreen(const aura::Window* window, + gfx::Point* point_in_screen); + } // namespace wm } // namespace ash diff --git a/ash/wm/dock/docked_window_layout_manager_unittest.cc b/ash/wm/dock/docked_window_layout_manager_unittest.cc index a8054a3..48db154 100644 --- a/ash/wm/dock/docked_window_layout_manager_unittest.cc +++ b/ash/wm/dock/docked_window_layout_manager_unittest.cc @@ -33,7 +33,6 @@ #include "ui/base/hit_test.h" #include "ui/gfx/screen.h" #include "ui/views/widget/widget.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { @@ -189,7 +188,7 @@ class DockedWindowLayoutManagerTest gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); gfx::Point initial_location_in_screen = initial_location_in_parent_; - ::wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen); + wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen); // Drag the window left or right to the edge (or almost to it). if (edge == DOCKED_EDGE_LEFT) dx += work_area.x() - initial_location_in_screen.x(); diff --git a/ash/wm/dock/docked_window_resizer.cc b/ash/wm/dock/docked_window_resizer.cc index 14b58d4..d6f04d0 100644 --- a/ash/wm/dock/docked_window_resizer.cc +++ b/ash/wm/dock/docked_window_resizer.cc @@ -12,6 +12,7 @@ #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" +#include "ash/wm/coordinate_conversion.h" #include "ash/wm/dock/docked_window_layout_manager.h" #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" @@ -29,7 +30,6 @@ #include "ui/base/ui_base_types.h" #include "ui/gfx/screen.h" #include "ui/views/widget/widget.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { namespace { @@ -61,7 +61,7 @@ DockedWindowResizer::Create(WindowResizer* next_window_resizer, void DockedWindowResizer::Drag(const gfx::Point& location, int event_flags) { last_location_ = location; - ::wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); + wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); if (!did_move_or_resize_) { did_move_or_resize_ = true; StartedDragging(); diff --git a/ash/wm/dock/docked_window_resizer_unittest.cc b/ash/wm/dock/docked_window_resizer_unittest.cc index acb54ff..98c70b0 100644 --- a/ash/wm/dock/docked_window_resizer_unittest.cc +++ b/ash/wm/dock/docked_window_resizer_unittest.cc @@ -18,6 +18,7 @@ #include "ash/test/cursor_manager_test_api.h" #include "ash/test/shell_test_api.h" #include "ash/test/test_shelf_delegate.h" +#include "ash/wm/coordinate_conversion.h" #include "ash/wm/dock/docked_window_layout_manager.h" #include "ash/wm/drag_window_resizer.h" #include "ash/wm/panels/panel_layout_manager.h" @@ -33,7 +34,6 @@ #include "ui/base/ui_base_types.h" #include "ui/events/test/event_generator.h" #include "ui/views/widget/widget.h" -#include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/core/window_util.h" namespace ash { @@ -105,7 +105,7 @@ class DockedWindowResizerTest aura::Window* root = ash::Shell::GetInstance()->display_controller()-> GetRootWindowForDisplayId(display.id()); gfx::Point origin = bounds.origin(); - ::wm::ConvertPointFromScreen(root, &origin); + wm::ConvertPointFromScreen(root, &origin); window->SetBounds(gfx::Rect(origin, bounds.size())); aura::client::ParentWindowWithContext(window, root, bounds); } @@ -216,7 +216,7 @@ class DockedWindowResizerTest gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); gfx::Point initial_location_in_screen = initial_location_in_parent_; - ::wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen); + wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen); // Drag the window left or right to the edge (or almost to it). if (edge == DOCKED_EDGE_LEFT) dx += work_area.x() - initial_location_in_screen.x(); diff --git a/ash/wm/drag_window_resizer.cc b/ash/wm/drag_window_resizer.cc index 214dbc5..15b0584 100644 --- a/ash/wm/drag_window_resizer.cc +++ b/ash/wm/drag_window_resizer.cc @@ -20,7 +20,6 @@ #include "ui/base/hit_test.h" #include "ui/base/ui_base_types.h" #include "ui/gfx/screen.h" -#include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/core/window_util.h" namespace ash { @@ -80,7 +79,7 @@ void DragWindowResizer::Drag(const gfx::Point& location, int event_flags) { // Show a phantom window for dragging in another root window. if (HasSecondaryRootWindow()) { gfx::Point location_in_screen = location; - ::wm::ConvertPointToScreen(GetTarget()->parent(), &location_in_screen); + wm::ConvertPointToScreen(GetTarget()->parent(), &location_in_screen); const bool in_original_root = wm::GetRootWindowAt(location_in_screen) == GetTarget()->GetRootWindow(); UpdateDragWindow(GetTarget()->bounds(), in_original_root); @@ -97,8 +96,8 @@ void DragWindowResizer::CompleteDrag() { // Check if the destination is another display. gfx::Point last_mouse_location_in_screen = last_mouse_location_; - ::wm::ConvertPointToScreen(GetTarget()->parent(), - &last_mouse_location_in_screen); + wm::ConvertPointToScreen(GetTarget()->parent(), + &last_mouse_location_in_screen); gfx::Screen* screen = Shell::GetScreen(); const gfx::Display dst_display = screen->GetDisplayNearestPoint(last_mouse_location_in_screen); diff --git a/ash/wm/gestures/overview_gesture_handler.cc b/ash/wm/gestures/overview_gesture_handler.cc index 87c867b..642f122 100644 --- a/ash/wm/gestures/overview_gesture_handler.cc +++ b/ash/wm/gestures/overview_gesture_handler.cc @@ -6,13 +6,13 @@ #include "ash/metrics/user_metrics_recorder.h" #include "ash/shell.h" +#include "ash/wm/coordinate_conversion.h" #include "ash/wm/overview/window_selector_controller.h" #include "ui/aura/window.h" #include "ui/events/event.h" #include "ui/events/event_constants.h" #include "ui/gfx/rect.h" #include "ui/gfx/screen.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { namespace { @@ -84,7 +84,7 @@ bool OverviewGestureHandler::ProcessGestureEvent( event.details().touch_points() == 1) { gfx::Point point_in_screen(event.location()); aura::Window* target = static_cast<aura::Window*>(event.target()); - ::wm::ConvertPointToScreen(target, &point_in_screen); + wm::ConvertPointToScreen(target, &point_in_screen); in_top_bezel_gesture_ = !Shell::GetScreen()->GetDisplayNearestPoint( point_in_screen).bounds().y() + kTopBezelExtraPixels > point_in_screen.y(); diff --git a/ash/wm/panels/panel_window_resizer.cc b/ash/wm/panels/panel_window_resizer.cc index a57ac59..14632b6 100644 --- a/ash/wm/panels/panel_window_resizer.cc +++ b/ash/wm/panels/panel_window_resizer.cc @@ -11,6 +11,7 @@ #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" +#include "ash/wm/coordinate_conversion.h" #include "ash/wm/panels/panel_layout_manager.h" #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" @@ -25,7 +26,6 @@ #include "ui/base/ui_base_types.h" #include "ui/gfx/screen.h" #include "ui/views/widget/widget.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { @@ -51,7 +51,7 @@ PanelWindowResizer::Create(WindowResizer* next_window_resizer, void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { last_location_ = location; - ::wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); + wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); if (!did_move_or_resize_) { did_move_or_resize_ = true; StartedDragging(); diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc index fbdc29c..08ff0c4 100644 --- a/ash/wm/window_resizer.cc +++ b/ash/wm/window_resizer.cc @@ -20,7 +20,6 @@ #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/gfx/display.h" #include "ui/gfx/screen.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { @@ -205,7 +204,7 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag( // for the current display but the window can move to a different one. aura::Window* parent = GetTarget()->parent(); gfx::Point passed_location_in_screen(passed_location); - ::wm::ConvertPointToScreen(parent, &passed_location_in_screen); + wm::ConvertPointToScreen(parent, &passed_location_in_screen); gfx::Rect near_passed_location(passed_location_in_screen, gfx::Size()); // Use a pointer location (matching the logic in DragWindowResizer) to // calculate the target display after the drag. diff --git a/ash/wm/workspace/multi_window_resize_controller.cc b/ash/wm/workspace/multi_window_resize_controller.cc index 34af90b..d03cfa1 100644 --- a/ash/wm/workspace/multi_window_resize_controller.cc +++ b/ash/wm/workspace/multi_window_resize_controller.cc @@ -7,6 +7,7 @@ #include "ash/screen_util.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" +#include "ash/wm/coordinate_conversion.h" #include "ash/wm/window_animations.h" #include "ash/wm/workspace/workspace_event_handler.h" #include "ash/wm/workspace/workspace_window_resizer.h" @@ -24,7 +25,6 @@ #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" #include "ui/wm/core/compound_event_filter.h" -#include "ui/wm/core/coordinate_conversion.h" using aura::Window; @@ -228,7 +228,7 @@ MultiWindowResizeController::DetermineWindowsFromScreenPoint( aura::Window* window) const { gfx::Point mouse_location( gfx::Screen::GetScreenFor(window)->GetCursorScreenPoint()); - ::wm::ConvertPointFromScreen(window, &mouse_location); + wm::ConvertPointFromScreen(window, &mouse_location); const int component = window->delegate()->GetNonClientComponent(mouse_location); return DetermineWindows(window, component, mouse_location); diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index 395c2ad..c82acf2 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc @@ -15,6 +15,7 @@ #include "ash/screen_util.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" +#include "ash/wm/coordinate_conversion.h" #include "ash/wm/default_window_resizer.h" #include "ash/wm/dock/docked_window_layout_manager.h" #include "ash/wm/dock/docked_window_resizer.h" @@ -36,7 +37,6 @@ #include "ui/compositor/layer.h" #include "ui/gfx/screen.h" #include "ui/gfx/transform.h" -#include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/core/window_util.h" #include "ui/wm/public/window_types.h" @@ -371,7 +371,7 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent, } gfx::Point location_in_screen = location_in_parent; - ::wm::ConvertPointToScreen(GetTarget()->parent(), &location_in_screen); + wm::ConvertPointToScreen(GetTarget()->parent(), &location_in_screen); aura::Window* root = NULL; gfx::Display display = @@ -771,8 +771,8 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow( int sticky_size, gfx::Rect* bounds) { gfx::Point last_mouse_location_in_screen = last_mouse_location_; - ::wm::ConvertPointToScreen(GetTarget()->parent(), - &last_mouse_location_in_screen); + wm::ConvertPointToScreen(GetTarget()->parent(), + &last_mouse_location_in_screen); gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint( last_mouse_location_in_screen); gfx::Rect work_area = diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc index bec49ea..5c1dd07 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc @@ -8,6 +8,7 @@ #include <set> #include "ash/accelerators/accelerator_commands.h" +#include "ash/wm/coordinate_conversion.h" #include "ash/wm/window_state.h" #include "base/auto_reset.h" #include "base/callback.h" @@ -40,7 +41,6 @@ #include "ui/views/focus/view_storage.h" #include "ui/views/widget/root_view.h" #include "ui/views/widget/widget.h" -#include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/core/window_modality_controller.h" using base::UserMetricsAction; @@ -1714,7 +1714,7 @@ gfx::Point TabDragController::GetCursorScreenPoint() { // TODO(tdresser): Switch to using gfx::PointF. See crbug.com/337824. gfx::Point touch_point = gfx::ToFlooredPoint(touch_point_f); DCHECK(got_touch_point); - wm::ConvertPointToScreen(widget_window->GetRootWindow(), &touch_point); + ash::wm::ConvertPointToScreen(widget_window->GetRootWindow(), &touch_point); return touch_point; } diff --git a/ui/wm/core/coordinate_conversion.cc b/ui/wm/core/coordinate_conversion.cc deleted file mode 100644 index 6227b37..0000000 --- a/ui/wm/core/coordinate_conversion.cc +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/wm/core/coordinate_conversion.h" - -#include "ui/aura/client/screen_position_client.h" -#include "ui/gfx/point.h" - -namespace wm { - -void ConvertPointToScreen(const aura::Window* window, gfx::Point* point) { - DCHECK(window); - DCHECK(window->GetRootWindow()); - DCHECK(aura::client::GetScreenPositionClient(window->GetRootWindow())); - aura::client::GetScreenPositionClient(window->GetRootWindow())-> - ConvertPointToScreen(window, point); -} - -void ConvertPointFromScreen(const aura::Window* window, - gfx::Point* point_in_screen) { - DCHECK(window); - DCHECK(window->GetRootWindow()); - DCHECK(aura::client::GetScreenPositionClient(window->GetRootWindow())); - aura::client::GetScreenPositionClient(window->GetRootWindow())-> - ConvertPointFromScreen(window, point_in_screen); -} - -} // namespace wm diff --git a/ui/wm/core/coordinate_conversion.h b/ui/wm/core/coordinate_conversion.h deleted file mode 100644 index acc6a46..0000000 --- a/ui/wm/core/coordinate_conversion.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_WM_CORE_COORDINATE_CONVERSION_H_ -#define UI_WM_CORE_COORDINATE_CONVERSION_H_ - -#include "ui/wm/wm_export.h" - -namespace aura { -class Window; -} // namespace aura - -namespace gfx { -class Point; -} // namespace gfx - -namespace wm { - -// Converts the |point| from a given |window|'s coordinates into the screen -// coordinates. -WM_EXPORT void ConvertPointToScreen(const aura::Window* window, - gfx::Point* point); - -// Converts the |point| from the screen coordinates to a given |window|'s -// coordinates. -WM_EXPORT void ConvertPointFromScreen(const aura::Window* window, - gfx::Point* point_in_screen); - -} // namespace wm - -#endif // UI_WM_CORE_COORDINATE_CONVERSION_H_ diff --git a/ui/wm/wm.gyp b/ui/wm/wm.gyp index cfdc937..6a0c928 100644 --- a/ui/wm/wm.gyp +++ b/ui/wm/wm.gyp @@ -37,8 +37,6 @@ 'core/capture_controller.h', 'core/compound_event_filter.cc', 'core/compound_event_filter.h', - 'core/coordinate_conversion.cc', - 'core/coordinate_conversion.h', 'core/cursor_manager.cc', 'core/cursor_manager.h', 'core/default_activation_client.cc', |