OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame/caption_buttons/frame_size_button.h" | 5 #include "ash/frame/caption_buttons/frame_size_button.h" |
6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" |
7 #include "ash/common/wm/window_positioning_utils.h" | 8 #include "ash/common/wm/window_positioning_utils.h" |
8 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
9 #include "ash/common/wm/wm_event.h" | 10 #include "ash/common/wm/wm_event.h" |
10 #include "ash/common/wm/workspace/phantom_window_controller.h" | 11 #include "ash/common/wm/workspace/phantom_window_controller.h" |
11 #include "ash/metrics/user_metrics_recorder.h" | 12 #include "ash/metrics/user_metrics_recorder.h" |
12 #include "ash/screen_util.h" | 13 #include "ash/screen_util.h" |
13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
14 #include "ash/wm/aura/wm_window_aura.h" | |
15 #include "ash/wm/window_state_aura.h" | 15 #include "ash/wm/window_state_aura.h" |
16 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
17 #include "base/i18n/rtl.h" | 17 #include "base/i18n/rtl.h" |
18 #include "ui/gfx/geometry/vector2d.h" | 18 #include "ui/gfx/geometry/vector2d.h" |
19 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // The default delay between the user pressing the size button and the buttons | 23 // The default delay between the user pressing the size button and the buttons |
24 // adjacent to the size button morphing into buttons for snapping left and | 24 // adjacent to the size button morphing into buttons for snapping left and |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 case CAPTION_BUTTON_ICON_COUNT: | 217 case CAPTION_BUTTON_ICON_COUNT: |
218 NOTREACHED(); | 218 NOTREACHED(); |
219 break; | 219 break; |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 if (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT) { | 223 if (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT) { |
224 aura::Window* window = frame_->GetNativeWindow(); | 224 aura::Window* window = frame_->GetNativeWindow(); |
225 if (!phantom_window_controller_.get()) { | 225 if (!phantom_window_controller_.get()) { |
226 phantom_window_controller_.reset( | 226 phantom_window_controller_.reset( |
227 new PhantomWindowController(wm::WmWindowAura::Get(window))); | 227 new PhantomWindowController(WmWindowAura::Get(window))); |
228 } | 228 } |
229 gfx::Rect phantom_bounds_in_parent = | 229 gfx::Rect phantom_bounds_in_parent = |
230 (snap_type_ == SNAP_LEFT) | 230 (snap_type_ == SNAP_LEFT) |
231 ? wm::GetDefaultLeftSnappedWindowBoundsInParent( | 231 ? wm::GetDefaultLeftSnappedWindowBoundsInParent( |
232 wm::WmWindowAura::Get(window)) | 232 WmWindowAura::Get(window)) |
233 : wm::GetDefaultRightSnappedWindowBoundsInParent( | 233 : wm::GetDefaultRightSnappedWindowBoundsInParent( |
234 wm::WmWindowAura::Get(window)); | 234 WmWindowAura::Get(window)); |
235 phantom_window_controller_->Show(ScreenUtil::ConvertRectToScreen( | 235 phantom_window_controller_->Show(ScreenUtil::ConvertRectToScreen( |
236 window->parent(), phantom_bounds_in_parent)); | 236 window->parent(), phantom_bounds_in_parent)); |
237 } else { | 237 } else { |
238 phantom_window_controller_.reset(); | 238 phantom_window_controller_.reset(); |
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 const FrameCaptionButton* FrameSizeButton::GetButtonToHover( | 242 const FrameCaptionButton* FrameSizeButton::GetButtonToHover( |
243 const gfx::Point& event_location_in_screen) const { | 243 const gfx::Point& event_location_in_screen) const { |
244 const FrameCaptionButton* closest_button = delegate_->GetButtonClosestTo( | 244 const FrameCaptionButton* closest_button = delegate_->GetButtonClosestTo( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 void FrameSizeButton::SetButtonsToNormalMode( | 279 void FrameSizeButton::SetButtonsToNormalMode( |
280 FrameSizeButtonDelegate::Animate animate) { | 280 FrameSizeButtonDelegate::Animate animate) { |
281 in_snap_mode_ = false; | 281 in_snap_mode_ = false; |
282 snap_type_ = SNAP_NONE; | 282 snap_type_ = SNAP_NONE; |
283 set_buttons_to_snap_mode_timer_.Stop(); | 283 set_buttons_to_snap_mode_timer_.Stop(); |
284 delegate_->SetButtonsToNormal(animate); | 284 delegate_->SetButtonsToNormal(animate); |
285 phantom_window_controller_.reset(); | 285 phantom_window_controller_.reset(); |
286 } | 286 } |
287 | 287 |
288 } // namespace ash | 288 } // namespace ash |
OLD | NEW |