190c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org// Copyright (c) 2012 The Chromium Authors. All rights reserved.
290c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org// Use of this source code is governed by a BSD-style license that can be
390c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org// found in the LICENSE file.
490c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org
590c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org#include "ash/wm/system_modal_container_event_filter.h"
690c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org
790c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org#include "ash/wm/system_modal_container_event_filter_delegate.h"
890c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org#include "ui/aura/window.h"
990c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org#include "ui/events/event.h"
1090c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org
1190c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.orgnamespace ash {
1290c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org
13abeb9589ec9e918203249652b15e7af6c9b33e18commit-bot@chromium.orgSystemModalContainerEventFilter::SystemModalContainerEventFilter(
1490c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org    SystemModalContainerEventFilterDelegate* delegate)
1590c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org    : delegate_(delegate) {
1690c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org}
1790c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org
18205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.orgSystemModalContainerEventFilter::~SystemModalContainerEventFilter() {
19205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.org}
20205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.org
2190c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.orgvoid SystemModalContainerEventFilter::OnKeyEvent(ui::KeyEvent* event) {
2285b438dfab7f6ec1fd46dbc19215ccf2171ad6aeepoger  aura::Window* target = static_cast<aura::Window*>(event->target());
2390c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org  if (!delegate_->CanWindowReceiveEvents(target))
2490c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org    event->StopPropagation();
25205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.org}
2690c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org
2785b438dfab7f6ec1fd46dbc19215ccf2171ad6aeepogervoid SystemModalContainerEventFilter::OnMouseEvent(
28205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.org    ui::MouseEvent* event) {
29205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.org  aura::Window* target = static_cast<aura::Window*>(event->target());
3090c0fbd34947b6b644e90c5b2253752035f65b64commit-bot@chromium.org  if (!delegate_->CanWindowReceiveEvents(target))
31205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.org    event->StopPropagation();
32205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.org}
33205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.org
34205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.org}  // namespace ash
35205ce48c38c55ec7527d26042b5cea689369be8bcommit-bot@chromium.org