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

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

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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_delegate_aura.h ('k') | ui/aura/test/run_all_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/event_generator_delegate_aura.cc
diff --git a/ui/aura/test/event_generator_delegate_aura.cc b/ui/aura/test/event_generator_delegate_aura.cc
deleted file mode 100644
index 576cc8e184d4e21d0f34b0b2c02053f8317eaeb5..0000000000000000000000000000000000000000
--- a/ui/aura/test/event_generator_delegate_aura.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-// 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 "ui/aura/test/event_generator_delegate_aura.h"
-
-#include "base/memory/singleton.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:
- static DefaultEventGeneratorDelegate* GetInstance() {
- return Singleton<DefaultEventGeneratorDelegate>::get();
- }
-
- // EventGeneratorDelegate:
- virtual void SetContext(ui::test::EventGenerator* owner,
- gfx::NativeWindow root_window,
- gfx::NativeWindow window) override {
- root_window_ = root_window;
- }
-
- // EventGeneratorDelegateAura:
- 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:
- friend struct DefaultSingletonTraits<DefaultEventGeneratorDelegate>;
-
- DefaultEventGeneratorDelegate() : root_window_(NULL) {
- DCHECK(!ui::test::EventGenerator::default_delegate);
- ui::test::EventGenerator::default_delegate = this;
- }
-
- virtual ~DefaultEventGeneratorDelegate() {
- DCHECK_EQ(this, ui::test::EventGenerator::default_delegate);
- ui::test::EventGenerator::default_delegate = NULL;
- }
-
- Window* root_window_;
-
- DISALLOW_COPY_AND_ASSIGN(DefaultEventGeneratorDelegate);
-};
-
-const Window* WindowFromTarget(const ui::EventTarget* event_target) {
- return static_cast<const Window*>(event_target);
-}
-
-} // namespace
-
-void InitializeAuraEventGeneratorDelegate() {
- DefaultEventGeneratorDelegate::GetInstance();
-}
-
-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
« no previous file with comments | « ui/aura/test/event_generator_delegate_aura.h ('k') | ui/aura/test/run_all_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698