Commit 057465e7 authored by sadrul@chromium.org's avatar sadrul@chromium.org

ash: Do not close the app-list if user clicked on a menu.

The app-list closes itself when a click happens outside the bounds of
the window. However, if the click happens on a menu that is hanging
outside the window-bounds, then the app-list should not close.

BUG=131282
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10831024

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148554 0039d316-1c4b-4281-b951-d872f2087c98
parent fb27643a
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_delegate.h" #include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h" #include "ash/shell_window_ids.h"
#include "ash/wm/property_util.h"
#include "ash/wm/shelf_layout_manager.h" #include "ash/wm/shelf_layout_manager.h"
#include "ui/app_list/app_list_view.h" #include "ui/app_list/app_list_view.h"
#include "ui/app_list/icon_cache.h" #include "ui/app_list/icon_cache.h"
...@@ -199,7 +200,21 @@ void AppListController::ScheduleAnimation() { ...@@ -199,7 +200,21 @@ void AppListController::ScheduleAnimation() {
layer->SetBounds(target_bounds); layer->SetBounds(target_bounds);
} }
void AppListController::ProcessLocatedEvent(const aura::LocatedEvent& event) { void AppListController::ProcessLocatedEvent(aura::Window* target,
const aura::LocatedEvent& event) {
// If the event happened on a menu, then the event should not close the app
// list.
if (target) {
RootWindowController* root_controller =
GetRootWindowController(target->GetRootWindow());
if (root_controller) {
aura::Window* menu_container = root_controller->GetContainer(
ash::internal::kShellWindowId_MenuContainer);
if (menu_container->Contains(target))
return;
}
}
if (view_ && is_visible_) { if (view_ && is_visible_) {
views::Widget* widget = view_->GetWidget(); views::Widget* widget = view_->GetWidget();
if (!widget->GetNativeView()->GetBoundsInRootWindow().Contains( if (!widget->GetNativeView()->GetBoundsInRootWindow().Contains(
...@@ -225,7 +240,7 @@ bool AppListController::PreHandleKeyEvent(aura::Window* target, ...@@ -225,7 +240,7 @@ bool AppListController::PreHandleKeyEvent(aura::Window* target,
bool AppListController::PreHandleMouseEvent(aura::Window* target, bool AppListController::PreHandleMouseEvent(aura::Window* target,
aura::MouseEvent* event) { aura::MouseEvent* event) {
if (event->type() == ui::ET_MOUSE_PRESSED) if (event->type() == ui::ET_MOUSE_PRESSED)
ProcessLocatedEvent(*event); ProcessLocatedEvent(target, *event);
return false; return false;
} }
...@@ -239,7 +254,7 @@ ui::GestureStatus AppListController::PreHandleGestureEvent( ...@@ -239,7 +254,7 @@ ui::GestureStatus AppListController::PreHandleGestureEvent(
aura::Window* target, aura::Window* target,
aura::GestureEvent* event) { aura::GestureEvent* event) {
if (event->type() == ui::ET_GESTURE_TAP) if (event->type() == ui::ET_GESTURE_TAP)
ProcessLocatedEvent(*event); ProcessLocatedEvent(target, *event);
return ui::GESTURE_STATUS_UNKNOWN; return ui::GESTURE_STATUS_UNKNOWN;
} }
......
...@@ -67,7 +67,8 @@ class AppListController : public aura::EventFilter, ...@@ -67,7 +67,8 @@ class AppListController : public aura::EventFilter,
// Starts show/hide animation. // Starts show/hide animation.
void ScheduleAnimation(); void ScheduleAnimation();
void ProcessLocatedEvent(const aura::LocatedEvent& event); void ProcessLocatedEvent(aura::Window* target,
const aura::LocatedEvent& event);
// Makes app list bubble update its bounds. // Makes app list bubble update its bounds.
void UpdateBounds(); void UpdateBounds();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment