summaryrefslogtreecommitdiffstats
path: root/ash/wm
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 16:21:17 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 16:21:17 +0000
commite8de9ea15ead4a310e303b86f785433c837e5910 (patch)
tree400fd599de7f09887fa28695186e102a570b7ca8 /ash/wm
parent5ebd74c164778f697a4deea82bc0fd469c6999fd (diff)
downloadchromium_src-e8de9ea15ead4a310e303b86f785433c837e5910.zip
chromium_src-e8de9ea15ead4a310e303b86f785433c837e5910.tar.gz
chromium_src-e8de9ea15ead4a310e303b86f785433c837e5910.tar.bz2
Remove stops_event_propagation from Window, since it's broken.
Changes it to be implemented by the Aura client, via a new interface EventClient. The client can determine whether or not a given window and its subtree can receive events. I also cleaned up the way screen locking is entered/exited via the delegate, and some stuff in ash/shell. http://crbug.com/119347 TEST=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=128328 Review URL: https://chromiumcodereview.appspot.com/9788001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128503 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm')
-rw-r--r--ash/wm/event_client_impl.cc40
-rw-r--r--ash/wm/event_client_impl.h37
-rw-r--r--ash/wm/system_modal_container_layout_manager_unittest.cc4
-rw-r--r--ash/wm/window_cycle_controller_unittest.cc12
4 files changed, 84 insertions, 9 deletions
diff --git a/ash/wm/event_client_impl.cc b/ash/wm/event_client_impl.cc
new file mode 100644
index 0000000..58b4385
--- /dev/null
+++ b/ash/wm/event_client_impl.cc
@@ -0,0 +1,40 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/wm/event_client_impl.h"
+
+#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
+#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
+
+namespace ash {
+namespace internal {
+
+EventClientImpl::EventClientImpl(aura::RootWindow* root_window)
+ : root_window_(root_window) {
+ aura::client::SetEventClient(root_window_, this);
+}
+
+EventClientImpl::~EventClientImpl() {
+ aura::client::SetEventClient(root_window_, NULL);
+}
+
+bool EventClientImpl::CanProcessEventsWithinSubtree(
+ const aura::Window* window) const {
+ if (Shell::GetInstance()->IsScreenLocked()) {
+ aura::Window* lock_screen_containers =
+ Shell::GetInstance()->GetContainer(
+ kShellWindowId_LockScreenContainersContainer);
+ aura::Window* lock_screen_related_containers =
+ Shell::GetInstance()->GetContainer(
+ kShellWindowId_LockScreenRelatedContainersContainer);
+ return lock_screen_containers->Contains(window) ||
+ lock_screen_related_containers->Contains(window);
+ }
+ return true;
+}
+
+} // namespace internal
+} // namespace ash
diff --git a/ash/wm/event_client_impl.h b/ash/wm/event_client_impl.h
new file mode 100644
index 0000000..7148664
--- /dev/null
+++ b/ash/wm/event_client_impl.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_WM_EVENT_CLIENT_IMPL_H_
+#define ASH_WM_EVENT_CLIENT_IMPL_H_
+#pragma once
+
+#include "ash/ash_export.h"
+#include "ui/aura/client/event_client.h"
+
+namespace aura {
+class RootWindow;
+}
+
+namespace ash {
+namespace internal {
+
+class EventClientImpl : public aura::client::EventClient {
+ public:
+ explicit EventClientImpl(aura::RootWindow* root_window);
+ virtual ~EventClientImpl();
+
+ private:
+ // Overridden from aura::client::EventClient:
+ virtual bool CanProcessEventsWithinSubtree(
+ const aura::Window* window) const OVERRIDE;
+
+ aura::RootWindow* root_window_;
+
+ DISALLOW_COPY_AND_ASSIGN(EventClientImpl);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_WM_EVENT_CLIENT_IMPL_H_
diff --git a/ash/wm/system_modal_container_layout_manager_unittest.cc b/ash/wm/system_modal_container_layout_manager_unittest.cc
index a4814e2..6dbb9cf 100644
--- a/ash/wm/system_modal_container_layout_manager_unittest.cc
+++ b/ash/wm/system_modal_container_layout_manager_unittest.cc
@@ -5,6 +5,7 @@
#include "ash/wm/system_modal_container_layout_manager.h"
#include "ash/shell.h"
+#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/window_util.h"
@@ -227,6 +228,7 @@ TEST_F(SystemModalContainerLayoutManagerTest,
// Create a window in the lock screen container and ensure that it receives
// the mouse event instead of the modal window (crbug.com/110920).
+ Shell::GetInstance()->delegate()->LockScreen();
EventTestWindow* lock_delegate = new EventTestWindow(false);
scoped_ptr<aura::Window> lock(lock_delegate->OpenTestWindow(
Shell::GetInstance()->GetContainer(
@@ -247,6 +249,8 @@ TEST_F(SystemModalContainerLayoutManagerTest,
EXPECT_EQ(1, transient_delegate->mouse_presses());
EXPECT_EQ(1, lock_delegate->mouse_presses());
EXPECT_EQ(1, lock_modal_delegate->mouse_presses());
+
+ Shell::GetInstance()->delegate()->UnlockScreen();
}
} // namespace test
diff --git a/ash/wm/window_cycle_controller_unittest.cc b/ash/wm/window_cycle_controller_unittest.cc
index 499acdc..3aaac40 100644
--- a/ash/wm/window_cycle_controller_unittest.cc
+++ b/ash/wm/window_cycle_controller_unittest.cc
@@ -132,21 +132,15 @@ TEST_F(WindowCycleControllerTest, HandleCycleWindow) {
EXPECT_FALSE(controller->IsCycling());
EXPECT_TRUE(wm::IsActiveWindow(window0.get()));
- // When a screen lock window is visible, cycling window does not take effect.
- aura::Window* lock_screen_container =
- Shell::GetInstance()->GetContainer(
- internal::kShellWindowId_LockScreenContainer);
- scoped_ptr<Window> lock_screen_window(
- CreateTestWindowWithId(-1, lock_screen_container));
- lock_screen_window->Show();
+ // When the screen is locked, cycling window does not take effect.
+ Shell::GetInstance()->delegate()->LockScreen();
EXPECT_TRUE(wm::IsActiveWindow(window0.get()));
controller->HandleCycleWindow(WindowCycleController::FORWARD, false);
EXPECT_TRUE(wm::IsActiveWindow(window0.get()));
controller->HandleCycleWindow(WindowCycleController::BACKWARD, false);
EXPECT_TRUE(wm::IsActiveWindow(window0.get()));
- // Hiding the lock screen is equivalent to not being locked.
- lock_screen_window->Hide();
+ Shell::GetInstance()->delegate()->UnlockScreen();
EXPECT_TRUE(wm::IsActiveWindow(window0.get()));
controller->HandleCycleWindow(WindowCycleController::FORWARD, false);
EXPECT_TRUE(wm::IsActiveWindow(window1.get()));