Commit b306277d authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

chromeos: removes more dead mojoms/code

The mojoms TouchDeviceServer, NativeDisplayDelegate and AccessibilityManager
are all not needed. Additionally TouchTransformSetterMus is not used.

BUG=none
TEST=none

Change-Id: I8d42aac5d548e5a109289133baeb3dd7fa3dd26b
Reviewed-on: https://chromium-review.googlesource.com/1185969Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585567}
parent 2202e13c
...@@ -1056,8 +1056,6 @@ component("ash") { ...@@ -1056,8 +1056,6 @@ component("ash") {
"touch/touch_devices_controller.cc", "touch/touch_devices_controller.cc",
"touch/touch_devices_controller.h", "touch/touch_devices_controller.h",
"touch/touch_observer_hud.cc", "touch/touch_observer_hud.cc",
"touch/touch_transform_setter_mus.cc",
"touch/touch_transform_setter_mus.h",
"touch/touch_uma.cc", "touch/touch_uma.cc",
"touch/touch_uma.h", "touch/touch_uma.h",
"tray_action/tray_action.cc", "tray_action/tray_action.cc",
......
// Copyright 2017 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/touch/touch_transform_setter_mus.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/ui/public/interfaces/constants.mojom.h"
#include "ui/events/devices/touch_device_transform.h"
namespace ash {
TouchTransformSetterMus::TouchTransformSetterMus(
service_manager::Connector* connector) {
if (!connector)
return;
connector->BindInterface(ui::mojom::kServiceName, &touch_device_server_);
}
TouchTransformSetterMus::~TouchTransformSetterMus() = default;
void TouchTransformSetterMus::ConfigureTouchDevices(
const std::vector<ui::TouchDeviceTransform>& transforms) {
if (!touch_device_server_)
return; // May be null in tests.
touch_device_server_->ConfigureTouchDevices(transforms);
}
} // namespace ash
// Copyright 2017 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_TOUCH_TOUCH_TRANSFORM_SETTER_MUS_H_
#define ASH_TOUCH_TOUCH_TRANSFORM_SETTER_MUS_H_
#include "base/macros.h"
#include "services/ui/public/interfaces/input_devices/touch_device_server.mojom.h"
#include "ui/display/manager/touch_transform_setter.h"
namespace service_manager {
class Connector;
}
namespace ash {
// display::TouchTransformSetter implementation for mus. Updates are applied
// by way of ui::mojom::TouchDeviceServer.
class TouchTransformSetterMus : public display::TouchTransformSetter {
public:
explicit TouchTransformSetterMus(service_manager::Connector* connector);
~TouchTransformSetterMus() override;
// TouchTransformSetter:
void ConfigureTouchDevices(
const std::vector<ui::TouchDeviceTransform>& transforms) override;
private:
ui::mojom::TouchDeviceServerPtr touch_device_server_;
DISALLOW_COPY_AND_ASSIGN(TouchTransformSetterMus);
};
} // namespace ash
#endif // ASH_TOUCH_TOUCH_TRANSFORM_SETTER_MUS_H_
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "ash/shell.h" #include "ash/shell.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.h" #include "chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.h"
#include "services/ui/public/interfaces/accessibility_manager.mojom.h"
#include "ui/aura/window_tree_host.h" #include "ui/aura/window_tree_host.h"
#include "ui/base/ui_base_features.h" #include "ui/base/ui_base_features.h"
#include "ui/events/event_sink.h" #include "ui/events/event_sink.h"
......
...@@ -25,10 +25,6 @@ namespace content { ...@@ -25,10 +25,6 @@ namespace content {
class BlinkTestController; class BlinkTestController;
} }
namespace display {
class ForwardingDisplayDelegate;
}
namespace leveldb { namespace leveldb {
class LevelDBMojoProxy; class LevelDBMojoProxy;
} }
...@@ -107,13 +103,6 @@ class MOJO_CPP_BINDINGS_EXPORT SyncCallRestrictions { ...@@ -107,13 +103,6 @@ class MOJO_CPP_BINDINGS_EXPORT SyncCallRestrictions {
friend class ui::HostContextFactoryPrivate; friend class ui::HostContextFactoryPrivate;
// END ALLOWED USAGE. // END ALLOWED USAGE.
// BEGIN USAGE THAT NEEDS TO BE FIXED.
// In ash::Shell::Init() it assumes that NativeDisplayDelegate will be
// synchronous at first. In mushrome ForwardingDisplayDelegate uses a
// synchronous call to get the display snapshots as a workaround.
friend class display::ForwardingDisplayDelegate;
// END USAGE THAT NEEDS TO BE FIXED.
#if ENABLE_SYNC_CALL_RESTRICTIONS #if ENABLE_SYNC_CALL_RESTRICTIONS
static void IncreaseScopedAllowCount(); static void IncreaseScopedAllowCount();
static void DecreaseScopedAllowCount(); static void DecreaseScopedAllowCount();
......
...@@ -19,14 +19,6 @@ source_set("input_devices") { ...@@ -19,14 +19,6 @@ source_set("input_devices") {
public_deps = [ public_deps = [
"//services/ui/public/interfaces/input_devices", "//services/ui/public/interfaces/input_devices",
] ]
if (is_chromeos) {
sources += [
"touch_device_server.cc",
"touch_device_server.h",
]
deps += [ "//ui/display/manager" ]
}
} }
source_set("tests") { source_set("tests") {
......
// Copyright 2017 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 "services/ui/input_devices/touch_device_server.h"
#include <utility>
#include <vector>
#include "ui/display/manager/default_touch_transform_setter.h"
#include "ui/events/devices/input_device.h"
#include "ui/events/devices/touchscreen_device.h"
namespace ui {
TouchDeviceServer::TouchDeviceServer()
: touch_transform_setter_(
std::make_unique<display::DefaultTouchTransformSetter>()) {}
TouchDeviceServer::~TouchDeviceServer() {}
void TouchDeviceServer::AddBinding(mojom::TouchDeviceServerRequest request) {
bindings_.AddBinding(this, std::move(request));
}
void TouchDeviceServer::ConfigureTouchDevices(
const std::vector<ui::TouchDeviceTransform>& transforms) {
touch_transform_setter_->ConfigureTouchDevices(transforms);
}
} // namespace ui
// Copyright 2017 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 SERVICES_UI_INPUT_DEVICES_TOUCH_DEVICE_SERVER_H_
#define SERVICES_UI_INPUT_DEVICES_TOUCH_DEVICE_SERVER_H_
#include "base/macros.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/interface_ptr_set.h"
#include "services/ui/public/interfaces/input_devices/touch_device_server.mojom.h"
namespace display {
class DefaultTouchTransformSetter;
}
namespace ui {
// Implementation of mojom::TouchDeviceServer. Uses an instance of
// DefaultTouchTransformSetter to apply the actual updates.
class TouchDeviceServer : public mojom::TouchDeviceServer {
public:
TouchDeviceServer();
~TouchDeviceServer() override;
void AddBinding(mojom::TouchDeviceServerRequest request);
// mojom::TouchDeviceServer:
void ConfigureTouchDevices(
const std::vector<ui::TouchDeviceTransform>& transforms) override;
private:
mojo::BindingSet<mojom::TouchDeviceServer> bindings_;
std::unique_ptr<display::DefaultTouchTransformSetter> touch_transform_setter_;
DISALLOW_COPY_AND_ASSIGN(TouchDeviceServer);
};
} // namespace ui
#endif // SERVICES_UI_INPUT_DEVICES_TOUCH_DEVICE_SERVER_H_
...@@ -46,17 +46,13 @@ ...@@ -46,17 +46,13 @@
"ui.mojom.EventInjector", "ui.mojom.EventInjector",
"ui.mojom.RemotingEventInjector" "ui.mojom.RemotingEventInjector"
], ],
// TODO(sky): update this to reflect what is really possible.
"window_manager": [ "window_manager": [
"discardable_memory.mojom.DiscardableSharedMemoryManager", "discardable_memory.mojom.DiscardableSharedMemoryManager",
"display.mojom.NativeDisplayDelegate",
"ui.mojom.AccessibilityManager",
"ui.mojom.EventInjector", "ui.mojom.EventInjector",
"ui.mojom.Gpu", "ui.mojom.Gpu",
"ui.mojom.IMEDriver", "ui.mojom.IMEDriver",
"ui.mojom.InputDeviceController", "ui.mojom.InputDeviceController",
"ui.mojom.InputDeviceServer", "ui.mojom.InputDeviceServer",
"ui.mojom.TouchDeviceServer",
"ui.mojom.UserActivityMonitor" "ui.mojom.UserActivityMonitor"
] ]
}, },
......
...@@ -7,7 +7,6 @@ import("//testing/test.gni") ...@@ -7,7 +7,6 @@ import("//testing/test.gni")
mojom("interfaces") { mojom("interfaces") {
sources = [ sources = [
"accessibility_manager.mojom",
"event_injector.mojom", "event_injector.mojom",
"gpu.mojom", "gpu.mojom",
"remoting_event_injector.mojom", "remoting_event_injector.mojom",
......
// Copyright 2016 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.
module ui.mojom;
// Allows controlling accessibility in the UI service. Only one client at a time
// can connect to AccessibilityManager per user. If a new client connects to it,
// then any previously connected client for that user is disconnected.
interface AccessibilityManager {
// Enables (or disables) high contrast mode.
SetHighContrastMode(bool enabled);
};
...@@ -15,11 +15,7 @@ mojom("input_devices") { ...@@ -15,11 +15,7 @@ mojom("input_devices") {
] ]
if (is_chromeos) { if (is_chromeos) {
sources += [ "touch_device_server.mojom" ] sources += [ "input_device_controller.mojom" ]
public_deps += [ "//ui/events/devices/mojo" ] public_deps += [ "//mojo/public/mojom/base" ]
if (use_ozone) {
sources += [ "input_device_controller.mojom" ]
public_deps += [ "//mojo/public/mojom/base" ]
}
} }
} }
// Copyright 2017 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.
module ui.mojom;
import "ui/events/devices/mojo/touch_device_transform.mojom";
interface TouchDeviceServer {
// Reset the touch configuration.
ConfigureTouchDevices(array<ui.mojom.TouchDeviceTransform> transforms);
};
...@@ -19,8 +19,6 @@ jumbo_component("manager") { ...@@ -19,8 +19,6 @@ jumbo_component("manager") {
"fake_display_delegate.h", "fake_display_delegate.h",
"fake_display_snapshot.cc", "fake_display_snapshot.cc",
"fake_display_snapshot.h", "fake_display_snapshot.h",
"forwarding_display_delegate.cc",
"forwarding_display_delegate.h",
"json_converter.cc", "json_converter.cc",
"json_converter.h", "json_converter.h",
"managed_display_info.cc", "managed_display_info.cc",
......
// Copyright 2017 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/display/manager/forwarding_display_delegate.h"
#include <utility>
#include "base/bind.h"
#include "mojo/public/cpp/bindings/sync_call_restrictions.h"
#include "ui/display/types/display_snapshot.h"
namespace display {
ForwardingDisplayDelegate::ForwardingDisplayDelegate(
mojom::NativeDisplayDelegatePtr delegate)
: delegate_(std::move(delegate)), binding_(this) {}
ForwardingDisplayDelegate::~ForwardingDisplayDelegate() {}
void ForwardingDisplayDelegate::Initialize() {
// TODO(kylechar/sky): Figure out how to make this not synchronous.
mojo::SyncCallRestrictions::ScopedAllowSyncCall scoped_sync;
// This is a synchronous call to Initialize() because ash depends on
// NativeDisplayDelegate being synchronous during it's initialization. Calls
// to GetDisplays() and Configure() will return early starting now using
// whatever is in |snapshots_|.
mojom::NativeDisplayObserverPtr observer;
binding_.Bind(mojo::MakeRequest(&observer));
delegate_->Initialize(std::move(observer), &snapshots_);
}
void ForwardingDisplayDelegate::TakeDisplayControl(
DisplayControlCallback callback) {
delegate_->TakeDisplayControl(std::move(callback));
}
void ForwardingDisplayDelegate::RelinquishDisplayControl(
DisplayControlCallback callback) {
delegate_->RelinquishDisplayControl(std::move(callback));
}
void ForwardingDisplayDelegate::GetDisplays(GetDisplaysCallback callback) {
if (!use_delegate_) {
ForwardDisplays(std::move(callback));
return;
}
delegate_->GetDisplays(
base::BindOnce(&ForwardingDisplayDelegate::StoreAndForwardDisplays,
base::Unretained(this), std::move(callback)));
}
void ForwardingDisplayDelegate::Configure(const DisplaySnapshot& snapshot,
const DisplayMode* mode,
const gfx::Point& origin,
ConfigureCallback callback) {
if (!use_delegate_) {
// Pretend configuration succeeded. When the first OnConfigurationChanged()
// is received this will run again and actually happen.
std::move(callback).Run(true);
return;
}
base::Optional<std::unique_ptr<DisplayMode>> transport_mode;
if (mode)
transport_mode = mode->Clone();
delegate_->Configure(snapshot.display_id(), std::move(transport_mode), origin,
std::move(callback));
}
void ForwardingDisplayDelegate::GetHDCPState(const DisplaySnapshot& snapshot,
GetHDCPStateCallback callback) {
delegate_->GetHDCPState(snapshot.display_id(), std::move(callback));
}
void ForwardingDisplayDelegate::SetHDCPState(const DisplaySnapshot& snapshot,
HDCPState state,
SetHDCPStateCallback callback) {
delegate_->SetHDCPState(snapshot.display_id(), state, std::move(callback));
}
bool ForwardingDisplayDelegate::SetColorMatrix(
int64_t display_id,
const std::vector<float>& color_matrix) {
delegate_->SetColorMatrix(display_id, color_matrix);
// DrmNativeDisplayDelegate always returns true so this will too.
return true;
}
bool ForwardingDisplayDelegate::SetGammaCorrection(
int64_t display_id,
const std::vector<display::GammaRampRGBEntry>& degamma_lut,
const std::vector<display::GammaRampRGBEntry>& gamma_lut) {
delegate_->SetGammaCorrection(display_id, degamma_lut, gamma_lut);
// DrmNativeDisplayDelegate always returns true so this will too.
return true;
}
void ForwardingDisplayDelegate::AddObserver(
display::NativeDisplayObserver* observer) {
observers_.AddObserver(observer);
}
void ForwardingDisplayDelegate::RemoveObserver(
display::NativeDisplayObserver* observer) {
observers_.RemoveObserver(observer);
}
FakeDisplayController* ForwardingDisplayDelegate::GetFakeDisplayController() {
return nullptr;
}
void ForwardingDisplayDelegate::OnConfigurationChanged() {
// Start asynchronous operation once the first OnConfigurationChanged()
// arrives. We know |delegate_| is usable at this point.
use_delegate_ = true;
// Forward OnConfigurationChanged received over Mojo to local observers.
for (auto& observer : observers_)
observer.OnConfigurationChanged();
}
void ForwardingDisplayDelegate::StoreAndForwardDisplays(
GetDisplaysCallback callback,
std::vector<std::unique_ptr<DisplaySnapshot>> snapshots) {
for (auto& observer : observers_)
observer.OnDisplaySnapshotsInvalidated();
snapshots_ = std::move(snapshots);
ForwardDisplays(std::move(callback));
}
void ForwardingDisplayDelegate::ForwardDisplays(GetDisplaysCallback callback) {
std::vector<DisplaySnapshot*> snapshot_ptrs;
for (auto& snapshot : snapshots_)
snapshot_ptrs.push_back(snapshot.get());
std::move(callback).Run(snapshot_ptrs);
}
} // namespace display
// Copyright 2017 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 UI_DISPLAY_MANAGER_FORWARDING_DISPLAY_DELEGATE_H_
#define UI_DISPLAY_MANAGER_FORWARDING_DISPLAY_DELEGATE_H_
#include <memory>
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "ui/display/manager/display_manager_export.h"
#include "ui/display/mojo/native_display_delegate.mojom.h"
#include "ui/display/types/native_display_delegate.h"
#include "ui/display/types/native_display_observer.h"
namespace display {
class DisplaySnapshot;
// NativeDisplayDelegate implementation that forwards calls to a real
// NativeDisplayDelegate in another process. Only forwards the methods
// implemented by Ozone DRM, other method won't do anything.
class DISPLAY_MANAGER_EXPORT ForwardingDisplayDelegate
: public NativeDisplayDelegate,
public mojom::NativeDisplayObserver {
public:
explicit ForwardingDisplayDelegate(mojom::NativeDisplayDelegatePtr delegate);
~ForwardingDisplayDelegate() override;
// display::NativeDisplayDelegate:
void Initialize() override;
void TakeDisplayControl(DisplayControlCallback callback) override;
void RelinquishDisplayControl(DisplayControlCallback callback) override;
void GetDisplays(GetDisplaysCallback callback) override;
void Configure(const DisplaySnapshot& output,
const DisplayMode* mode,
const gfx::Point& origin,
ConfigureCallback callback) override;
void GetHDCPState(const DisplaySnapshot& output,
GetHDCPStateCallback callback) override;
void SetHDCPState(const DisplaySnapshot& output,
HDCPState state,
SetHDCPStateCallback callback) override;
bool SetColorMatrix(int64_t display_id,
const std::vector<float>& color_matrix) override;
bool SetGammaCorrection(
int64_t display_id,
const std::vector<display::GammaRampRGBEntry>& degamma_lut,
const std::vector<display::GammaRampRGBEntry>& gamma_lut) override;
void AddObserver(display::NativeDisplayObserver* observer) override;
void RemoveObserver(display::NativeDisplayObserver* observer) override;
FakeDisplayController* GetFakeDisplayController() override;
// display::mojom::NativeDisplayObserver:
void OnConfigurationChanged() override;
private:
// Stores display snapshots and forwards pointers to |callback|.
void StoreAndForwardDisplays(
GetDisplaysCallback callback,
std::vector<std::unique_ptr<DisplaySnapshot>> snapshots);
// Forwards display snapshot pointers to |callback|.
void ForwardDisplays(GetDisplaysCallback callback);
// True if we should use |delegate_|. This will be false if synchronous
// GetDisplays() and Configure() are required.
bool use_delegate_ = false;
mojom::NativeDisplayDelegatePtr delegate_;
mojo::Binding<mojom::NativeDisplayObserver> binding_;
// Display snapshots are owned here but accessed via raw pointers elsewhere.
// Call OnDisplaySnapshotsInvalidated() on observers before invalidating them.
std::vector<std::unique_ptr<DisplaySnapshot>> snapshots_;
base::ObserverList<display::NativeDisplayObserver>::Unchecked observers_;
DISALLOW_COPY_AND_ASSIGN(ForwardingDisplayDelegate);
};
} // namespace display
#endif // UI_DISPLAY_MANAGER_FORWARDING_DISPLAY_DELEGATE_H_
...@@ -12,7 +12,6 @@ mojom("interfaces") { ...@@ -12,7 +12,6 @@ mojom("interfaces") {
"display_mode.mojom", "display_mode.mojom",
"display_snapshot.mojom", "display_snapshot.mojom",
"gamma_ramp_rgb_entry.mojom", "gamma_ramp_rgb_entry.mojom",
"native_display_delegate.mojom",
] ]
public_deps = [ public_deps = [
......
// Copyright 2017 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.
module display.mojom;
import "ui/display/mojo/display_constants.mojom";
import "ui/display/mojo/display_mode.mojom";
import "ui/display/mojo/display_snapshot.mojom";
import "ui/display/mojo/gamma_ramp_rgb_entry.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
// Corresponds to display::NativeDisplayObserver.
interface NativeDisplayObserver {
OnConfigurationChanged();
};
// Corresponds to display::NativeDisplayDelegate. This only implements
// functionality that is used by Ozone DRM.
interface NativeDisplayDelegate {
// Initializes and registers the observer. This is synchronous so that ash
// initialization has an initial set of displays to use.
[Sync]
Initialize(NativeDisplayObserver observer) =>
(array<DisplaySnapshot> snapshots);
// Take control of the displays from any other controlling process.
TakeDisplayControl() => (bool result);
// Let others control the displays.
RelinquishDisplayControl() => (bool result);
// Queries for a list of fresh displays.
GetDisplays() => (array<DisplaySnapshot> snapshots);
// Configures the display represented by |display_id| to use |mode| and
// positions the display to |origin| in the framebuffer. |mode| can be null,
// which represents disabling the display.
Configure(int64 display_id,
DisplayMode? mode,
gfx.mojom.Point origin) => (bool status);
// Gets HDCP state of output.
GetHDCPState(int64 display_id) => (bool status, HDCPState state);
// Sets HDCP state of output.
SetHDCPState(int64 display_id, HDCPState state) => (bool status);
// Sets a 3x3 color transform matrix on the display hardware.
// TODO: Consider using a different type for the color matrix.
// https://crbug.com/846975.
SetColorMatrix(int64 display_id, array<float, 9> color_matrix);
// Set the gamma lookup tables for |display_id|.
SetGammaCorrection(int64 display_id,
array<GammaRampRGBEntry> degamma_lut,
array<GammaRampRGBEntry> gamma_lut);
};
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