From aa1da928a71b3120283045480b03eb945500f7cf Mon Sep 17 00:00:00 2001 From: "mukai@chromium.org" Date: Wed, 13 Aug 2014 04:04:13 +0000 Subject: Fix the bug of multiple overlays. - keyboard overlay and partial_screenshot overlay should do nothing if there are already overlays. - overlay_event_filter should cancel the existing delegate if another delegate is trying to activate. BUG=341958 R=jamescook@chromium.org TEST=manually Review URL: https://codereview.chromium.org/461093003 Cr-Commit-Position: refs/heads/master@{#289199} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289199 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/test/test_overlay_delegate.cc | 33 +++++++++++++++++++++++++++++++++ ash/test/test_overlay_delegate.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 ash/test/test_overlay_delegate.cc create mode 100644 ash/test/test_overlay_delegate.h (limited to 'ash/test') diff --git a/ash/test/test_overlay_delegate.cc b/ash/test/test_overlay_delegate.cc new file mode 100644 index 0000000..404e909 --- /dev/null +++ b/ash/test/test_overlay_delegate.cc @@ -0,0 +1,33 @@ +// Copyright 2014 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/test/test_overlay_delegate.h" + +namespace ash { +namespace test { + +TestOverlayDelegate::TestOverlayDelegate() + : cancel_count_(0) {} +TestOverlayDelegate::~TestOverlayDelegate() {} + +int TestOverlayDelegate::GetCancelCountAndReset() { + int count = cancel_count_; + cancel_count_ = 0; + return count; +} + +void TestOverlayDelegate::Cancel() { + ++cancel_count_; +} + +bool TestOverlayDelegate::IsCancelingKeyEvent(ui::KeyEvent* event) { + return false; +} + +aura::Window* TestOverlayDelegate::GetWindow() { + return NULL; +} + +} // namespace test +} // namespace ash diff --git a/ash/test/test_overlay_delegate.h b/ash/test/test_overlay_delegate.h new file mode 100644 index 0000000..d43903f --- /dev/null +++ b/ash/test/test_overlay_delegate.h @@ -0,0 +1,34 @@ +// Copyright 2014 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_TEST_TEST_OVERLAY_DELEGATE_H_ +#define ASH_TEST_TEST_OVERLAY_DELEGATE_H_ + +#include "ash/wm/overlay_event_filter.h" + +namespace ash { +namespace test { + +class TestOverlayDelegate : public OverlayEventFilter::Delegate { + public: + TestOverlayDelegate(); + virtual ~TestOverlayDelegate(); + + int GetCancelCountAndReset(); + + private: + // Overridden from OverlayEventFilter::Delegate: + virtual void Cancel() OVERRIDE; + virtual bool IsCancelingKeyEvent(ui::KeyEvent* event) OVERRIDE; + virtual aura::Window* GetWindow() OVERRIDE; + + int cancel_count_; + + DISALLOW_COPY_AND_ASSIGN(TestOverlayDelegate); +}; + +} // namespace test +} // namespace ash + +#endif // ASH_TEST_TEST_OVERLAY_DELEGATE_H_ -- cgit v1.1