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

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

Issue 127053005: Cleanup: remove Details::window. Use GetTarget() when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months 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 | Annotate | Revision Log
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/drag_window_resizer.h" 5 #include "ash/wm/drag_window_resizer.h"
6 6
7 #include "ash/display/mouse_cursor_event_filter.h" 7 #include "ash/display/mouse_cursor_event_filter.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // exception is window/tab dragging operation. During that operation, 178 // exception is window/tab dragging operation. During that operation,
179 // |mouse_warp_mode_| should be set to WARP_DRAG so that the user could move a 179 // |mouse_warp_mode_| should be set to WARP_DRAG so that the user could move a
180 // window/tab to another display. 180 // window/tab to another display.
181 MouseCursorEventFilter* mouse_cursor_filter = 181 MouseCursorEventFilter* mouse_cursor_filter =
182 Shell::GetInstance()->mouse_cursor_filter(); 182 Shell::GetInstance()->mouse_cursor_filter();
183 mouse_cursor_filter->set_mouse_warp_mode( 183 mouse_cursor_filter->set_mouse_warp_mode(
184 ShouldAllowMouseWarp() ? 184 ShouldAllowMouseWarp() ?
185 MouseCursorEventFilter::WARP_DRAG : MouseCursorEventFilter::WARP_NONE); 185 MouseCursorEventFilter::WARP_DRAG : MouseCursorEventFilter::WARP_NONE);
186 if (ShouldAllowMouseWarp()) { 186 if (ShouldAllowMouseWarp()) {
187 mouse_cursor_filter->ShowSharedEdgeIndicator( 187 mouse_cursor_filter->ShowSharedEdgeIndicator(
188 details.window->GetRootWindow()); 188 details.window()->GetRootWindow());
varkha 2014/01/08 23:46:56 Would GetTarget() be more consistent?
189 } 189 }
190 instance_ = this; 190 instance_ = this;
191 } 191 }
192 192
193 void DragWindowResizer::UpdateDragWindow(const gfx::Rect& bounds, 193 void DragWindowResizer::UpdateDragWindow(const gfx::Rect& bounds,
194 bool in_original_root) { 194 bool in_original_root) {
195 if (details_.window_component != HTCAPTION || !ShouldAllowMouseWarp()) 195 if (details_.window_component != HTCAPTION || !ShouldAllowMouseWarp())
196 return; 196 return;
197 197
198 // It's available. Show a phantom window on the display if needed. 198 // It's available. Show a phantom window on the display if needed.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // Check that this is a drag move operation from a suitable window. 247 // Check that this is a drag move operation from a suitable window.
248 if (details_.window_component != HTCAPTION || 248 if (details_.window_component != HTCAPTION ||
249 views::corewm::GetTransientParent(GetTarget()) || 249 views::corewm::GetTransientParent(GetTarget()) ||
250 (GetTarget()->type() != ui::wm::WINDOW_TYPE_NORMAL && 250 (GetTarget()->type() != ui::wm::WINDOW_TYPE_NORMAL &&
251 GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL && 251 GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL &&
252 GetTarget()->type() != ui::wm::WINDOW_TYPE_POPUP)) 252 GetTarget()->type() != ui::wm::WINDOW_TYPE_POPUP))
253 return NULL; 253 return NULL;
254 254
255 // We only allow to drag the window onto a tray of it's own RootWindow. 255 // We only allow to drag the window onto a tray of it's own RootWindow.
256 SystemTray* tray = internal::GetRootWindowController( 256 SystemTray* tray = internal::GetRootWindowController(
257 details_.window->GetRootWindow())->GetSystemTray(); 257 details_.window()->GetRootWindow())->GetSystemTray();
varkha 2014/01/08 23:46:56 I think GetTarget() here would be more consistent.
258 258
259 // Again - unit tests might not have a tray. 259 // Again - unit tests might not have a tray.
260 if (!tray) 260 if (!tray)
261 return NULL; 261 return NULL;
262 262
263 const std::vector<internal::TrayUser*> tray_users = tray->GetTrayUserItems(); 263 const std::vector<internal::TrayUser*> tray_users = tray->GetTrayUserItems();
264 if (tray_users.size() <= 1) 264 if (tray_users.size() <= 1)
265 return NULL; 265 return NULL;
266 266
267 std::vector<internal::TrayUser*>::const_iterator it = tray_users.begin(); 267 std::vector<internal::TrayUser*>::const_iterator it = tray_users.begin();
(...skipping 11 matching lines...) Expand all
279 return false; 279 return false;
280 280
281 // We have to avoid a brief flash caused by the RevertDrag operation. 281 // We have to avoid a brief flash caused by the RevertDrag operation.
282 // To do this, we first set the opacity of our target window to 0, so that no 282 // To do this, we first set the opacity of our target window to 0, so that no
283 // matter what the RevertDrag does the window will stay hidden. Then transfer 283 // matter what the RevertDrag does the window will stay hidden. Then transfer
284 // the window to the new owner (which will hide it). RevertDrag will then do 284 // the window to the new owner (which will hide it). RevertDrag will then do
285 // it's thing and return the transparency to its original value. 285 // it's thing and return the transparency to its original value.
286 int old_opacity = GetTarget()->layer()->opacity(); 286 int old_opacity = GetTarget()->layer()->opacity();
287 GetTarget()->layer()->SetOpacity(0); 287 GetTarget()->layer()->SetOpacity(0);
288 GetTarget()->SetBounds(details_.initial_bounds_in_parent); 288 GetTarget()->SetBounds(details_.initial_bounds_in_parent);
289 if (!tray_user->TransferWindowToUser(details_.window)) { 289 if (!tray_user->TransferWindowToUser(details_.window())) {
varkha 2014/01/08 23:46:56 Ditto here.
290 GetTarget()->layer()->SetOpacity(old_opacity); 290 GetTarget()->layer()->SetOpacity(old_opacity);
291 return false; 291 return false;
292 } 292 }
293 RevertDrag(); 293 RevertDrag();
294 return true; 294 return true;
295 } 295 }
296 296
297 } // namespace internal 297 } // namespace internal
298 } // namespace ash 298 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698