Commit f554bc80 authored by danakj's avatar danakj Committed by Commit Bot

Remove unused includes of gfx/skia legacy IPC traits headers.

Convert RenderWidgetHostNSView mojom to use ui::Cursor instead of
WebCursor. Then WebCursor is no longer used, which was previously using
the SkBitmap param traits..

R=dcheng@chromium.org
TBR=inferno@chromium.org

Bug: 1144462
Change-Id: I5f06739475e5421ba5f6acdca985bf0e03182744
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523334Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Auto-Submit: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826314}
parent 69eed9a0
per-file *_messages*.h=set noparent
per-file *_messages*.h=file://ipc/SECURITY_OWNERS
per-file *_messages.cc=set noparent
per-file *_messages.cc=file://ipc/SECURITY_OWNERS
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
per-file *_mojom_traits*.*=set noparent
......
......@@ -3,9 +3,3 @@
// found in the LICENSE file.
#include "android_webview/common/render_view_messages.h"
namespace IPC {
// TODO - add enums and custom IPC traits here when needed.
} // namespace IPC
......@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Multiply-included file, no traditional include guard.
// no-include-guard-because-multiply-included
#include "android_webview/common/aw_hit_test_data.h"
#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_channel_handle.h"
......@@ -14,18 +15,6 @@
#include "ui/gfx/ipc/geometry/gfx_param_traits.h"
#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
// Singly-included section for enums and custom IPC traits.
#ifndef ANDROID_WEBVIEW_COMMON_RENDER_VIEW_MESSAGES_H_
#define ANDROID_WEBVIEW_COMMON_RENDER_VIEW_MESSAGES_H_
namespace IPC {
// TODO - add enums and custom IPC traits here when needed.
} // namespace IPC
#endif // ANDROID_WEBVIEW_COMMON_RENDER_VIEW_MESSAGES_H_
IPC_STRUCT_TRAITS_BEGIN(android_webview::AwHitTestData)
IPC_STRUCT_TRAITS_MEMBER(type)
IPC_STRUCT_TRAITS_MEMBER(extra_data_for_type)
......
......@@ -25,7 +25,6 @@
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/ipc/geometry/gfx_param_traits.h"
#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
#ifndef INTERNAL_COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
#define INTERNAL_COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
......
......@@ -59,7 +59,7 @@ class RenderWidgetHostNSViewBridge : public mojom::RenderWidgetHostNSView,
void SetCompositionRangeInfo(const gfx::Range& range) override;
void CancelComposition() override;
void SetShowingContextMenu(bool showing) override;
void DisplayCursor(const content::WebCursor& cursor) override;
void DisplayCursor(const ui::Cursor& cursor) override;
void SetCursorLocked(bool locked) override;
void SetCursorLockedUnacceleratedMovement(bool unaccelerated) override;
void ShowDictionaryOverlayForSelection() override;
......
......@@ -224,10 +224,8 @@ void RenderWidgetHostNSViewBridge::OnDisplayMetricsChanged(
[cocoa_view_ updateScreenProperties];
}
void RenderWidgetHostNSViewBridge::DisplayCursor(
const content::WebCursor& cursor) {
content::WebCursor non_const_cursor(cursor);
[cocoa_view_ updateCursor:non_const_cursor.GetNativeCursor()];
void RenderWidgetHostNSViewBridge::DisplayCursor(const ui::Cursor& cursor) {
[cocoa_view_ updateCursor:content::WebCursor(cursor).GetNativeCursor()];
}
void RenderWidgetHostNSViewBridge::SetCursorLocked(bool locked) {
......
......@@ -538,7 +538,7 @@ void RenderWidgetHostViewMac::UpdateCursor(const WebCursor& cursor) {
}
void RenderWidgetHostViewMac::DisplayCursor(const WebCursor& cursor) {
ns_view_->DisplayCursor(cursor);
ns_view_->DisplayCursor(cursor.cursor());
}
CursorManager* RenderWidgetHostViewMac::GetCursorManager() {
......
......@@ -692,7 +692,10 @@ mojom("mojo_bindings") {
"sandbox_support_mac.mojom",
"web_contents_ns_view_bridge.mojom",
]
public_deps += [ "//ui/display/mojom" ]
public_deps += [
"//ui/base/cursor/mojom",
"//ui/display/mojom",
]
cpp_typemaps += [
{
types = [
......
......@@ -27,8 +27,6 @@
#include "printing/page_range.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
......@@ -269,20 +267,3 @@ TEST(IPCMessageTest, SurfaceInfo) {
ASSERT_EQ(surface_info_in, surface_info_out);
}
TEST(IPCMessageTest, WebCursor) {
ui::Cursor cursor(ui::mojom::CursorType::kCustom);
SkBitmap bitmap;
bitmap.allocN32Pixels(32, 32);
cursor.set_custom_bitmap(bitmap);
cursor.set_custom_hotspot(gfx::Point(10, 20));
cursor.set_image_scale_factor(1.5f);
content::WebCursor input(cursor);
IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
IPC::ParamTraits<content::WebCursor>::Write(&msg, input);
content::WebCursor output;
base::PickleIterator iter(msg);
ASSERT_TRUE(IPC::ParamTraits<content::WebCursor>::Read(&msg, &iter, &output));
EXPECT_EQ(output, input);
}
......@@ -23,52 +23,9 @@
#include "third_party/blink/public/common/messaging/transferable_message.h"
#include "third_party/blink/public/mojom/feature_policy/policy_value.mojom.h"
#include "ui/accessibility/ax_mode.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
namespace IPC {
void ParamTraits<content::WebCursor>::Write(base::Pickle* m,
const param_type& p) {
WriteParam(m, p.cursor().type());
if (p.cursor().type() == ui::mojom::CursorType::kCustom) {
WriteParam(m, p.cursor().custom_hotspot());
WriteParam(m, p.cursor().image_scale_factor());
WriteParam(m, p.cursor().custom_bitmap());
}
}
bool ParamTraits<content::WebCursor>::Read(const base::Pickle* m,
base::PickleIterator* iter,
param_type* r) {
ui::mojom::CursorType type;
if (!ReadParam(m, iter, &type))
return false;
ui::Cursor cursor(type);
if (cursor.type() == ui::mojom::CursorType::kCustom) {
gfx::Point hotspot;
float image_scale_factor;
SkBitmap bitmap;
if (!ReadParam(m, iter, &hotspot) ||
!ReadParam(m, iter, &image_scale_factor) ||
!ReadParam(m, iter, &bitmap)) {
return false;
}
cursor.set_custom_hotspot(hotspot);
cursor.set_image_scale_factor(image_scale_factor);
cursor.set_custom_bitmap(bitmap);
}
return r->SetCursor(cursor);
}
void ParamTraits<content::WebCursor>::Log(const param_type& p, std::string* l) {
l->append("<WebCursor>");
}
void ParamTraits<blink::MessagePortChannel>::Write(base::Pickle* m,
const param_type& p) {
ParamTraits<blink::MessagePortDescriptor>::Write(m, p.ReleaseHandle());
......
......@@ -17,7 +17,6 @@
#include "base/memory/ref_counted.h"
#include "cc/ipc/cc_param_traits_macros.h"
#include "content/common/content_param_traits_macros.h"
#include "content/common/cursors/webcursor.h"
#include "ipc/ipc_mojo_param_traits.h"
#include "net/base/hash_value.h"
#include "ui/accessibility/ax_mode.h"
......@@ -37,16 +36,6 @@ class SurfaceInfo;
namespace IPC {
template <>
struct CONTENT_EXPORT ParamTraits<content::WebCursor> {
typedef content::WebCursor param_type;
static void Write(base::Pickle* m, const param_type& p);
static bool Read(const base::Pickle* m,
base::PickleIterator* iter,
param_type* r);
static void Log(const param_type& p, std::string* l);
};
template <>
struct CONTENT_EXPORT ParamTraits<blink::MessagePortChannel> {
typedef blink::MessagePortChannel param_type;
......
......@@ -71,7 +71,6 @@
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/ipc/color/gfx_param_traits.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
#include "url/gurl.h"
#include "url/origin.h"
......
......@@ -30,7 +30,6 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/vector2d_f.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
#include "ui/gfx/range/range.h"
#include "ui/latency/ipc/latency_info_param_traits.h"
......
......@@ -4,10 +4,10 @@
module remote_cocoa.mojom;
import "content/common/native_types.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "third_party/blink/public/mojom/input/input_handler.mojom";
import "ui/base/mojom/attributed_string.mojom";
import "ui/base/cursor/mojom/cursor.mojom";
import "ui/base/ime/mojom/ime_types.mojom";
import "ui/display/mojom/display.mojom";
import "ui/events/mojom/event.mojom";
......@@ -69,7 +69,7 @@ interface RenderWidgetHostNSView {
SetShowingContextMenu(bool showing);
// Set the cursor type to display.
DisplayCursor(content.mojom.WebCursor cursor);
DisplayCursor(ui.mojom.Cursor cursor);
// Lock or unlock the cursor.
SetCursorLocked(bool locked);
......
......@@ -32,7 +32,6 @@
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/ipc/geometry/gfx_param_traits.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
#include "ui/gfx/transform.h"
#undef IPC_MESSAGE_EXPORT
......
......@@ -13,7 +13,6 @@
#include "media/base/limits.h"
#include "ui/gfx/ipc/geometry/gfx_param_traits.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
using media::AudioParameters;
using media::AudioLatency;
......
......@@ -294,4 +294,4 @@ interface PopupWidgetHost {
// Request that the browser change the bounds of the widget.
SetPopupBounds(gfx.mojom.Rect bounds) => ();
};
\ No newline at end of file
};
......@@ -29,8 +29,6 @@
#include "tools/ipc_fuzzer/fuzzer/rand_util.h"
#include "tools/ipc_fuzzer/message_lib/message_cracker.h"
#include "tools/ipc_fuzzer/message_lib/message_file.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
#include "ui/gfx/geometry/point.h"
#if defined(OS_POSIX)
......@@ -741,34 +739,6 @@ struct FuzzTraits<device::mojom::ScreenOrientationLockType> {
}
};
template <>
struct FuzzTraits<content::WebCursor> {
static bool Fuzz(content::WebCursor* p, Fuzzer* fuzzer) {
// |type| enum is not validated on de-serialization, so pick random value.
ui::mojom::CursorType type;
gfx::Point hotspot;
float image_scale_factor;
SkBitmap bitmap;
if (!FuzzParam(reinterpret_cast<int*>(&type), fuzzer) ||
!FuzzParam(&hotspot, fuzzer) ||
!FuzzParam(&image_scale_factor, fuzzer) || !FuzzParam(&bitmap, fuzzer))
return false;
ui::Cursor cursor(type);
cursor.set_custom_hotspot(hotspot);
cursor.set_custom_bitmap(bitmap);
// Scale factor is expected to be greater than 0, otherwise we hit
// a check failure.
image_scale_factor = fabs(image_scale_factor);
if (image_scale_factor <= 0.0)
image_scale_factor = 1;
cursor.set_image_scale_factor(fabs(image_scale_factor));
*p = content::WebCursor(cursor);
return true;
}
};
template <>
struct FuzzTraits<ContentSettingsPattern> {
static bool Fuzz(ContentSettingsPattern* p, Fuzzer* fuzzer) {
......
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