diff options
-rw-r--r-- | ash/metrics/user_metrics_recorder.cc | 8 | ||||
-rw-r--r-- | ash/metrics/user_metrics_recorder.h | 2 | ||||
-rw-r--r-- | ash/root_window_controller.cc | 13 | ||||
-rw-r--r-- | ash/root_window_controller.h | 13 | ||||
-rw-r--r-- | ash/shell.cc | 18 | ||||
-rw-r--r-- | ash/shell.h | 4 | ||||
-rw-r--r-- | ash/wm/panels/panel_window_event_handler.cc | 12 | ||||
-rw-r--r-- | ash/wm/panels/panel_window_event_handler.h | 12 | ||||
-rw-r--r-- | ash/wm/toplevel_window_event_handler.cc | 47 | ||||
-rw-r--r-- | ash/wm/toplevel_window_event_handler.h | 7 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_event_handler.cc | 12 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_event_handler.h | 12 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_event_handler_unittest.cc | 5 | ||||
-rw-r--r-- | ash/wm/workspace_controller.cc | 11 | ||||
-rw-r--r-- | tools/metrics/actions/chromeactions.txt | 2 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.cc | 37 |
16 files changed, 121 insertions, 94 deletions
diff --git a/ash/metrics/user_metrics_recorder.cc b/ash/metrics/user_metrics_recorder.cc index ee7e657..fdf1663 100644 --- a/ash/metrics/user_metrics_recorder.cc +++ b/ash/metrics/user_metrics_recorder.cc @@ -79,14 +79,6 @@ void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action) { case ash::UMA_MOUSE_DOWN: content::RecordAction(content::UserMetricsAction("Mouse_Down")); break; - case ash::UMA_PANEL_MINIMIZE_CAPTION_CLICK: - content::RecordAction( - content::UserMetricsAction("Panel_Minimize_Caption_Click")); - break; - case ash::UMA_PANEL_MINIMIZE_CAPTION_GESTURE: - content::RecordAction( - content::UserMetricsAction("Panel_Minimize_Caption_Gesture")); - break; case ash::UMA_SHELF_ALIGNMENT_SET_BOTTOM: content::RecordAction( content::UserMetricsAction("Shelf_AlignmentSetBottom")); diff --git a/ash/metrics/user_metrics_recorder.h b/ash/metrics/user_metrics_recorder.h index bf82ef5..dc7043b 100644 --- a/ash/metrics/user_metrics_recorder.h +++ b/ash/metrics/user_metrics_recorder.h @@ -25,8 +25,6 @@ enum UserMetricsAction { UMA_LAUNCHER_CLICK_ON_APP, UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON, UMA_MOUSE_DOWN, - UMA_PANEL_MINIMIZE_CAPTION_CLICK, - UMA_PANEL_MINIMIZE_CAPTION_GESTURE, UMA_SHELF_ALIGNMENT_SET_BOTTOM, UMA_SHELF_ALIGNMENT_SET_LEFT, UMA_SHELF_ALIGNMENT_SET_RIGHT, diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index ccc99da7..8332a2a 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -41,6 +41,7 @@ #include "ash/wm/status_area_layout_manager.h" #include "ash/wm/system_background_controller.h" #include "ash/wm/system_modal_container_layout_manager.h" +#include "ash/wm/toplevel_window_event_handler.h" #include "ash/wm/window_properties.h" #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" @@ -732,6 +733,8 @@ void RootWindowController::InitLayoutManagers() { docked_layout_manager_ = new internal::DockedWindowLayoutManager(docked_container, workspace_controller()); + docked_container_handler_.reset( + new ToplevelWindowEventHandler(docked_container)); docked_container->SetLayoutManager(docked_layout_manager_); // Create Panel layout manager @@ -739,9 +742,9 @@ void RootWindowController::InitLayoutManagers() { internal::kShellWindowId_PanelContainer); panel_layout_manager_ = new internal::PanelLayoutManager(panel_container); + panel_container_handler_.reset( + new PanelWindowEventHandler(panel_container)); panel_container->SetLayoutManager(panel_layout_manager_); - panel_container_handler_.reset(new PanelWindowEventHandler); - panel_container->AddPreTargetHandler(panel_container_handler_.get()); } void RootWindowController::InitTouchHuds() { @@ -829,6 +832,8 @@ void RootWindowController::CreateContainersInRootWindow( kShellWindowId_AlwaysOnTopContainer, "AlwaysOnTopContainer", non_lock_screen_containers); + always_on_top_container_handler_.reset( + new ToplevelWindowEventHandler(always_on_top_container)); views::corewm::SetChildWindowVisibilityChangesAnimated( always_on_top_container); SetUsesScreenCoordinates(always_on_top_container); @@ -870,6 +875,8 @@ void RootWindowController::CreateContainersInRootWindow( kShellWindowId_SystemModalContainer, "SystemModalContainer", non_lock_screen_containers); + modal_container_handler_.reset( + new ToplevelWindowEventHandler(modal_container)); modal_container->SetLayoutManager( new SystemModalContainerLayoutManager(modal_container)); views::corewm::SetChildWindowVisibilityChangesAnimated(modal_container); @@ -898,6 +905,8 @@ void RootWindowController::CreateContainersInRootWindow( kShellWindowId_LockSystemModalContainer, "LockSystemModalContainer", lock_screen_containers); + lock_modal_container_handler_.reset( + new ToplevelWindowEventHandler(lock_modal_container)); lock_modal_container->SetLayoutManager( new SystemModalContainerLayoutManager(lock_modal_container)); views::corewm::SetChildWindowVisibilityChangesAnimated(lock_modal_container); diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h index abe6ab9..3d6f2fd 100644 --- a/ash/root_window_controller.h +++ b/ash/root_window_controller.h @@ -42,10 +42,6 @@ namespace keyboard { class KeyboardController; } -namespace ui { -class EventHandler; -} - namespace ash { class ShelfWidget; class SoloWindowTracker; @@ -306,8 +302,13 @@ class ASH_EXPORT RootWindowController : public ShellObserver { TouchHudDebug* touch_hud_debug_; TouchHudProjection* touch_hud_projection_; - // Handles double clicks on the panel window header. - scoped_ptr<ui::EventHandler> panel_container_handler_; + // We need to own event handlers for various containers. + scoped_ptr<ToplevelWindowEventHandler> default_container_handler_; + scoped_ptr<ToplevelWindowEventHandler> always_on_top_container_handler_; + scoped_ptr<ToplevelWindowEventHandler> modal_container_handler_; + scoped_ptr<ToplevelWindowEventHandler> lock_modal_container_handler_; + scoped_ptr<ToplevelWindowEventHandler> panel_container_handler_; + scoped_ptr<ToplevelWindowEventHandler> docked_container_handler_; scoped_ptr<DesktopBackgroundWidgetController> wallpaper_controller_; scoped_ptr<AnimatingDesktopController> animating_wallpaper_controller_; diff --git a/ash/shell.cc b/ash/shell.cc index ded8d84..42c1f77 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -71,7 +71,6 @@ #include "ash/wm/system_gesture_event_filter.h" #include "ash/wm/system_modal_container_event_filter.h" #include "ash/wm/system_modal_container_layout_manager.h" -#include "ash/wm/toplevel_window_event_handler.h" #include "ash/wm/user_activity_detector.h" #include "ash/wm/video_detector.h" #include "ash/wm/window_animations.h" @@ -609,14 +608,12 @@ Shell::~Shell() { RemovePreTargetHandler(user_activity_detector_.get()); RemovePreTargetHandler(overlay_filter_.get()); RemovePreTargetHandler(input_method_filter_.get()); - RemovePreTargetHandler(accelerator_filter_.get()); - RemovePreTargetHandler(event_transformation_handler_.get()); - RemovePreTargetHandler(toplevel_window_event_handler_.get()); - RemovePostTargetHandler(toplevel_window_event_handler_.get()); - RemovePreTargetHandler(system_gesture_filter_.get()); - RemovePreTargetHandler(keyboard_metrics_filter_.get()); if (mouse_cursor_filter_) RemovePreTargetHandler(mouse_cursor_filter_.get()); + RemovePreTargetHandler(system_gesture_filter_.get()); + RemovePreTargetHandler(keyboard_metrics_filter_.get()); + RemovePreTargetHandler(event_transformation_handler_.get()); + RemovePreTargetHandler(accelerator_filter_.get()); // TooltipController is deleted with the Shell so removing its references. RemovePreTargetHandler(tooltip_controller_.get()); @@ -679,7 +676,6 @@ Shell::~Shell() { tooltip_controller_.reset(); event_client_.reset(); nested_dispatcher_controller_.reset(); - toplevel_window_event_handler_.reset(); user_action_client_.reset(); visibility_controller_.reset(); // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be @@ -830,10 +826,6 @@ void Shell::Init() { event_transformation_handler_.reset(new internal::EventTransformationHandler); AddPreTargetHandler(event_transformation_handler_.get()); - toplevel_window_event_handler_.reset(new ToplevelWindowEventHandler); - AddPreTargetHandler(toplevel_window_event_handler_.get()); - AddPostTargetHandler(toplevel_window_event_handler_.get()); - system_gesture_filter_.reset(new internal::SystemGestureEventFilter); AddPreTargetHandler(system_gesture_filter_.get()); @@ -992,8 +984,6 @@ void Shell::InitRootWindow(aura::Window* root_window) { aura::client::SetCursorClient(root_window, &cursor_manager_); aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); aura::client::SetEventClient(root_window, event_client_.get()); - aura::client::SetWindowMoveClient(root_window, - toplevel_window_event_handler_.get()); if (nested_dispatcher_controller_) { aura::client::SetDispatcherClient(root_window, diff --git a/ash/shell.h b/ash/shell.h index 3193306..0b77ad8 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -105,7 +105,6 @@ class StickyKeysController; class SystemTray; class SystemTrayDelegate; class SystemTrayNotifier; -class ToplevelWindowEventHandler; class UserActivityDetector; class UserWallpaperDelegate; class VideoDetector; @@ -656,9 +655,6 @@ class ASH_EXPORT Shell // An event filter for logging keyboard-related metrics. scoped_ptr<internal::KeyboardUMAEventFilter> keyboard_metrics_filter_; - // An event filter which handles moving and resizing windows. - scoped_ptr<ToplevelWindowEventHandler> toplevel_window_event_handler_; - // An event filter which handles system level gestures scoped_ptr<internal::SystemGestureEventFilter> system_gesture_filter_; diff --git a/ash/wm/panels/panel_window_event_handler.cc b/ash/wm/panels/panel_window_event_handler.cc index f056935..cb49469 100644 --- a/ash/wm/panels/panel_window_event_handler.cc +++ b/ash/wm/panels/panel_window_event_handler.cc @@ -4,8 +4,6 @@ #include "ash/wm/panels/panel_window_event_handler.h" -#include "ash/metrics/user_metrics_recorder.h" -#include "ash/shell.h" #include "ash/wm/window_state.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" @@ -15,7 +13,8 @@ namespace ash { namespace internal { -PanelWindowEventHandler::PanelWindowEventHandler() { +PanelWindowEventHandler::PanelWindowEventHandler(aura::Window* owner) + : ToplevelWindowEventHandler(owner) { } PanelWindowEventHandler::~PanelWindowEventHandler() { @@ -28,12 +27,10 @@ void PanelWindowEventHandler::OnMouseEvent(ui::MouseEvent* event) { event->IsOnlyLeftMouseButton() && target->delegate()->GetNonClientComponent(event->location()) == HTCAPTION) { - ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( - ash::UMA_PANEL_MINIMIZE_CAPTION_CLICK); wm::GetWindowState(target)->Minimize(); - event->StopPropagation(); return; } + ToplevelWindowEventHandler::OnMouseEvent(event); } void PanelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) { @@ -42,12 +39,11 @@ void PanelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) { event->details().tap_count() == 2 && target->delegate()->GetNonClientComponent(event->location()) == HTCAPTION) { - ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( - ash::UMA_PANEL_MINIMIZE_CAPTION_GESTURE); wm::GetWindowState(target)->Minimize(); event->StopPropagation(); return; } + ToplevelWindowEventHandler::OnGestureEvent(event); } } // namespace internal diff --git a/ash/wm/panels/panel_window_event_handler.h b/ash/wm/panels/panel_window_event_handler.h index c972ed1..2823b88 100644 --- a/ash/wm/panels/panel_window_event_handler.h +++ b/ash/wm/panels/panel_window_event_handler.h @@ -5,19 +5,23 @@ #ifndef ASH_WM_PANELS_PANEL_WINDOW_EVENT_HANDLER_H_ #define ASH_WM_PANELS_PANEL_WINDOW_EVENT_HANDLER_H_ -#include "ui/events/event_handler.h" +#include "ash/wm/toplevel_window_event_handler.h" + +namespace aura { +class Window; +} namespace ash { namespace internal { // PanelWindowEventHandler minimizes panels when the user double clicks or // double taps on the panel header. -class PanelWindowEventHandler : public ui::EventHandler { +class PanelWindowEventHandler : public ToplevelWindowEventHandler { public: - PanelWindowEventHandler(); + explicit PanelWindowEventHandler(aura::Window* owner); virtual ~PanelWindowEventHandler(); - // ui::EventHandler: + // TopLevelWindowEventHandler: virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; diff --git a/ash/wm/toplevel_window_event_handler.cc b/ash/wm/toplevel_window_event_handler.cc index 8bce4fd..10b2a88 100644 --- a/ash/wm/toplevel_window_event_handler.cc +++ b/ash/wm/toplevel_window_event_handler.cc @@ -72,9 +72,16 @@ class ToplevelWindowEventHandler::ScopedWindowResizer wm::WindowShowType type) OVERRIDE; private: + void AddHandlers(aura::Window* container); + void RemoveHandlers(); + ToplevelWindowEventHandler* handler_; scoped_ptr<WindowResizer> resizer_; + // If not NULL, this is an additional container that the dragged window has + // moved to which ScopedWindowResizer has temporarily added observers on. + aura::Window* target_container_; + DISALLOW_COPY_AND_ASSIGN(ScopedWindowResizer); }; @@ -82,7 +89,8 @@ ToplevelWindowEventHandler::ScopedWindowResizer::ScopedWindowResizer( ToplevelWindowEventHandler* handler, WindowResizer* resizer) : handler_(handler), - resizer_(resizer) { + resizer_(resizer), + target_container_(NULL) { if (resizer_) { resizer_->GetTarget()->AddObserver(this); wm::GetWindowState(resizer_->GetTarget())->AddObserver(this); @@ -90,6 +98,7 @@ ToplevelWindowEventHandler::ScopedWindowResizer::ScopedWindowResizer( } ToplevelWindowEventHandler::ScopedWindowResizer::~ScopedWindowResizer() { + RemoveHandlers(); if (resizer_) { resizer_->GetTarget()->RemoveObserver(this); wm::GetWindowState(resizer_->GetTarget())->RemoveObserver(this); @@ -101,10 +110,12 @@ void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowHierarchyChanging( if (params.receiver != resizer_->GetTarget()) return; wm::WindowState* state = wm::GetWindowState(params.receiver); - if (state->continue_drag_after_reparent()) + if (state->continue_drag_after_reparent()) { state->set_continue_drag_after_reparent(false); - else + AddHandlers(params.new_parent); + } else { handler_->CompleteDrag(DRAG_COMPLETE, 0); + } } void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowShowTypeChanged( @@ -121,14 +132,37 @@ void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowDestroying( handler_->ResizerWindowDestroyed(); } +void ToplevelWindowEventHandler::ScopedWindowResizer::AddHandlers( + aura::Window* container) { + RemoveHandlers(); + if (!handler_->owner()->Contains(container)) { + container->AddPreTargetHandler(handler_); + container->AddPostTargetHandler(handler_); + target_container_ = container; + } +} + +void ToplevelWindowEventHandler::ScopedWindowResizer::RemoveHandlers() { + if (target_container_) { + target_container_->RemovePreTargetHandler(handler_); + target_container_->RemovePostTargetHandler(handler_); + target_container_ = NULL; + } +} + + // ToplevelWindowEventHandler -------------------------------------------------- -ToplevelWindowEventHandler::ToplevelWindowEventHandler() - : in_move_loop_(false), +ToplevelWindowEventHandler::ToplevelWindowEventHandler(aura::Window* owner) + : owner_(owner), + in_move_loop_(false), move_cancelled_(false), in_gesture_drag_(false), destroyed_(NULL) { + aura::client::SetWindowMoveClient(owner, this); Shell::GetInstance()->display_controller()->AddObserver(this); + owner->AddPreTargetHandler(this); + owner->AddPostTargetHandler(this); } ToplevelWindowEventHandler::~ToplevelWindowEventHandler() { @@ -399,10 +433,11 @@ void ToplevelWindowEventHandler::HandleMousePressed( ConvertPointToParent(target, event->location())); CreateScopedWindowResizer(target, location_in_parent, component, aura::client::WINDOW_MOVE_SOURCE_MOUSE); - event->StopPropagation(); } else { window_resizer_.reset(); } + if (WindowResizer::GetBoundsChangeForWindowComponent(component) != 0) + event->StopPropagation(); } void ToplevelWindowEventHandler::HandleMouseReleased( diff --git a/ash/wm/toplevel_window_event_handler.h b/ash/wm/toplevel_window_event_handler.h index 06120ac..98c9296 100644 --- a/ash/wm/toplevel_window_event_handler.h +++ b/ash/wm/toplevel_window_event_handler.h @@ -34,9 +34,11 @@ class ASH_EXPORT ToplevelWindowEventHandler public aura::client::WindowMoveClient, public DisplayController::Observer { public: - ToplevelWindowEventHandler(); + explicit ToplevelWindowEventHandler(aura::Window* owner); virtual ~ToplevelWindowEventHandler(); + const aura::Window* owner() const { return owner_; } + // Overridden from ui::EventHandler: virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; @@ -86,6 +88,9 @@ class ASH_EXPORT ToplevelWindowEventHandler // Invoked from ScopedWindowResizer if the window is destroyed. void ResizerWindowDestroyed(); + // The container which this event handler is handling events on. + aura::Window* owner_; + // Are we running a nested message loop from RunMoveLoop(). bool in_move_loop_; diff --git a/ash/wm/workspace/workspace_event_handler.cc b/ash/wm/workspace/workspace_event_handler.cc index c23c774..bcd7e9e 100644 --- a/ash/wm/workspace/workspace_event_handler.cc +++ b/ash/wm/workspace/workspace_event_handler.cc @@ -54,7 +54,8 @@ void ToggleMaximizedState(wm::WindowState* window_state) { namespace internal { -WorkspaceEventHandler::WorkspaceEventHandler() { +WorkspaceEventHandler::WorkspaceEventHandler(aura::Window* owner) + : ToplevelWindowEventHandler(owner) { } WorkspaceEventHandler::~WorkspaceEventHandler() { @@ -78,8 +79,10 @@ void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) { case ui::ET_MOUSE_PRESSED: { // Maximize behavior is implemented as post-target handling so the target // can cancel it. - if (ui::EventCanceledDefaultHandling(*event)) + if (ui::EventCanceledDefaultHandling(*event)) { + ToplevelWindowEventHandler::OnMouseEvent(event); return; + } wm::WindowState* target_state = wm::GetWindowState(target); if (event->flags() & ui::EF_IS_DOUBLE_CLICK && event->IsOnlyLeftMouseButton() && @@ -88,7 +91,6 @@ void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) { ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( ash::UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK); ToggleMaximizedState(target_state); - event->StopPropagation(); } multi_window_resize_controller_.Hide(); HandleVerticalResizeDoubleClick(target_state, event); @@ -97,6 +99,7 @@ void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) { default: break; } + ToplevelWindowEventHandler::OnMouseEvent(event); } void WorkspaceEventHandler::OnGestureEvent(ui::GestureEvent* event) { @@ -120,6 +123,7 @@ void WorkspaceEventHandler::OnGestureEvent(ui::GestureEvent* event) { TouchUMA::GESTURE_FRAMEVIEW_TAP); } } + ToplevelWindowEventHandler::OnGestureEvent(event); } void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( @@ -150,7 +154,6 @@ void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( target->bounds().width(), work_area.height())); } - event->StopPropagation(); } else if (component == HTLEFT || component == HTRIGHT) { // Don't maximize horizontally if the window has a max width defined. if (max_size.width() != 0) @@ -169,7 +172,6 @@ void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( work_area.width(), target->bounds().height())); } - event->StopPropagation(); } } } diff --git a/ash/wm/workspace/workspace_event_handler.h b/ash/wm/workspace/workspace_event_handler.h index 65a05ac8..e8507e1 100644 --- a/ash/wm/workspace/workspace_event_handler.h +++ b/ash/wm/workspace/workspace_event_handler.h @@ -5,8 +5,12 @@ #ifndef ASH_WM_WORKSPACE_WORKSPACE_EVENT_HANDLER_H_ #define ASH_WM_WORKSPACE_WORKSPACE_EVENT_HANDLER_H_ +#include "ash/wm/toplevel_window_event_handler.h" #include "ash/wm/workspace/multi_window_resize_controller.h" -#include "ui/events/event_handler.h" + +namespace aura { +class Window; +} namespace ash { namespace wm { @@ -17,12 +21,12 @@ namespace internal { class WorkspaceEventHandlerTestHelper; -class WorkspaceEventHandler : public ui::EventHandler { +class WorkspaceEventHandler : public ToplevelWindowEventHandler { public: - WorkspaceEventHandler(); + explicit WorkspaceEventHandler(aura::Window* owner); virtual ~WorkspaceEventHandler(); - // ui::EventHandler: + // Overridden from ToplevelWindowEventHandler: virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc index e6e3449..ffaf210 100644 --- a/ash/wm/workspace/workspace_event_handler_unittest.cc +++ b/ash/wm/workspace/workspace_event_handler_unittest.cc @@ -12,7 +12,6 @@ #include "ash/wm/workspace_controller.h" #include "ash/wm/workspace_controller_test_helper.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/client/window_move_client.h" #include "ui/aura/root_window.h" #include "ui/aura/test/event_generator.h" #include "ui/aura/test/test_window_delegate.h" @@ -339,9 +338,9 @@ TEST_F(WorkspaceEventHandlerTest, DeleteWhileInRunLoop) { scoped_ptr<aura::Window> window(CreateTestWindow(&wd, bounds)); wd.set_window_component(HTCAPTION); - ASSERT_TRUE(aura::client::GetWindowMoveClient(window->GetRootWindow())); + ASSERT_TRUE(aura::client::GetWindowMoveClient(window->parent())); base::MessageLoop::current()->DeleteSoon(FROM_HERE, window.get()); - aura::client::GetWindowMoveClient(window->GetRootWindow()) + aura::client::GetWindowMoveClient(window->parent()) ->RunMoveLoop(window.release(), gfx::Vector2d(), aura::client::WINDOW_MOVE_SOURCE_MOUSE); diff --git a/ash/wm/workspace_controller.cc b/ash/wm/workspace_controller.cc index 54891c7..1b9fd85 100644 --- a/ash/wm/workspace_controller.cc +++ b/ash/wm/workspace_controller.cc @@ -42,18 +42,21 @@ bool IsDockedAreaVisible(const ShelfLayoutManager* shelf) { WorkspaceController::WorkspaceController(aura::Window* viewport) : viewport_(viewport), shelf_(NULL), - event_handler_(new WorkspaceEventHandler), - layout_manager_(new WorkspaceLayoutManager(viewport)) { + event_handler_(new WorkspaceEventHandler(viewport_)) { SetWindowVisibilityAnimationTransition( viewport_, views::corewm::ANIMATE_NONE); + // The layout-manager cannot be created in the initializer list since it + // depends on the window to have been initialized. + layout_manager_ = new WorkspaceLayoutManager(viewport_); viewport_->SetLayoutManager(layout_manager_); - viewport_->AddPreTargetHandler(event_handler_.get()); - viewport_->AddPostTargetHandler(event_handler_.get()); + + viewport_->Show(); } WorkspaceController::~WorkspaceController() { viewport_->SetLayoutManager(NULL); + viewport_->SetEventFilter(NULL); viewport_->RemovePreTargetHandler(event_handler_.get()); viewport_->RemovePostTargetHandler(event_handler_.get()); } diff --git a/tools/metrics/actions/chromeactions.txt b/tools/metrics/actions/chromeactions.txt index 97737a2..5becbed 100644 --- a/tools/metrics/actions/chromeactions.txt +++ b/tools/metrics/actions/chromeactions.txt @@ -1556,8 +1556,6 @@ 0xac722301695b9315 PageLoad 0x4e1f42df4b730437 PageLoadSRP 0x9b869c510c75c582 PageUp -0x728b4afd9c6b68d8 Panel_Minimize_Caption_Click -0x594141373655a8dc Panel_Minimize_Caption_Gesture 0x9ba3ff80fde405cd PasswordManager_Disabled 0x6cc1116fbd900ebf PasswordManager_Enabled 0xc21075c3ec75e973 PasswordManager_RemovePasswordException diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index a5b3f99..1f97ac1 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -648,32 +648,27 @@ Widget::MoveLoopResult NativeWidgetAura::RunMoveLoop( Widget::MoveLoopEscapeBehavior escape_behavior) { // |escape_behavior| is only needed on windows when running the native message // loop. - if (!window_ || !window_->GetRootWindow()) - return Widget::MOVE_LOOP_CANCELED; - aura::client::WindowMoveClient* move_client = - aura::client::GetWindowMoveClient(window_->GetRootWindow()); - if (!move_client) - return Widget::MOVE_LOOP_CANCELED; - - SetCapture(); - aura::client::WindowMoveSource window_move_source = - source == Widget::MOVE_LOOP_SOURCE_MOUSE ? - aura::client::WINDOW_MOVE_SOURCE_MOUSE : - aura::client::WINDOW_MOVE_SOURCE_TOUCH; - if (move_client->RunMoveLoop(window_, drag_offset, window_move_source) == - aura::client::MOVE_SUCCESSFUL) { - return Widget::MOVE_LOOP_SUCCESSFUL; + if (window_ && window_->parent() && + aura::client::GetWindowMoveClient(window_->parent())) { + SetCapture(); + aura::client::WindowMoveSource window_move_source = + source == Widget::MOVE_LOOP_SOURCE_MOUSE ? + aura::client::WINDOW_MOVE_SOURCE_MOUSE : + aura::client::WINDOW_MOVE_SOURCE_TOUCH; + if (aura::client::GetWindowMoveClient(window_->parent())->RunMoveLoop( + window_, drag_offset, window_move_source) == + aura::client::MOVE_SUCCESSFUL) { + return Widget::MOVE_LOOP_SUCCESSFUL; + } } return Widget::MOVE_LOOP_CANCELED; } void NativeWidgetAura::EndMoveLoop() { - if (!window_ || !window_->GetRootWindow()) - return; - aura::client::WindowMoveClient* move_client = - aura::client::GetWindowMoveClient(window_->GetRootWindow()); - if (move_client) - move_client->EndMoveLoop(); + if (window_ && window_->parent() && + aura::client::GetWindowMoveClient(window_->parent())) { + aura::client::GetWindowMoveClient(window_->parent())->EndMoveLoop(); + } } void NativeWidgetAura::SetVisibilityChangedAnimationsEnabled(bool value) { |