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

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

Issue 115453004: Moves management of transients out of Window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unneeded parens 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
« no previous file with comments | « ash/wm/dock/docked_window_resizer_unittest.cc ('k') | ash/wm/drag_window_resizer_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/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"
11 #include "ash/system/tray/system_tray.h" 11 #include "ash/system/tray/system_tray.h"
12 #include "ash/system/user/tray_user.h" 12 #include "ash/system/user/tray_user.h"
13 #include "ash/wm/coordinate_conversion.h" 13 #include "ash/wm/coordinate_conversion.h"
14 #include "ash/wm/drag_window_controller.h" 14 #include "ash/wm/drag_window_controller.h"
15 #include "ash/wm/window_state.h" 15 #include "ash/wm/window_state.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "ui/aura/client/aura_constants.h" 17 #include "ui/aura/client/aura_constants.h"
18 #include "ui/aura/env.h" 18 #include "ui/aura/env.h"
19 #include "ui/aura/root_window.h" 19 #include "ui/aura/root_window.h"
20 #include "ui/aura/window.h" 20 #include "ui/aura/window.h"
21 #include "ui/aura/window_delegate.h" 21 #include "ui/aura/window_delegate.h"
22 #include "ui/base/hit_test.h" 22 #include "ui/base/hit_test.h"
23 #include "ui/base/ui_base_types.h" 23 #include "ui/base/ui_base_types.h"
24 #include "ui/gfx/screen.h" 24 #include "ui/gfx/screen.h"
25 #include "ui/views/corewm/window_util.h"
25 26
26 namespace ash { 27 namespace ash {
27 namespace internal { 28 namespace internal {
28 29
29 namespace { 30 namespace {
30 31
31 // The maximum opacity of the drag phantom window. 32 // The maximum opacity of the drag phantom window.
32 const float kMaxOpacity = 0.8f; 33 const float kMaxOpacity = 0.8f;
33 34
34 // The opacity of the window when dragging it over a user item in the tray. 35 // The opacity of the window when dragging it over a user item in the tray.
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 drag_window_controller_->SetOpacity(phantom_opacity); 226 drag_window_controller_->SetOpacity(phantom_opacity);
226 GetTarget()->layer()->SetOpacity(window_opacity); 227 GetTarget()->layer()->SetOpacity(window_opacity);
227 } else { 228 } else {
228 drag_window_controller_.reset(); 229 drag_window_controller_.reset();
229 GetTarget()->layer()->SetOpacity(1.0f); 230 GetTarget()->layer()->SetOpacity(1.0f);
230 } 231 }
231 } 232 }
232 233
233 bool DragWindowResizer::ShouldAllowMouseWarp() { 234 bool DragWindowResizer::ShouldAllowMouseWarp() {
234 return (details_.window_component == HTCAPTION) && 235 return (details_.window_component == HTCAPTION) &&
235 !GetTarget()->transient_parent() && 236 !views::corewm::GetTransientParent(GetTarget()) &&
236 (GetTarget()->type() == ui::wm::WINDOW_TYPE_NORMAL || 237 (GetTarget()->type() == ui::wm::WINDOW_TYPE_NORMAL ||
237 GetTarget()->type() == ui::wm::WINDOW_TYPE_PANEL); 238 GetTarget()->type() == ui::wm::WINDOW_TYPE_PANEL);
238 } 239 }
239 240
240 TrayUser* DragWindowResizer::GetTrayUserItemAtPoint( 241 TrayUser* DragWindowResizer::GetTrayUserItemAtPoint(
241 const gfx::Point& point_in_screen) { 242 const gfx::Point& point_in_screen) {
242 // Unit tests might not have an ash shell. 243 // Unit tests might not have an ash shell.
243 if (!ash::Shell::GetInstance()) 244 if (!ash::Shell::GetInstance())
244 return NULL; 245 return NULL;
245 246
246 // 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.
247 if (details_.window_component != HTCAPTION || 248 if (details_.window_component != HTCAPTION ||
248 GetTarget()->transient_parent() || 249 views::corewm::GetTransientParent(GetTarget()) ||
249 (GetTarget()->type() != ui::wm::WINDOW_TYPE_NORMAL && 250 (GetTarget()->type() != ui::wm::WINDOW_TYPE_NORMAL &&
250 GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL && 251 GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL &&
251 GetTarget()->type() != ui::wm::WINDOW_TYPE_POPUP)) 252 GetTarget()->type() != ui::wm::WINDOW_TYPE_POPUP))
252 return NULL; 253 return NULL;
253 254
254 // 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.
255 SystemTray* tray = internal::GetRootWindowController( 256 SystemTray* tray = internal::GetRootWindowController(
256 details_.window->GetRootWindow())->GetSystemTray(); 257 details_.window->GetRootWindow())->GetSystemTray();
257 258
258 // Again - unit tests might not have a tray. 259 // Again - unit tests might not have a tray.
(...skipping 29 matching lines...) Expand all
288 if (!tray_user->TransferWindowToUser(details_.window)) { 289 if (!tray_user->TransferWindowToUser(details_.window)) {
289 GetTarget()->layer()->SetOpacity(old_opacity); 290 GetTarget()->layer()->SetOpacity(old_opacity);
290 return false; 291 return false;
291 } 292 }
292 RevertDrag(); 293 RevertDrag();
293 return true; 294 return true;
294 } 295 }
295 296
296 } // namespace internal 297 } // namespace internal
297 } // namespace ash 298 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_resizer_unittest.cc ('k') | ash/wm/drag_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698