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

Side by Side Diff: ash/wm/toplevel_window_event_handler.cc

Issue 2550533002: Revert of Reenable Tabdragging tests failing because of IsWindowPositionManaged() (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | ash/wm/toplevel_window_event_handler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ash/wm/toplevel_window_event_handler.h" 5 #include "ash/wm/toplevel_window_event_handler.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/wm/window_state.h"
9 #include "ash/shell.h" 8 #include "ash/shell.h"
10 #include "ash/wm/window_state_aura.h"
11 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 10 #include "base/run_loop.h"
13 #include "ui/aura/client/cursor_client.h" 11 #include "ui/aura/client/cursor_client.h"
14 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
15 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
16 #include "ui/aura/window_event_dispatcher.h" 14 #include "ui/aura/window_event_dispatcher.h"
17 #include "ui/aura/window_tree_host.h" 15 #include "ui/aura/window_tree_host.h"
18 #include "ui/base/cursor/cursor.h" 16 #include "ui/base/cursor/cursor.h"
19 #include "ui/base/hit_test.h" 17 #include "ui/base/hit_test.h"
20 #include "ui/events/event.h" 18 #include "ui/events/event.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 weak_factory_.GetWeakPtr(), &result, &run_loop))) { 80 weak_factory_.GetWeakPtr(), &result, &run_loop))) {
83 return aura::client::MOVE_CANCELED; 81 return aura::client::MOVE_CANCELED;
84 } 82 }
85 83
86 in_move_loop_ = true; 84 in_move_loop_ = true;
87 base::WeakPtr<ToplevelWindowEventHandler> weak_ptr( 85 base::WeakPtr<ToplevelWindowEventHandler> weak_ptr(
88 weak_factory_.GetWeakPtr()); 86 weak_factory_.GetWeakPtr());
89 base::MessageLoop* loop = base::MessageLoop::current(); 87 base::MessageLoop* loop = base::MessageLoop::current();
90 base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop); 88 base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
91 89
92 // Disable window position auto management while dragging and restore it
93 // aftrewards.
94 wm::WindowState* window_state = wm::GetWindowState(source);
95 const bool window_position_managed = window_state->window_position_managed();
96 window_state->set_window_position_managed(false);
97
98 run_loop.Run(); 90 run_loop.Run();
99 91
100 if (!weak_ptr) 92 if (!weak_ptr)
101 return aura::client::MOVE_CANCELED; 93 return aura::client::MOVE_CANCELED;
102 94
103 window_state->set_window_position_managed(window_position_managed);
104
105 in_move_loop_ = false; 95 in_move_loop_ = false;
106 return result == wm::WmToplevelWindowEventHandler::DragResult::SUCCESS 96 return result == wm::WmToplevelWindowEventHandler::DragResult::SUCCESS
107 ? aura::client::MOVE_SUCCESSFUL 97 ? aura::client::MOVE_SUCCESSFUL
108 : aura::client::MOVE_CANCELED; 98 : aura::client::MOVE_CANCELED;
109 } 99 }
110 100
111 void ToplevelWindowEventHandler::EndMoveLoop() { 101 void ToplevelWindowEventHandler::EndMoveLoop() {
112 if (in_move_loop_) 102 if (in_move_loop_)
113 wm_toplevel_window_event_handler_.RevertDrag(); 103 wm_toplevel_window_event_handler_.RevertDrag();
114 } 104 }
115 105
116 void ToplevelWindowEventHandler::OnDragCompleted( 106 void ToplevelWindowEventHandler::OnDragCompleted(
117 wm::WmToplevelWindowEventHandler::DragResult* result_return_value, 107 wm::WmToplevelWindowEventHandler::DragResult* result_return_value,
118 base::RunLoop* run_loop, 108 base::RunLoop* run_loop,
119 wm::WmToplevelWindowEventHandler::DragResult result) { 109 wm::WmToplevelWindowEventHandler::DragResult result) {
120 *result_return_value = result; 110 *result_return_value = result;
121 run_loop->Quit(); 111 run_loop->Quit();
122 } 112 }
123 113
124 } // namespace ash 114 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/toplevel_window_event_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698