diff options
author | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-03 07:51:57 +0000 |
---|---|---|
committer | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-03 07:51:57 +0000 |
commit | 53092f18b6f4dba58dc7587bd888d8032e88df2e (patch) | |
tree | 924f301f7cfffcbc8538a234bb704b89f740d7a8 /ash/wm/drag_window_resizer.cc | |
parent | 65af1a74e2a057fbbd62678f49703165f091edce (diff) | |
download | chromium_src-53092f18b6f4dba58dc7587bd888d8032e88df2e.zip chromium_src-53092f18b6f4dba58dc7587bd888d8032e88df2e.tar.gz chromium_src-53092f18b6f4dba58dc7587bd888d8032e88df2e.tar.bz2 |
Removal of drag window to user tray icon functionality
BUG=348133
TEST=let it run and compiled - removal of code
Review URL: https://codereview.chromium.org/184113005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/drag_window_resizer.cc')
-rw-r--r-- | ash/wm/drag_window_resizer.cc | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/ash/wm/drag_window_resizer.cc b/ash/wm/drag_window_resizer.cc index b5455e7..3e72e4a 100644 --- a/ash/wm/drag_window_resizer.cc +++ b/ash/wm/drag_window_resizer.cc @@ -5,11 +5,8 @@ #include "ash/wm/drag_window_resizer.h" #include "ash/display/mouse_cursor_event_filter.h" -#include "ash/root_window_controller.h" #include "ash/screen_util.h" #include "ash/shell.h" -#include "ash/system/tray/system_tray.h" -#include "ash/system/user/tray_user.h" #include "ash/wm/coordinate_conversion.h" #include "ash/wm/drag_window_controller.h" #include "ash/wm/window_state.h" @@ -33,9 +30,6 @@ namespace { // The maximum opacity of the drag phantom window. const float kMaxOpacity = 0.8f; -// The opacity of the window when dragging it over a user item in the tray. -const float kOpacityWhenDraggedOverUserIcon = 0.4f; - // Returns true if Ash has more than one root window. bool HasSecondaryRootWindow() { return Shell::GetAllRootWindows().size() > 1; @@ -78,13 +72,6 @@ DragWindowResizer* DragWindowResizer::Create( void DragWindowResizer::Drag(const gfx::Point& location, int event_flags) { base::WeakPtr<DragWindowResizer> resizer(weak_ptr_factory_.GetWeakPtr()); - - // If we are on top of a window to desktop transfer button, we move the window - // temporarily back to where it was initially and make it semi-transparent. - GetTarget()->layer()->SetOpacity( - GetTrayUserItemAtPoint(location) ? kOpacityWhenDraggedOverUserIcon : - details().initial_opacity); - next_window_resizer_->Drag(location, event_flags); if (!resizer) @@ -104,9 +91,6 @@ void DragWindowResizer::Drag(const gfx::Point& location, int event_flags) { } void DragWindowResizer::CompleteDrag() { - if (TryDraggingToNewUser()) - return; - next_window_resizer_->CompleteDrag(); GetTarget()->layer()->SetOpacity(details().initial_opacity); @@ -227,61 +211,5 @@ bool DragWindowResizer::ShouldAllowMouseWarp() { GetTarget()->type() == ui::wm::WINDOW_TYPE_PANEL); } -TrayUser* DragWindowResizer::GetTrayUserItemAtPoint( - const gfx::Point& point_in_screen) { - // Unit tests might not have an ash shell. - if (!ash::Shell::GetInstance()) - return NULL; - - // Check that this is a drag move operation from a suitable window. - if (details().window_component != HTCAPTION || - views::corewm::GetTransientParent(GetTarget()) || - (GetTarget()->type() != ui::wm::WINDOW_TYPE_NORMAL && - GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL && - GetTarget()->type() != ui::wm::WINDOW_TYPE_POPUP)) - return NULL; - - // We only allow to drag the window onto a tray of it's own RootWindow. - SystemTray* tray = internal::GetRootWindowController( - GetTarget()->GetRootWindow())->GetSystemTray(); - - // Again - unit tests might not have a tray. - if (!tray) - return NULL; - - const std::vector<internal::TrayUser*> tray_users = tray->GetTrayUserItems(); - if (tray_users.size() <= 1) - return NULL; - - std::vector<internal::TrayUser*>::const_iterator it = tray_users.begin(); - for (; it != tray_users.end(); ++it) { - if ((*it)->CanDropWindowHereToTransferToUser(point_in_screen)) - return *it; - } - return NULL; -} - -bool DragWindowResizer::TryDraggingToNewUser() { - TrayUser* tray_user = GetTrayUserItemAtPoint(last_mouse_location_); - // No need to try dragging if there is no user. - if (!tray_user) - return false; - - // We have to avoid a brief flash caused by the RevertDrag operation. - // To do this, we first set the opacity of our target window to 0, so that no - // matter what the RevertDrag does the window will stay hidden. Then transfer - // the window to the new owner (which will hide it). RevertDrag will then do - // it's thing and return the transparency to its original value. - int old_opacity = GetTarget()->layer()->opacity(); - GetTarget()->layer()->SetOpacity(0); - GetTarget()->SetBounds(details().initial_bounds_in_parent); - if (!tray_user->TransferWindowToUser(GetTarget())) { - GetTarget()->layer()->SetOpacity(old_opacity); - return false; - } - RevertDrag(); - return true; -} - } // namespace internal } // namespace ash |