virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
// WindowStateObserver overrides:
- virtual void OnWindowShowTypeChanged(wm::WindowState* window_state,
- wm::WindowShowType type) OVERRIDE;
+ virtual void OnPreWindowShowTypeChange(wm::WindowState* window_state,
+ wm::WindowShowType type) OVERRIDE;
private:
ToplevelWindowEventHandler* handler_;
handler_->CompleteDrag(DRAG_COMPLETE);
}
-void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowShowTypeChanged(
+void
+ToplevelWindowEventHandler::ScopedWindowResizer::OnPreWindowShowTypeChange(
wm::WindowState* window_state,
wm::WindowShowType old) {
- if (!window_state->IsNormalShowState())
- handler_->CompleteDrag(DRAG_COMPLETE);
+ handler_->CompleteDrag(DRAG_COMPLETE);
}
void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowDestroying(
void ToplevelWindowEventHandler::OnMouseEvent(
ui::MouseEvent* event) {
+ if (event->handled())
+ return;
if ((event->flags() &
(ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)) != 0)
return;
}
void ToplevelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) {
+ if (event->handled())
+ return;
aura::Window* target = static_cast<aura::Window*>(event->target());
if (!target->delegate())
return;
destroyed_ = &destroyed;
base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
- base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
+ base::RunLoop run_loop;
quit_closure_ = run_loop.QuitClosure();
run_loop.Run();
if (destroyed)
void ToplevelWindowEventHandler::HandleMousePressed(
aura::Window* target,
ui::MouseEvent* event) {
- if (event->phase() != ui::EP_PRETARGET)
+ if (event->phase() != ui::EP_PRETARGET || !target->delegate())
return;
// We also update the current window component here because for the
// Completing the drag may result in hiding the window. If this happens
// return true so no other handlers/observers see the event. Otherwise
// they see the event on a hidden window.
- if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED &&
+ if (window_resizer_ &&
+ event->type() == ui::ET_MOUSE_CAPTURE_CHANGED &&
!target->IsVisible()) {
event->StopPropagation();
}
// Shadow effects are applied after target handling. Note that we don't
// respect ER_HANDLED here right now since we have not had a reason to allow
// the target to cancel shadow rendering.
- if (event->phase() != ui::EP_POSTTARGET)
+ if (event->phase() != ui::EP_POSTTARGET || !target->delegate())
return;
// TODO(jamescook): Move the resize cursor update code into here from
case wm::SHOW_TYPE_MINIMIZED:
if (window_state->CanMinimize()) {
window_state->Minimize();
- window_state->set_always_restores_to_restore_bounds(true);
+ window_state->set_unminimize_to_restore_bounds(true);
window_state->SetRestoreBoundsInParent(pre_drag_window_bounds_);
}
break;