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

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

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « ash/wm/dock/docked_window_resizer_unittest.cc ('k') | ash/wm/event_client_impl.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/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/wm/window_positioning_utils.h" 8 #include "ash/common/wm/window_positioning_utils.h"
9 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/display/mouse_cursor_event_filter.h" 10 #include "ash/display/mouse_cursor_event_filter.h"
(...skipping 22 matching lines...) Expand all
33 if (window_state_) 33 if (window_state_)
34 window_state_->DeleteDragDetails(); 34 window_state_->DeleteDragDetails();
35 Shell* shell = Shell::GetInstance(); 35 Shell* shell = Shell::GetInstance();
36 shell->mouse_cursor_filter()->set_mouse_warp_enabled(true); 36 shell->mouse_cursor_filter()->set_mouse_warp_enabled(true);
37 shell->mouse_cursor_filter()->HideSharedEdgeIndicator(); 37 shell->mouse_cursor_filter()->HideSharedEdgeIndicator();
38 if (instance_ == this) 38 if (instance_ == this)
39 instance_ = NULL; 39 instance_ = NULL;
40 } 40 }
41 41
42 // static 42 // static
43 DragWindowResizer* DragWindowResizer::Create( 43 DragWindowResizer* DragWindowResizer::Create(WindowResizer* next_window_resizer,
44 WindowResizer* next_window_resizer, 44 wm::WindowState* window_state) {
45 wm::WindowState* window_state) {
46 return new DragWindowResizer(next_window_resizer, window_state); 45 return new DragWindowResizer(next_window_resizer, window_state);
47 } 46 }
48 47
49 void DragWindowResizer::Drag(const gfx::Point& location, int event_flags) { 48 void DragWindowResizer::Drag(const gfx::Point& location, int event_flags) {
50 base::WeakPtr<DragWindowResizer> resizer(weak_ptr_factory_.GetWeakPtr()); 49 base::WeakPtr<DragWindowResizer> resizer(weak_ptr_factory_.GetWeakPtr());
51 next_window_resizer_->Drag(location, event_flags); 50 next_window_resizer_->Drag(location, event_flags);
52 51
53 if (!resizer) 52 if (!resizer)
54 return; 53 return;
55 54
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 bounds.set_height(size.height()); 92 bounds.set_height(size.height());
94 93
95 gfx::Rect dst_bounds = 94 gfx::Rect dst_bounds =
96 ScreenUtil::ConvertRectToScreen(GetAuraTarget()->parent(), bounds); 95 ScreenUtil::ConvertRectToScreen(GetAuraTarget()->parent(), bounds);
97 96
98 // Adjust the position so that the cursor is on the window. 97 // Adjust the position so that the cursor is on the window.
99 if (!dst_bounds.Contains(last_mouse_location_in_screen)) { 98 if (!dst_bounds.Contains(last_mouse_location_in_screen)) {
100 if (last_mouse_location_in_screen.x() < dst_bounds.x()) 99 if (last_mouse_location_in_screen.x() < dst_bounds.x())
101 dst_bounds.set_x(last_mouse_location_in_screen.x()); 100 dst_bounds.set_x(last_mouse_location_in_screen.x());
102 else if (last_mouse_location_in_screen.x() > dst_bounds.right()) 101 else if (last_mouse_location_in_screen.x() > dst_bounds.right())
103 dst_bounds.set_x( 102 dst_bounds.set_x(last_mouse_location_in_screen.x() -
104 last_mouse_location_in_screen.x() - dst_bounds.width()); 103 dst_bounds.width());
105 } 104 }
106 ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility( 105 ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility(dst_display.bounds(),
107 dst_display.bounds(), &dst_bounds); 106 &dst_bounds);
108 107
109 GetAuraTarget()->SetBoundsInScreen(dst_bounds, dst_display); 108 GetAuraTarget()->SetBoundsInScreen(dst_bounds, dst_display);
110 } 109 }
111 } 110 }
112 111
113 void DragWindowResizer::RevertDrag() { 112 void DragWindowResizer::RevertDrag() {
114 next_window_resizer_->RevertDrag(); 113 next_window_resizer_->RevertDrag();
115 114
116 drag_window_controller_.reset(); 115 drag_window_controller_.reset();
117 GetAuraTarget()->layer()->SetOpacity(details().initial_opacity); 116 GetAuraTarget()->layer()->SetOpacity(details().initial_opacity);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return details().window_component == HTCAPTION && 164 return details().window_component == HTCAPTION &&
166 !::wm::GetTransientParent(GetAuraTarget()) && 165 !::wm::GetTransientParent(GetAuraTarget()) &&
167 wm::IsWindowUserPositionable(GetAuraTarget()); 166 wm::IsWindowUserPositionable(GetAuraTarget());
168 } 167 }
169 168
170 aura::Window* DragWindowResizer::GetAuraTarget() { 169 aura::Window* DragWindowResizer::GetAuraTarget() {
171 return WmWindowAura::GetAuraWindow(GetTarget()); 170 return WmWindowAura::GetAuraWindow(GetTarget());
172 } 171 }
173 172
174 } // namespace ash 173 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_resizer_unittest.cc ('k') | ash/wm/event_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698