Commit 891067b2 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Don't use ui::CursorData as PlatformCursor for mash clients.

ui::Cursor now holds the data necessary for custom cursors, although for
simplicity this patch still converts to CursorData for serializing over
mojo.

CursorFactoryOzone goes back to being a true singleton, which shouldn't
be used from client code in Mash (in Oop Mash, it's actually null; in
single process Mash it is avoided by checking the feature switch).

This patch also makes some tweaks to how custom web cursors are stored
as ui::Cursors, which shouldn't impact other platforms but brings the
ui::Cursor representation into alignment with the PlatformCursor
representation for ozone.

As a future cleanup we should be able to get rid of CursorData and
serialize ui::Cursor directly.

Bug: 904039, 734668
Change-Id: I4168c0266899bd276c60a0ac6a286b3a79df572f
Reviewed-on: https://chromium-review.googlesource.com/c/1334968
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608617}
parent 7de3a17b
......@@ -59,7 +59,6 @@ class TapVisualizerAppTest : public aura::test::AuraTestBase {
// Create a MusClient using the AuraTestBase's TestWindowTreeClient,
// which does not connect to a window service.
views::MusClient::InitParams params;
params.create_cursor_factory = false;
params.create_wm_state = false;
params.window_tree_client = window_tree_client_impl();
mus_client_ = std::make_unique<views::MusClient>(params);
......
......@@ -63,7 +63,6 @@ TEST_F(AshWindowManagerTest, AddWindowToTabletMode) {
mus_client_init_params.connector =
ash_test_helper()->GetWindowServiceConnector();
mus_client_init_params.create_wm_state = false;
mus_client_init_params.create_cursor_factory = false;
mus_client_init_params.running_in_ws_process = true;
views::MusClient mus_client(mus_client_init_params);
......
......@@ -165,7 +165,6 @@ void ChromeBrowserMainExtraPartsAsh::ServiceManagerConnectionStarted(
// WMState has already been created, so don't have MusClient create it.
params.create_wm_state = false;
params.running_in_ws_process = features::IsSingleProcessMash();
params.create_cursor_factory = !features::IsSingleProcessMash();
mus_client_ = std::make_unique<views::MusClient>(params);
// Register ash-specific window properties with Chrome's property converter.
// Values of registered properties will be transported between the services.
......
......@@ -72,16 +72,14 @@ class CONTENT_EXPORT WebCursor {
gfx::NativeCursor GetNativeCursor();
#if defined(USE_AURA)
ui::PlatformCursor GetPlatformCursor();
ui::PlatformCursor GetPlatformCursor(const ui::Cursor& cursor);
// Updates |device_scale_factor_| and |rotation_| based on |display|.
void SetDisplayInfo(const display::Display& display);
float GetCursorScaleFactor();
void CreateScaledBitmapAndHotspotFromCustomData(
SkBitmap* bitmap,
gfx::Point* hotspot);
void CreateScaledBitmapAndHotspotFromCustomData(SkBitmap* bitmap,
gfx::Point* hotspot,
float* scale_factor);
#elif defined(OS_WIN)
// Returns a HCURSOR representing the current WebCursor instance.
......@@ -126,6 +124,8 @@ class CONTENT_EXPORT WebCursor {
// Clamp the hotspot to the custom image's bounds, if this is a custom cursor.
void ClampHotspot();
float GetCursorScaleFactor(SkBitmap* bitmap);
// WebCore::PlatformCursor type.
int type_;
......@@ -149,8 +149,9 @@ class CONTENT_EXPORT WebCursor {
float device_scale_factor_;
#endif
display::Display::Rotation rotation_ = display::Display::ROTATE_0;
#if defined(USE_OZONE)
display::Display::Rotation rotation_;
gfx::Size maximum_cursor_size_;
#endif
};
......
......@@ -103,12 +103,15 @@ gfx::NativeCursor WebCursor::GetNativeCursor() {
return ui::CursorType::kGrabbing;
case WebCursorInfo::kTypeCustom: {
ui::Cursor cursor(ui::CursorType::kCustom);
cursor.SetPlatformCursor(GetPlatformCursor());
SkBitmap bitmap;
gfx::Point hotspot;
CreateScaledBitmapAndHotspotFromCustomData(&bitmap, &hotspot);
float scale_factor;
CreateScaledBitmapAndHotspotFromCustomData(&bitmap, &hotspot,
&scale_factor);
cursor.set_custom_bitmap(bitmap);
cursor.set_custom_hotspot(hotspot);
cursor.set_device_scale_factor(scale_factor);
cursor.SetPlatformCursor(GetPlatformCursor(cursor));
return cursor;
}
default:
......@@ -117,24 +120,21 @@ gfx::NativeCursor WebCursor::GetNativeCursor() {
}
}
float WebCursor::GetCursorScaleFactor() {
DCHECK(custom_scale_ != 0);
return device_scale_factor_ / custom_scale_;
}
void WebCursor::CreateScaledBitmapAndHotspotFromCustomData(
SkBitmap* bitmap,
gfx::Point* hotspot) {
gfx::Point* hotspot,
float* scale_factor) {
if (custom_data_.empty())
return;
ImageFromCustomData(bitmap);
*hotspot = hotspot_;
ui::ScaleAndRotateCursorBitmapAndHotpoint(
GetCursorScaleFactor(), display::Display::ROTATE_0, bitmap, hotspot);
*scale_factor = GetCursorScaleFactor(bitmap);
ui::ScaleAndRotateCursorBitmapAndHotpoint(*scale_factor, rotation_, bitmap,
hotspot);
}
// ozone has its own SetDisplayInfo that takes rotation into account
#if !defined(USE_OZONE)
// ozone has its own SetDisplayInfo that takes rotation into account
void WebCursor::SetDisplayInfo(const display::Display& display) {
if (device_scale_factor_ == display.device_scale_factor())
return;
......@@ -142,6 +142,13 @@ void WebCursor::SetDisplayInfo(const display::Display& display) {
device_scale_factor_ = display.device_scale_factor();
CleanupPlatformData();
}
// ozone also has extra calculations for scale factor (taking max cursor size
// into account).
float WebCursor::GetCursorScaleFactor(SkBitmap* bitmap) {
DCHECK(custom_scale_ != 0);
return device_scale_factor_ / custom_scale_;
}
#endif
} // namespace content
......@@ -11,27 +11,22 @@
namespace content {
ui::PlatformCursor WebCursor::GetPlatformCursor() {
ui::PlatformCursor WebCursor::GetPlatformCursor(const ui::Cursor& cursor) {
if (!IsCustom())
return LoadCursor(NULL, IDC_ARROW);
if (custom_cursor_)
return custom_cursor_;
SkBitmap bitmap;
gfx::Point hotspot;
CreateScaledBitmapAndHotspotFromCustomData(&bitmap, &hotspot);
gfx::Size custom_size;
std::vector<char> custom_data;
CreateCustomData(bitmap, &custom_data, &custom_size);
custom_cursor_ = IconUtil::CreateCursorFromDIB(
custom_size,
hotspot,
!custom_data.empty() ? &custom_data[0] : NULL,
custom_data.size())
.release();
CreateCustomData(cursor.GetBitmap(), &custom_data, &custom_size);
custom_cursor_ =
IconUtil::CreateCursorFromDIB(
custom_size, cursor.GetHotspot(),
!custom_data.empty() ? &custom_data[0] : NULL, custom_data.size())
.release();
return custom_cursor_;
}
......
......@@ -14,15 +14,14 @@
namespace content {
ui::PlatformCursor WebCursor::GetPlatformCursor() {
ui::PlatformCursor WebCursor::GetPlatformCursor(const ui::Cursor& cursor) {
if (platform_cursor_)
return platform_cursor_;
SkBitmap bitmap;
gfx::Point hotspot;
CreateScaledBitmapAndHotspotFromCustomData(&bitmap, &hotspot);
SkBitmap bitmap = cursor.GetBitmap();
XcursorImage* image = ui::SkBitmapToXcursorImage(&bitmap, hotspot);
XcursorImage* image =
ui::SkBitmapToXcursorImage(&bitmap, cursor.GetHotspot());
platform_cursor_ = ui::CreateReffedCustomXCursor(image);
return platform_cursor_;
}
......
......@@ -7,6 +7,7 @@
#include "third_party/blink/public/platform/web_cursor_info.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/cursor_util.h"
#include "ui/base/ui_base_features.h"
#include "ui/ozone/public/cursor_factory_ozone.h"
namespace {
......@@ -16,27 +17,15 @@ const int kDefaultMaxCursorHeight = 64;
namespace content {
ui::PlatformCursor WebCursor::GetPlatformCursor() {
if (platform_cursor_)
return platform_cursor_;
SkBitmap bitmap;
ImageFromCustomData(&bitmap);
gfx::Point hotspot = hotspot_;
float scale = device_scale_factor_ / custom_scale_;
DCHECK_LT(0, maximum_cursor_size_.width());
DCHECK_LT(0, maximum_cursor_size_.height());
scale = std::min(
scale, static_cast<float>(maximum_cursor_size_.width()) / bitmap.width());
scale = std::min(scale, static_cast<float>(maximum_cursor_size_.height()) /
bitmap.height());
ui::PlatformCursor WebCursor::GetPlatformCursor(const ui::Cursor& cursor) {
if (features::IsUsingWindowService())
return nullptr;
ui::ScaleAndRotateCursorBitmapAndHotpoint(scale, rotation_, &bitmap,
&hotspot);
if (!platform_cursor_) {
platform_cursor_ = ui::CursorFactoryOzone::GetInstance()->CreateImageCursor(
cursor.GetBitmap(), cursor.GetHotspot(), cursor.device_scale_factor());
}
platform_cursor_ = ui::CursorFactoryOzone::GetInstance()->CreateImageCursor(
bitmap, hotspot, scale);
return platform_cursor_;
}
......@@ -61,6 +50,15 @@ void WebCursor::SetDisplayInfo(const display::Display& display) {
// recreated on demand when GetPlatformCursor is called.
}
float WebCursor::GetCursorScaleFactor(SkBitmap* bitmap) {
DCHECK_LT(0, maximum_cursor_size_.width());
DCHECK_LT(0, maximum_cursor_size_.height());
return std::min(
{device_scale_factor_ / custom_scale_,
static_cast<float>(maximum_cursor_size_.width()) / bitmap->width(),
static_cast<float>(maximum_cursor_size_.height()) / bitmap->height()});
}
void WebCursor::InitPlatformData() {
platform_cursor_ = NULL;
device_scale_factor_ = 1.f;
......
......@@ -261,13 +261,33 @@ TEST(WebCursorTest, CursorScaleFactor) {
display.set_device_scale_factor(80.2f);
CursorInfo info;
info.type = WebCursorInfo::kTypeCustom;
info.hotspot = gfx::Point(0, 1);
info.image_scale_factor = 2.0f;
SkImageInfo image_info =
SkImageInfo::MakeN32(256, 256, kUnpremul_SkAlphaType);
info.custom_image = SkBitmap();
info.custom_image.setInfo(image_info);
info.custom_image.allocN32Pixels(256, 256);
info.custom_image.eraseColor(0xFFFFFFFF);
WebCursor cursor;
cursor.InitFromCursorInfo(info);
cursor.SetDisplayInfo(display);
EXPECT_EQ(40.1f, cursor.GetCursorScaleFactor());
#if defined(USE_OZONE)
// For Ozone cursors, the size of the cursor is capped at 64px, and this is
// enforce through the calculated scale factor.
EXPECT_EQ(0.25f, cursor.GetNativeCursor().device_scale_factor());
#else
EXPECT_EQ(40.1f, cursor.GetNativeCursor().device_scale_factor());
#endif
// Test that the Display dsf is copied.
WebCursor cursor2 = cursor;
EXPECT_EQ(cursor.GetNativeCursor().device_scale_factor(),
cursor2.GetNativeCursor().device_scale_factor());
}
TEST(WebCursorTest, UnscaledImageCopy) {
......@@ -286,7 +306,10 @@ TEST(WebCursorTest, UnscaledImageCopy) {
SkBitmap image_copy;
gfx::Point hotspot;
cursor.CreateScaledBitmapAndHotspotFromCustomData(&image_copy, &hotspot);
float dsf;
cursor.CreateScaledBitmapAndHotspotFromCustomData(&image_copy, &hotspot,
&dsf);
EXPECT_EQ(1.0f, dsf);
EXPECT_EQ(kBGRA_8888_SkColorType, image_copy.colorType());
EXPECT_EQ(kUnpremul_SkAlphaType, image_copy.alphaType());
......@@ -295,17 +318,6 @@ TEST(WebCursorTest, UnscaledImageCopy) {
EXPECT_EQ(0, hotspot.x());
EXPECT_EQ(1, hotspot.y());
}
TEST(WebCursorTest, CopyDeviceScaleFactor) {
WebCursor cursor1;
EXPECT_EQ(1.f, cursor1.GetCursorScaleFactor());
display::Display display;
display.set_device_scale_factor(19.333f);
cursor1.SetDisplayInfo(display);
WebCursor cursor2 = cursor1;
EXPECT_EQ(19.333f, cursor2.GetCursorScaleFactor());
}
#endif
#if defined(OS_WIN)
......@@ -327,7 +339,7 @@ void ScaleCursor(float scale_factor, int hotspot_x, int hotspot_y) {
cursor.SetDisplayInfo(display);
cursor.InitFromCursorInfo(info);
HCURSOR windows_cursor_handle = cursor.GetPlatformCursor();
HCURSOR windows_cursor_handle = cursor.GetNativeCursor().platform();
EXPECT_NE(nullptr, windows_cursor_handle);
ICONINFO windows_icon_info;
EXPECT_TRUE(GetIconInfo(windows_cursor_handle, &windows_icon_info));
......
......@@ -587,8 +587,6 @@ jumbo_component("base") {
"cursor/cursor_ozone.cc",
"cursor/ozone/bitmap_cursor_factory_ozone.cc",
"cursor/ozone/bitmap_cursor_factory_ozone.h",
"cursor/ozone/cursor_data_factory_ozone.cc",
"cursor/ozone/cursor_data_factory_ozone.h",
]
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.
#include "ui/base/cursor/ozone/cursor_data_factory_ozone.h"
#include "ui/base/cursor/cursor.h"
namespace ui {
namespace {
// A magic value that we store at the start of an instance.
const uint32_t kCookie = 0xF60D214C;
const uint32_t kBadCookie = 0xBADBADCC;
CursorDataOzone* ToCursorDataOzone(PlatformCursor cursor) {
CursorDataOzone* ozone = static_cast<CursorDataOzone*>(cursor);
#if DCHECK_IS_ON()
ozone->AssertIsACursorDataOzone();
#endif
return ozone;
}
PlatformCursor ToPlatformCursor(CursorDataOzone* cursor) {
return static_cast<PlatformCursor>(cursor);
}
} // namespace
CursorDataOzone::CursorDataOzone(const ui::CursorData& data)
: magic_cookie_(kCookie), data_(data) {}
void CursorDataOzone::AssertIsACursorDataOzone() {
CHECK_EQ(magic_cookie_, kCookie);
}
CursorDataOzone::~CursorDataOzone() {
magic_cookie_ = kBadCookie;
}
CursorDataFactoryOzone::CursorDataFactoryOzone() {}
CursorDataFactoryOzone::~CursorDataFactoryOzone() {}
// static
const ui::CursorData& CursorDataFactoryOzone::GetCursorData(
PlatformCursor platform_cursor) {
return ToCursorDataOzone(platform_cursor)->data();
}
PlatformCursor CursorDataFactoryOzone::GetDefaultCursor(CursorType type) {
// Unlike BitmapCursorFactoryOzone, we aren't making heavyweight bitmaps, but
// we still have to cache these forever because objects that come out of the
// GetDefaultCursor() method aren't treated as refcounted by the ozone
// interfaces.
return GetDefaultCursorInternal(type).get();
}
PlatformCursor CursorDataFactoryOzone::CreateImageCursor(
const SkBitmap& bitmap,
const gfx::Point& hotspot,
float bitmap_dpi) {
CursorDataOzone* cursor = new CursorDataOzone(
ui::CursorData(hotspot, {bitmap}, bitmap_dpi, base::TimeDelta()));
cursor->AddRef(); // Balanced by UnrefImageCursor.
return ToPlatformCursor(cursor);
}
PlatformCursor CursorDataFactoryOzone::CreateAnimatedCursor(
const std::vector<SkBitmap>& bitmaps,
const gfx::Point& hotspot,
int frame_delay_ms,
float bitmap_dpi) {
CursorDataOzone* cursor = new CursorDataOzone(
ui::CursorData(hotspot, bitmaps, bitmap_dpi,
base::TimeDelta::FromMilliseconds(frame_delay_ms)));
cursor->AddRef(); // Balanced by UnrefImageCursor.
return ToPlatformCursor(cursor);
}
void CursorDataFactoryOzone::RefImageCursor(PlatformCursor cursor) {
ToCursorDataOzone(cursor)->AddRef();
}
void CursorDataFactoryOzone::UnrefImageCursor(PlatformCursor cursor) {
ToCursorDataOzone(cursor)->Release();
}
scoped_refptr<CursorDataOzone> CursorDataFactoryOzone::GetDefaultCursorInternal(
CursorType type) {
if (type == CursorType::kNone)
return nullptr; // nullptr is used for hidden cursor.
if (!default_cursors_.count(type)) {
// We hold a ref forever because clients do not do refcounting for default
// cursors.
scoped_refptr<CursorDataOzone> cursor =
base::MakeRefCounted<CursorDataOzone>(ui::CursorData(type));
default_cursors_[type] = std::move(cursor);
}
// Returned owned default cursor for this type.
return default_cursors_[type];
}
} // 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 UI_BASE_CURSOR_OZONE_CURSORD_DATA_FACTORY_OZONE_H_
#define UI_BASE_CURSOR_OZONE_CURSORD_DATA_FACTORY_OZONE_H_
#include <map>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/cursor/cursor_data.h"
#include "ui/base/ui_base_export.h"
#include "ui/gfx/geometry/point.h"
#include "ui/ozone/public/cursor_factory_ozone.h"
namespace ui {
// A refcounted wrapper around a ui::CursorData to obey CursorFactoryOzone's
// refcounting interface while building ui::CursorData objects for transport
// over mojo pipes.
//
// TODO(erg): In the long term, this should go away. When //content/ switches
// from webcursor.h to use ui::CursorData directly, we should be able to get
// rid of this class which is an adaptor for the existing ozone code.
class UI_BASE_EXPORT CursorDataOzone
: public base::RefCounted<CursorDataOzone> {
public:
explicit CursorDataOzone(const ui::CursorData& data);
const ui::CursorData& data() const { return data_; }
// Instances of CursorDataOzone are passed around as void* because of the low
// level CursorFactoryOzone interface. Even worse, there can be multiple
// subclasses that map to this void* type. This asserts that a magic cookie
// that we put at the start of valid CursorDataOzone objects is correct.
void AssertIsACursorDataOzone();
private:
friend class base::RefCounted<CursorDataOzone>;
~CursorDataOzone();
// This is always a magic constant value. This is set in the constructor and
// unset in the destructor.
uint32_t magic_cookie_;
ui::CursorData data_;
DISALLOW_COPY_AND_ASSIGN(CursorDataOzone);
};
// CursorFactoryOzone implementation for processes which use ui::CursorDatas.
//
// Inside some sandboxed processes, we need to save all source data so it can
// be processed in a remote process. This plugs into the current ozone cursor
// creating code, and builds the cross platform mojo data structure.
class UI_BASE_EXPORT CursorDataFactoryOzone : public CursorFactoryOzone {
public:
CursorDataFactoryOzone();
~CursorDataFactoryOzone() override;
// Converts a PlatformCursor back to a ui::CursorData.
static const ui::CursorData& GetCursorData(PlatformCursor platform_cursor);
// CursorFactoryOzone:
PlatformCursor GetDefaultCursor(CursorType type) override;
PlatformCursor CreateImageCursor(const SkBitmap& bitmap,
const gfx::Point& hotspot,
float bitmap_dpi) override;
PlatformCursor CreateAnimatedCursor(const std::vector<SkBitmap>& bitmaps,
const gfx::Point& hotspot,
int frame_delay_ms,
float bitmap_dpi) override;
void RefImageCursor(PlatformCursor cursor) override;
void UnrefImageCursor(PlatformCursor cursor) override;
private:
// Get cached BitmapCursorOzone for a default cursor.
scoped_refptr<CursorDataOzone> GetDefaultCursorInternal(CursorType type);
// Default cursors are cached & owned by the factory.
std::map<CursorType, scoped_refptr<CursorDataOzone>> default_cursors_;
DISALLOW_COPY_AND_ASSIGN(CursorDataFactoryOzone);
};
} // namespace ui
#endif // UI_BASE_CURSOR_OZONE_CURSORD_DATA_FACTORY_OZONE_H_
......@@ -4,37 +4,30 @@
#include "ui/ozone/public/cursor_factory_ozone.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/threading/thread_local.h"
namespace ui {
namespace {
// TODO(mfomitchev): crbug.com/741106
// Until the above bug is fixed, CursorFactoryOzone singleton needs to be
// thread-local, because Ash creates its own instance.
base::LazyInstance<base::ThreadLocalPointer<CursorFactoryOzone>>::Leaky
lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER;
CursorFactoryOzone* g_instance = nullptr;
} // namespace
CursorFactoryOzone::CursorFactoryOzone() {
DCHECK(!lazy_tls_ptr.Pointer()->Get())
DCHECK(!g_instance)
<< "There should only be a single CursorFactoryOzone per thread.";
lazy_tls_ptr.Pointer()->Set(this);
g_instance = this;
}
CursorFactoryOzone::~CursorFactoryOzone() {
DCHECK_EQ(lazy_tls_ptr.Pointer()->Get(), this);
lazy_tls_ptr.Pointer()->Set(nullptr);
DCHECK_EQ(g_instance, this);
g_instance = nullptr;
}
CursorFactoryOzone* CursorFactoryOzone::GetInstance() {
CursorFactoryOzone* result = lazy_tls_ptr.Pointer()->Get();
DCHECK(result) << "No CursorFactoryOzone implementation set.";
return result;
DCHECK(g_instance);
return g_instance;
}
PlatformCursor CursorFactoryOzone::GetDefaultCursor(CursorType type) {
......
......@@ -39,10 +39,6 @@
#include "ui/wm/core/window_util.h"
#include "ui/wm/public/activation_client.h"
#if defined(USE_OZONE)
#include "ui/base/cursor/ozone/cursor_data_factory_ozone.h"
#endif
namespace views {
namespace {
......@@ -174,15 +170,10 @@ class NativeCursorManagerMus : public wm::NativeCursorManager {
void SetCursor(gfx::NativeCursor cursor,
wm::NativeCursorManagerDelegate* delegate) override {
ui::CursorData mojo_cursor;
if (cursor.platform()) {
#if defined(USE_OZONE)
if (cursor.native_type() == ui::CursorType::kCustom) {
mojo_cursor =
ui::CursorDataFactoryOzone::GetCursorData(cursor.platform());
#else
NOTIMPLEMENTED()
<< "Can't pass native platform cursors on non-ozone platforms";
mojo_cursor = ui::CursorData(ui::CursorType::kPointer);
#endif
ui::CursorData(cursor.GetHotspot(), {cursor.GetBitmap()},
cursor.device_scale_factor(), base::TimeDelta());
} else {
mojo_cursor = ui::CursorData(cursor.native_type());
}
......
......@@ -35,10 +35,6 @@
#include "ui/wm/core/shadow_types.h"
#include "ui/wm/core/wm_state.h"
#if defined(USE_OZONE)
#include "ui/base/cursor/ozone/cursor_data_factory_ozone.h"
#endif
// Widget::InitParams::Type must match that of ws::mojom::WindowType.
#define WINDOW_TYPES_MATCH(NAME) \
static_assert( \
......@@ -72,17 +68,6 @@ MusClient::MusClient(const InitParams& params) : identity_(params.identity) {
DCHECK(aura::Env::GetInstance());
instance_ = this;
#if defined(USE_OZONE)
// If we're in a mus client, we aren't going to have all of ozone initialized
// even though we're in an ozone build. All the hard coded USE_OZONE ifdefs
// that handle cursor code expect that there will be a CursorFactoryOzone
// instance. Partially initialize the ozone cursor internals here, like we
// partially initialize other ozone subsystems in
// ChromeBrowserMainExtraPartsViews.
if (params.create_cursor_factory)
cursor_factory_ozone_ = std::make_unique<ui::CursorDataFactoryOzone>();
#endif
property_converter_ = std::make_unique<aura::PropertyConverter>();
property_converter_->RegisterPrimitiveProperty(
::wm::kShadowElevationKey,
......
......@@ -33,10 +33,6 @@ namespace service_manager {
class Connector;
}
namespace ui {
class CursorDataFactoryOzone;
}
namespace wm {
class WMState;
}
......@@ -79,9 +75,6 @@ class VIEWS_MUS_EXPORT MusClient : public aura::WindowTreeClientDelegate,
// have one.
bool create_wm_state = true;
// Tests may need to control objects owned by MusClient.
bool create_cursor_factory = true;
// If provided, MusClient will not create the WindowTreeClient. Not owned.
// Must outlive MusClient.
aura::WindowTreeClient* window_tree_client = nullptr;
......@@ -179,10 +172,6 @@ class VIEWS_MUS_EXPORT MusClient : public aura::WindowTreeClientDelegate,
base::ObserverList<MusClientObserver>::Unchecked observer_list_;
#if defined(USE_OZONE)
std::unique_ptr<ui::CursorDataFactoryOzone> cursor_factory_ozone_;
#endif
// NOTE: this may be null (creation is based on argument supplied to
// constructor).
std::unique_ptr<wm::WMState> wm_state_;
......
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