Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Unified Diff: ui/aura/test/event_generator.cc

Issue 406413004: Cleanups for aura/test/event_generator.h (resolve TODOs) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase at r285842 Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/test/event_generator.h ('k') | ui/aura/test/event_generator_delegate_aura.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/event_generator.cc
diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc
deleted file mode 100644
index e899afdcdde7aebdf7425c6f63f91e544048af8e..0000000000000000000000000000000000000000
--- a/ui/aura/test/event_generator.cc
+++ /dev/null
@@ -1,118 +0,0 @@
-// 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 "ui/aura/test/event_generator.h"
-
-#include "ui/aura/client/screen_position_client.h"
-#include "ui/aura/window_event_dispatcher.h"
-#include "ui/aura/window_tree_host.h"
-
-namespace aura {
-namespace test {
-namespace {
-
-class DefaultEventGeneratorDelegate : public EventGeneratorDelegateAura {
- public:
- explicit DefaultEventGeneratorDelegate(Window* root_window)
- : root_window_(root_window) {}
- virtual ~DefaultEventGeneratorDelegate() {}
-
- // EventGeneratorDelegateAura overrides:
- virtual WindowTreeHost* GetHostAt(const gfx::Point& point) const OVERRIDE {
- return root_window_->GetHost();
- }
-
- virtual client::ScreenPositionClient* GetScreenPositionClient(
- const aura::Window* window) const OVERRIDE {
- return NULL;
- }
-
- private:
- Window* root_window_;
-
- DISALLOW_COPY_AND_ASSIGN(DefaultEventGeneratorDelegate);
-};
-
-const Window* WindowFromTarget(const ui::EventTarget* event_target) {
- return static_cast<const Window*>(event_target);
-}
-
-} // namespace
-
-EventGeneratorDelegateAura::EventGeneratorDelegateAura() {
-}
-
-EventGeneratorDelegateAura::~EventGeneratorDelegateAura() {
-}
-
-ui::EventTarget* EventGeneratorDelegateAura::GetTargetAt(
- const gfx::Point& location) {
- return GetHostAt(location)->window();
-}
-
-ui::EventSource* EventGeneratorDelegateAura::GetEventSource(
- ui::EventTarget* target) {
- return static_cast<Window*>(target)->GetHost()->GetEventSource();
-}
-
-gfx::Point EventGeneratorDelegateAura::CenterOfTarget(
- const ui::EventTarget* target) const {
- gfx::Point center =
- gfx::Rect(WindowFromTarget(target)->bounds().size()).CenterPoint();
- ConvertPointFromTarget(target, &center);
- return center;
-}
-
-gfx::Point EventGeneratorDelegateAura::CenterOfWindow(
- gfx::NativeWindow window) const {
- return CenterOfTarget(window);
-}
-
-void EventGeneratorDelegateAura::ConvertPointFromTarget(
- const ui::EventTarget* event_target,
- gfx::Point* point) const {
- DCHECK(point);
- const Window* target = WindowFromTarget(event_target);
- aura::client::ScreenPositionClient* client = GetScreenPositionClient(target);
- if (client)
- client->ConvertPointToScreen(target, point);
- else
- aura::Window::ConvertPointToTarget(target, target->GetRootWindow(), point);
-}
-
-void EventGeneratorDelegateAura::ConvertPointToTarget(
- const ui::EventTarget* event_target,
- gfx::Point* point) const {
- DCHECK(point);
- const Window* target = WindowFromTarget(event_target);
- aura::client::ScreenPositionClient* client = GetScreenPositionClient(target);
- if (client)
- client->ConvertPointFromScreen(target, point);
- else
- aura::Window::ConvertPointToTarget(target->GetRootWindow(), target, point);
-}
-
-void EventGeneratorDelegateAura::ConvertPointFromHost(
- const ui::EventTarget* hosted_target,
- gfx::Point* point) const {
- const Window* window = WindowFromTarget(hosted_target);
- window->GetHost()->ConvertPointFromHost(point);
-}
-
-} // namespace test
-} // namespace aura
-
-namespace ui {
-namespace test {
-
-// static
-EventGeneratorDelegate* EventGenerator::CreateDefaultPlatformDelegate(
- EventGenerator* owner,
- gfx::NativeWindow root_window,
- gfx::NativeWindow window) {
- return new aura::test::DefaultEventGeneratorDelegate(root_window);
-}
-
-} // namespace test
-} // namespace ui
« no previous file with comments | « ui/aura/test/event_generator.h ('k') | ui/aura/test/event_generator_delegate_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698