| 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/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/aura/wm_window_aura.h" |
| 11 #include "ash/wm/common/window_positioning_utils.h" |
| 10 #include "ash/wm/common/wm_event.h" | 12 #include "ash/wm/common/wm_event.h" |
| 11 #include "ash/wm/window_state.h" | 13 #include "ash/wm/window_state.h" |
| 12 #include "ash/wm/window_state_aura.h" | 14 #include "ash/wm/window_state_aura.h" |
| 13 #include "ash/wm/window_util.h" | 15 #include "ash/wm/window_util.h" |
| 14 #include "ash/wm/workspace/phantom_window_controller.h" | 16 #include "ash/wm/workspace/phantom_window_controller.h" |
| 15 #include "base/i18n/rtl.h" | 17 #include "base/i18n/rtl.h" |
| 16 #include "ui/gfx/geometry/vector2d.h" | 18 #include "ui/gfx/geometry/vector2d.h" |
| 17 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
| 18 | 20 |
| 19 namespace { | 21 namespace { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 NOTREACHED(); | 218 NOTREACHED(); |
| 217 break; | 219 break; |
| 218 } | 220 } |
| 219 } | 221 } |
| 220 | 222 |
| 221 if (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT) { | 223 if (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT) { |
| 222 aura::Window* window = frame_->GetNativeWindow(); | 224 aura::Window* window = frame_->GetNativeWindow(); |
| 223 if (!phantom_window_controller_.get()) { | 225 if (!phantom_window_controller_.get()) { |
| 224 phantom_window_controller_.reset(new PhantomWindowController(window)); | 226 phantom_window_controller_.reset(new PhantomWindowController(window)); |
| 225 } | 227 } |
| 226 gfx::Rect phantom_bounds_in_parent = (snap_type_ == SNAP_LEFT) ? | 228 gfx::Rect phantom_bounds_in_parent = |
| 227 wm::GetDefaultLeftSnappedWindowBoundsInParent(window) : | 229 (snap_type_ == SNAP_LEFT) |
| 228 wm::GetDefaultRightSnappedWindowBoundsInParent(window); | 230 ? wm::GetDefaultLeftSnappedWindowBoundsInParent( |
| 231 wm::WmWindowAura::Get(window)) |
| 232 : wm::GetDefaultRightSnappedWindowBoundsInParent( |
| 233 wm::WmWindowAura::Get(window)); |
| 229 phantom_window_controller_->Show(ScreenUtil::ConvertRectToScreen( | 234 phantom_window_controller_->Show(ScreenUtil::ConvertRectToScreen( |
| 230 window->parent(), phantom_bounds_in_parent)); | 235 window->parent(), phantom_bounds_in_parent)); |
| 231 } else { | 236 } else { |
| 232 phantom_window_controller_.reset(); | 237 phantom_window_controller_.reset(); |
| 233 } | 238 } |
| 234 } | 239 } |
| 235 | 240 |
| 236 const FrameCaptionButton* FrameSizeButton::GetButtonToHover( | 241 const FrameCaptionButton* FrameSizeButton::GetButtonToHover( |
| 237 const gfx::Point& event_location_in_screen) const { | 242 const gfx::Point& event_location_in_screen) const { |
| 238 const FrameCaptionButton* closest_button = delegate_->GetButtonClosestTo( | 243 const FrameCaptionButton* closest_button = delegate_->GetButtonClosestTo( |
| 239 event_location_in_screen); | 244 event_location_in_screen); |
| 240 if ((closest_button->icon() == CAPTION_BUTTON_ICON_LEFT_SNAPPED || | 245 if ((closest_button->icon() == CAPTION_BUTTON_ICON_LEFT_SNAPPED || |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 void FrameSizeButton::SetButtonsToNormalMode( | 278 void FrameSizeButton::SetButtonsToNormalMode( |
| 274 FrameSizeButtonDelegate::Animate animate) { | 279 FrameSizeButtonDelegate::Animate animate) { |
| 275 in_snap_mode_ = false; | 280 in_snap_mode_ = false; |
| 276 snap_type_ = SNAP_NONE; | 281 snap_type_ = SNAP_NONE; |
| 277 set_buttons_to_snap_mode_timer_.Stop(); | 282 set_buttons_to_snap_mode_timer_.Stop(); |
| 278 delegate_->SetButtonsToNormal(animate); | 283 delegate_->SetButtonsToNormal(animate); |
| 279 phantom_window_controller_.reset(); | 284 phantom_window_controller_.reset(); |
| 280 } | 285 } |
| 281 | 286 |
| 282 } // namespace ash | 287 } // namespace ash |
| OLD | NEW |