Commit 02bb1be5 authored by Shawn Gallea's avatar Shawn Gallea Committed by Commit Bot

EXO: Move WaylandInputDelegate out of server.cc

Include wayland_input_delegate.h in server.cc until a later CL,
this is needed for classes in server.cc that inherit from it.

Bug: 896710
Test: Build ChromeOS
Change-Id: I668280ccceab8a9e75874247919d0d0b3fea1cb1
Reviewed-on: https://chromium-review.googlesource.com/c/1316100
Commit-Queue: Shawn Gallea <sagallea@google.com>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608035}
parent f37441a5
......@@ -35,6 +35,8 @@ source_set("wayland") {
"server.h",
"server_util.cc",
"server_util.h",
"wayland_input_delegate.cc",
"wayland_input_delegate.h",
"zcr_notification_shell.cc",
"zcr_notification_shell.h",
"zwp_text_input_manager.cc",
......
......@@ -95,6 +95,7 @@
#include "components/exo/touch_delegate.h"
#include "components/exo/touch_stylus_delegate.h"
#include "components/exo/wayland/server_util.h"
#include "components/exo/wayland/wayland_input_delegate.h"
#include "components/exo/wayland/zcr_notification_shell.h"
#include "components/exo/wayland/zwp_text_input_manager.h"
#include "components/exo/wm_helper.h"
......@@ -179,41 +180,6 @@ double GetDefaultDeviceScaleFactor() {
return WMHelper::GetInstance()->GetDefaultDeviceScaleFactor();
}
class WaylandInputDelegate {
public:
class Observer {
public:
virtual void OnDelegateDestroying(WaylandInputDelegate* delegate) = 0;
virtual void OnSendTimestamp(base::TimeTicks time_stamp) = 0;
protected:
virtual ~Observer() = default;
};
void AddObserver(Observer* observer) { observers_.AddObserver(observer); }
void RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
void SendTimestamp(base::TimeTicks time_stamp) {
for (auto& observer : observers_)
observer.OnSendTimestamp(time_stamp);
}
protected:
WaylandInputDelegate() = default;
virtual ~WaylandInputDelegate() {
for (auto& observer : observers_)
observer.OnDelegateDestroying(this);
}
private:
base::ObserverList<Observer>::Unchecked observers_;
DISALLOW_COPY_AND_ASSIGN(WaylandInputDelegate);
};
uint32_t WaylandDataDeviceManagerDndAction(DndAction action) {
switch (action) {
case DndAction::kNone:
......
// Copyright 2018 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 "components/exo/wayland/wayland_input_delegate.h"
namespace exo {
namespace wayland {
WaylandInputDelegate::WaylandInputDelegate() = default;
void WaylandInputDelegate::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
void WaylandInputDelegate::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
void WaylandInputDelegate::SendTimestamp(base::TimeTicks time_stamp) {
for (auto& observer : observers_)
observer.OnSendTimestamp(time_stamp);
}
WaylandInputDelegate::~WaylandInputDelegate() {
for (auto& observer : observers_)
observer.OnDelegateDestroying(this);
}
} // namespace wayland
} // namespace exo
// Copyright 2018 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 COMPONENTS_EXO_WAYLAND_WAYLAND_INPUT_DELEGATE_H_
#define COMPONENTS_EXO_WAYLAND_WAYLAND_INPUT_DELEGATE_H_
#include "base/observer_list.h"
#include "base/time/time.h"
namespace exo {
namespace wayland {
class WaylandInputDelegate {
public:
class Observer {
public:
virtual void OnDelegateDestroying(WaylandInputDelegate* delegate) = 0;
virtual void OnSendTimestamp(base::TimeTicks time_stamp) = 0;
protected:
virtual ~Observer() = default;
};
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
void SendTimestamp(base::TimeTicks time_stamp);
protected:
WaylandInputDelegate();
virtual ~WaylandInputDelegate();
private:
base::ObserverList<Observer>::Unchecked observers_;
DISALLOW_COPY_AND_ASSIGN(WaylandInputDelegate);
};
} // namespace wayland
} // namespace exo
#endif // COMPONENTS_EXO_WAYLAND_WAYLAND_INPUT_DELEGATE_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment