Commit 08f840e8 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

Make ui::PlatformWindowType a enum class

Also dropped prefix from enum values names as they are not necesary
with enum class.

Change-Id: Iff808da768321a91a8b841db3aa133935ccab477
Reviewed-on: https://chromium-review.googlesource.com/1104789
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568527}
parent 0d30994a
...@@ -50,7 +50,7 @@ TEST_P(WaylandPointerTest, Leave) { ...@@ -50,7 +50,7 @@ TEST_P(WaylandPointerTest, Leave) {
.WillOnce(SaveArg<0>(&other_widget)); .WillOnce(SaveArg<0>(&other_widget));
PlatformWindowInitProperties properties; PlatformWindowInitProperties properties;
properties.bounds = gfx::Rect(0, 0, 10, 10); properties.bounds = gfx::Rect(0, 0, 10, 10);
properties.type = PlatformWindowType::PLATFORM_WINDOW_TYPE_WINDOW; properties.type = PlatformWindowType::kWindow;
ASSERT_TRUE(other_window.Initialize(std::move(properties))); ASSERT_TRUE(other_window.Initialize(std::move(properties)));
ASSERT_NE(other_widget, gfx::kNullAcceleratedWidget); ASSERT_NE(other_widget, gfx::kNullAcceleratedWidget);
......
...@@ -41,7 +41,7 @@ void WaylandTest::SetUp() { ...@@ -41,7 +41,7 @@ void WaylandTest::SetUp() {
.WillOnce(SaveArg<0>(&widget_)); .WillOnce(SaveArg<0>(&widget_));
PlatformWindowInitProperties properties; PlatformWindowInitProperties properties;
properties.bounds = gfx::Rect(0, 0, 800, 600); properties.bounds = gfx::Rect(0, 0, 800, 600);
properties.type = PlatformWindowType::PLATFORM_WINDOW_TYPE_WINDOW; properties.type = PlatformWindowType::kWindow;
ASSERT_TRUE(window_->Initialize(std::move(properties))); ASSERT_TRUE(window_->Initialize(std::move(properties)));
ASSERT_NE(widget_, gfx::kNullAcceleratedWidget); ASSERT_NE(widget_, gfx::kNullAcceleratedWidget);
......
...@@ -110,19 +110,16 @@ bool WaylandWindow::Initialize(PlatformWindowInitProperties properties) { ...@@ -110,19 +110,16 @@ bool WaylandWindow::Initialize(PlatformWindowInitProperties properties) {
ui::PlatformWindowType ui_window_type = properties.type; ui::PlatformWindowType ui_window_type = properties.type;
switch (ui_window_type) { switch (ui_window_type) {
case ui::PlatformWindowType::PLATFORM_WINDOW_TYPE_MENU: case ui::PlatformWindowType::kMenu:
case ui::PlatformWindowType::PLATFORM_WINDOW_TYPE_POPUP: case ui::PlatformWindowType::kPopup:
// TODO(msisov, jkim): Handle notification windows, which are marked // TODO(msisov, jkim): Handle notification windows, which are marked
// as popup windows as well. Those are the windows that do not have // as popup windows as well. Those are the windows that do not have
// parents and pop up when the browser receives a notification. // parents and pop up when the browser receives a notification.
CreateXdgPopup(); CreateXdgPopup();
break; break;
case ui::PlatformWindowType::PLATFORM_WINDOW_TYPE_WINDOW: case ui::PlatformWindowType::kWindow:
CreateXdgSurface(); CreateXdgSurface();
break; break;
default:
NOTREACHED() << "Not supported window type: type=" << ui_window_type;
break;
} }
connection_->ScheduleFlush(); connection_->ScheduleFlush();
......
...@@ -483,8 +483,8 @@ TEST_P(WaylandWindowTest, CreateAndDestroyMenuWindow) { ...@@ -483,8 +483,8 @@ TEST_P(WaylandWindowTest, CreateAndDestroyMenuWindow) {
EXPECT_CALL(menu_window_delegate, OnAcceleratedWidgetDestroyed()).Times(1); EXPECT_CALL(menu_window_delegate, OnAcceleratedWidgetDestroyed()).Times(1);
std::unique_ptr<WaylandWindow> menu_window = CreateWaylandWindowWithParams( std::unique_ptr<WaylandWindow> menu_window = CreateWaylandWindowWithParams(
PlatformWindowType::PLATFORM_WINDOW_TYPE_MENU, widget_, PlatformWindowType::kMenu, widget_, gfx::Rect(0, 0, 10, 10),
gfx::Rect(0, 0, 10, 10), &menu_window_delegate); &menu_window_delegate);
Sync(); Sync();
} }
...@@ -496,8 +496,8 @@ TEST_P(WaylandWindowTest, CreateAndDestroyNestedMenuWindow) { ...@@ -496,8 +496,8 @@ TEST_P(WaylandWindowTest, CreateAndDestroyNestedMenuWindow) {
.WillOnce(SaveArg<0>(&menu_window_widget)); .WillOnce(SaveArg<0>(&menu_window_widget));
std::unique_ptr<WaylandWindow> menu_window = CreateWaylandWindowWithParams( std::unique_ptr<WaylandWindow> menu_window = CreateWaylandWindowWithParams(
PlatformWindowType::PLATFORM_WINDOW_TYPE_MENU, widget_, PlatformWindowType::kMenu, widget_, gfx::Rect(0, 0, 10, 10),
gfx::Rect(0, 0, 10, 10), &menu_window_delegate); &menu_window_delegate);
ASSERT_NE(menu_window_widget, gfx::kNullAcceleratedWidget); ASSERT_NE(menu_window_widget, gfx::kNullAcceleratedWidget);
Sync(); Sync();
...@@ -505,7 +505,7 @@ TEST_P(WaylandWindowTest, CreateAndDestroyNestedMenuWindow) { ...@@ -505,7 +505,7 @@ TEST_P(WaylandWindowTest, CreateAndDestroyNestedMenuWindow) {
MockPlatformWindowDelegate nested_menu_window_delegate; MockPlatformWindowDelegate nested_menu_window_delegate;
std::unique_ptr<WaylandWindow> nested_menu_window = std::unique_ptr<WaylandWindow> nested_menu_window =
CreateWaylandWindowWithParams( CreateWaylandWindowWithParams(
PlatformWindowType::PLATFORM_WINDOW_TYPE_MENU, menu_window_widget, PlatformWindowType::kMenu, menu_window_widget,
gfx::Rect(20, 0, 10, 10), &nested_menu_window_delegate); gfx::Rect(20, 0, 10, 10), &nested_menu_window_delegate);
Sync(); Sync();
...@@ -514,8 +514,8 @@ TEST_P(WaylandWindowTest, CreateAndDestroyNestedMenuWindow) { ...@@ -514,8 +514,8 @@ TEST_P(WaylandWindowTest, CreateAndDestroyNestedMenuWindow) {
TEST_P(WaylandWindowTest, CanDispatchEventToMenuWindowNonNested) { TEST_P(WaylandWindowTest, CanDispatchEventToMenuWindowNonNested) {
MockPlatformWindowDelegate menu_window_delegate; MockPlatformWindowDelegate menu_window_delegate;
std::unique_ptr<WaylandWindow> menu_window = CreateWaylandWindowWithParams( std::unique_ptr<WaylandWindow> menu_window = CreateWaylandWindowWithParams(
PlatformWindowType::PLATFORM_WINDOW_TYPE_MENU, widget_, PlatformWindowType::kMenu, widget_, gfx::Rect(0, 0, 10, 10),
gfx::Rect(0, 0, 10, 10), &menu_window_delegate); &menu_window_delegate);
wl_seat_send_capabilities(server_.seat()->resource(), wl_seat_send_capabilities(server_.seat()->resource(),
WL_SEAT_CAPABILITY_POINTER); WL_SEAT_CAPABILITY_POINTER);
...@@ -539,15 +539,15 @@ TEST_P(WaylandWindowTest, CanDispatchEventToMenuWindowNested) { ...@@ -539,15 +539,15 @@ TEST_P(WaylandWindowTest, CanDispatchEventToMenuWindowNested) {
.WillOnce(SaveArg<0>(&menu_window_widget)); .WillOnce(SaveArg<0>(&menu_window_widget));
std::unique_ptr<WaylandWindow> menu_window = CreateWaylandWindowWithParams( std::unique_ptr<WaylandWindow> menu_window = CreateWaylandWindowWithParams(
PlatformWindowType::PLATFORM_WINDOW_TYPE_MENU, widget_, PlatformWindowType::kMenu, widget_, gfx::Rect(0, 0, 10, 10),
gfx::Rect(0, 0, 10, 10), &menu_window_delegate); &menu_window_delegate);
Sync(); Sync();
MockPlatformWindowDelegate nested_menu_window_delegate; MockPlatformWindowDelegate nested_menu_window_delegate;
std::unique_ptr<WaylandWindow> nested_menu_window = std::unique_ptr<WaylandWindow> nested_menu_window =
CreateWaylandWindowWithParams( CreateWaylandWindowWithParams(
PlatformWindowType::PLATFORM_WINDOW_TYPE_MENU, menu_window_widget, PlatformWindowType::kMenu, menu_window_widget,
gfx::Rect(20, 0, 10, 10), &nested_menu_window_delegate); gfx::Rect(20, 0, 10, 10), &nested_menu_window_delegate);
Sync(); Sync();
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
namespace ui { namespace ui {
enum PlatformWindowType { enum class PlatformWindowType {
PLATFORM_WINDOW_TYPE_WINDOW, kWindow,
PLATFORM_WINDOW_TYPE_POPUP, kPopup,
PLATFORM_WINDOW_TYPE_MENU, kMenu,
}; };
// Initial properties which are passed to PlatformWindow to be initialized // Initial properties which are passed to PlatformWindow to be initialized
...@@ -32,7 +32,7 @@ struct PlatformWindowInitProperties { ...@@ -32,7 +32,7 @@ struct PlatformWindowInitProperties {
~PlatformWindowInitProperties(); ~PlatformWindowInitProperties();
// Tells desired PlatformWindow type. It can be popup, menu or anything else. // Tells desired PlatformWindow type. It can be popup, menu or anything else.
PlatformWindowType type = PlatformWindowType::PLATFORM_WINDOW_TYPE_WINDOW; PlatformWindowType type = PlatformWindowType::kWindow;
// Sets the desired initial bounds. Can be empty. // Sets the desired initial bounds. Can be empty.
gfx::Rect bounds; gfx::Rect bounds;
// Tells PlatformWindow which native widget its parent holds. It is usually // Tells PlatformWindow which native widget its parent holds. It is usually
......
...@@ -27,15 +27,15 @@ ui::PlatformWindowInitProperties ConvertWidgetInitParamsToInitProperties( ...@@ -27,15 +27,15 @@ ui::PlatformWindowInitProperties ConvertWidgetInitParamsToInitProperties(
switch (params.type) { switch (params.type) {
case Widget::InitParams::TYPE_WINDOW: case Widget::InitParams::TYPE_WINDOW:
properties.type = ui::PlatformWindowType::PLATFORM_WINDOW_TYPE_WINDOW; properties.type = ui::PlatformWindowType::kWindow;
break; break;
case Widget::InitParams::TYPE_MENU: case Widget::InitParams::TYPE_MENU:
properties.type = ui::PlatformWindowType::PLATFORM_WINDOW_TYPE_MENU; properties.type = ui::PlatformWindowType::kMenu;
break; break;
default: default:
properties.type = ui::PlatformWindowType::PLATFORM_WINDOW_TYPE_POPUP; properties.type = ui::PlatformWindowType::kPopup;
break; break;
} }
......
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