diff options
author | sammc <sammc@chromium.org> | 2016-01-20 21:30:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-21 05:31:02 +0000 |
commit | 16fb38a8b87fe700645055e472d84de7aefe48a5 (patch) | |
tree | 02d83267f9a8a9f8e182c6a857347a7a683e81e6 /ui/views | |
parent | c8a1187b4dfc11061d8ba792c73225196c56c6aa (diff) | |
download | chromium_src-16fb38a8b87fe700645055e472d84de7aefe48a5.zip chromium_src-16fb38a8b87fe700645055e472d84de7aefe48a5.tar.gz chromium_src-16fb38a8b87fe700645055e472d84de7aefe48a5.tar.bz2 |
Change mojo enums to be scoped enums in the generated C++ bindings.
Some mojo enums were previously not proper enums: they were constants
for bitfields. These have been replaced by const int32s in the mojoms:
- mus.mojom.EventFlags
- mus.mojom.MouseEventFlags
- mus.mojom.ResizeBehavior
- mus.mojom.WindowTree.AccessPolicy
Some mojo enum values now conflict with macros (mostly on Windows) and
needed to change:
- mus.mojom.Cursor.NULL became CURSOR_NULL (again)
- mus.mojom.KeyboardCode.DELETE became DELETE_KEY
- mus.mojom.WindowManagerErrorCode.ERROR_ACCESS_DENIED became
ACCESS_DENIED
- device.usb.TransferDirection.IN became INBOUND
- device.usb.TransferDirection.OUT became OUTBOUND
- device.usb.TransferStatus.ERROR became TRANSFER_ERROR
- device.NFCRecordType.OPAQUE became OPAQUE_RECORD
- media.interfaces.Decryptor.Status.ERROR became DECRYPTION_ERROR
- skia.AlphaType.OPAQUE became ALPHA_TYPE_OPAQUE
Review URL: https://codereview.chromium.org/1527183003
Cr-Commit-Position: refs/heads/master@{#370632}
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/mus/native_widget_mus.cc | 16 | ||||
-rw-r--r-- | ui/views/mus/platform_window_mus.cc | 23 | ||||
-rw-r--r-- | ui/views/mus/window_manager_connection.cc | 10 | ||||
-rw-r--r-- | ui/views/mus/window_manager_constants_converters.cc | 20 |
4 files changed, 35 insertions, 34 deletions
diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc index 11b77a2..4efb593 100644 --- a/ui/views/mus/native_widget_mus.cc +++ b/ui/views/mus/native_widget_mus.cc @@ -155,16 +155,15 @@ class ClientSideNonClientFrameView : public NonClientFrameView { DISALLOW_COPY_AND_ASSIGN(ClientSideNonClientFrameView); }; -mus::mojom::ResizeBehavior ResizeBehaviorFromDelegate( - WidgetDelegate* delegate) { - int32_t behavior = mus::mojom::RESIZE_BEHAVIOR_NONE; +int ResizeBehaviorFromDelegate(WidgetDelegate* delegate) { + int32_t behavior = mus::mojom::kResizeBehaviorNone; if (delegate->CanResize()) - behavior |= mus::mojom::RESIZE_BEHAVIOR_CAN_RESIZE; + behavior |= mus::mojom::kResizeBehaviorCanResize; if (delegate->CanMaximize()) - behavior |= mus::mojom::RESIZE_BEHAVIOR_CAN_MAXIMIZE; + behavior |= mus::mojom::kResizeBehaviorCanMaximize; if (delegate->CanMinimize()) - behavior |= mus::mojom::RESIZE_BEHAVIOR_CAN_MINIMIZE; - return static_cast<mus::mojom::ResizeBehavior>(behavior); + behavior |= mus::mojom::kResizeBehaviorCanMinimize; + return behavior; } } // namespace @@ -255,7 +254,8 @@ void NativeWidgetMus::ConfigurePropertiesForNewWindow( (*properties)[mus::mojom::WindowManager::kWindowType_Property] = mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( - mojo::ConvertTo<mus::mojom::WindowType>(init_params.type)); + static_cast<int32_t>( + mojo::ConvertTo<mus::mojom::WindowType>(init_params.type))); (*properties)[mus::mojom::WindowManager::kResizeBehavior_Property] = mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( ResizeBehaviorFromDelegate(init_params.delegate)); diff --git a/ui/views/mus/platform_window_mus.cc b/ui/views/mus/platform_window_mus.cc index 2f29180..407d820 100644 --- a/ui/views/mus/platform_window_mus.cc +++ b/ui/views/mus/platform_window_mus.cc @@ -23,8 +23,8 @@ PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate, mus::Window* mus_window) : delegate_(delegate), mus_window_(mus_window), - show_state_(mus::mojom::SHOW_STATE_RESTORED), - last_cursor_(mus::mojom::CURSOR_NULL), + show_state_(mus::mojom::ShowState::RESTORED), + last_cursor_(mus::mojom::Cursor::CURSOR_NULL), has_capture_(false), mus_window_destroyed_(false) { DCHECK(delegate_); @@ -111,15 +111,15 @@ void PlatformWindowMus::ToggleFullscreen() { } void PlatformWindowMus::Maximize() { - SetShowState(mus::mojom::SHOW_STATE_MAXIMIZED); + SetShowState(mus::mojom::ShowState::MAXIMIZED); } void PlatformWindowMus::Minimize() { - SetShowState(mus::mojom::SHOW_STATE_MINIMIZED); + SetShowState(mus::mojom::ShowState::MINIMIZED); } void PlatformWindowMus::Restore() { - SetShowState(mus::mojom::SHOW_STATE_RESTORED); + SetShowState(mus::mojom::ShowState::RESTORED); } void PlatformWindowMus::SetCursor(ui::PlatformCursor cursor) { @@ -140,7 +140,8 @@ ui::PlatformImeController* PlatformWindowMus::GetPlatformImeController() { void PlatformWindowMus::SetShowState(mus::mojom::ShowState show_state) { mus_window_->SetSharedProperty<int32_t>( - mus::mojom::WindowManager::kShowState_Property, show_state); + mus::mojom::WindowManager::kShowState_Property, + static_cast<int32_t>(show_state)); } void PlatformWindowMus::OnWindowDestroyed(mus::Window* window) { @@ -193,17 +194,17 @@ void PlatformWindowMus::OnWindowSharedPropertyChanged( show_state_ = show_state; ui::PlatformWindowState state = ui::PLATFORM_WINDOW_STATE_UNKNOWN; switch (show_state_) { - case mus::mojom::SHOW_STATE_MINIMIZED: + case mus::mojom::ShowState::MINIMIZED: state = ui::PLATFORM_WINDOW_STATE_MINIMIZED; break; - case mus::mojom::SHOW_STATE_MAXIMIZED: + case mus::mojom::ShowState::MAXIMIZED: state = ui::PLATFORM_WINDOW_STATE_MAXIMIZED; break; - case mus::mojom::SHOW_STATE_RESTORED: + case mus::mojom::ShowState::RESTORED: state = ui::PLATFORM_WINDOW_STATE_NORMAL; break; - case mus::mojom::SHOW_STATE_IMMERSIVE: - case mus::mojom::SHOW_STATE_PRESENTATION: + case mus::mojom::ShowState::IMMERSIVE: + case mus::mojom::ShowState::PRESENTATION: // This may not be sufficient. state = ui::PLATFORM_WINDOW_STATE_FULLSCREEN; break; diff --git a/ui/views/mus/window_manager_connection.cc b/ui/views/mus/window_manager_connection.cc index 2865347..b13c09e 100644 --- a/ui/views/mus/window_manager_connection.cc +++ b/ui/views/mus/window_manager_connection.cc @@ -28,13 +28,13 @@ namespace mojo { gfx::Display::Rotation GFXRotationFromMojomRotation( mus::mojom::Rotation input) { switch (input) { - case mus::mojom::ROTATION_VALUE_0: + case mus::mojom::Rotation::VALUE_0: return gfx::Display::ROTATE_0; - case mus::mojom::ROTATION_VALUE_90: + case mus::mojom::Rotation::VALUE_90: return gfx::Display::ROTATE_90; - case mus::mojom::ROTATION_VALUE_180: + case mus::mojom::Rotation::VALUE_180: return gfx::Display::ROTATE_180; - case mus::mojom::ROTATION_VALUE_270: + case mus::mojom::Rotation::VALUE_270: return gfx::Display::ROTATE_270; } return gfx::Display::ROTATE_0; @@ -157,7 +157,7 @@ NativeWidget* WindowManagerConnection::CreateNativeWidget( std::map<std::string, std::vector<uint8_t>> properties; NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &properties); return new NativeWidgetMus(delegate, app_->shell(), NewWindow(properties), - mus::mojom::SURFACE_TYPE_DEFAULT); + mus::mojom::SurfaceType::DEFAULT); } } // namespace views diff --git a/ui/views/mus/window_manager_constants_converters.cc b/ui/views/mus/window_manager_constants_converters.cc index 80e6d1f..8897376 100644 --- a/ui/views/mus/window_manager_constants_converters.cc +++ b/ui/views/mus/window_manager_constants_converters.cc @@ -12,25 +12,25 @@ TypeConverter<mus::mojom::WindowType, views::Widget::InitParams::Type>::Convert( views::Widget::InitParams::Type type) { switch (type) { case views::Widget::InitParams::TYPE_WINDOW: - return mus::mojom::WINDOW_TYPE_WINDOW; + return mus::mojom::WindowType::WINDOW; case views::Widget::InitParams::TYPE_PANEL: - return mus::mojom::WINDOW_TYPE_PANEL; + return mus::mojom::WindowType::PANEL; case views::Widget::InitParams::TYPE_WINDOW_FRAMELESS: - return mus::mojom::WINDOW_TYPE_WINDOW_FRAMELESS; + return mus::mojom::WindowType::WINDOW_FRAMELESS; case views::Widget::InitParams::TYPE_CONTROL: - return mus::mojom::WINDOW_TYPE_CONTROL; + return mus::mojom::WindowType::CONTROL; case views::Widget::InitParams::TYPE_POPUP: - return mus::mojom::WINDOW_TYPE_POPUP; + return mus::mojom::WindowType::POPUP; case views::Widget::InitParams::TYPE_MENU: - return mus::mojom::WINDOW_TYPE_MENU; + return mus::mojom::WindowType::MENU; case views::Widget::InitParams::TYPE_TOOLTIP: - return mus::mojom::WINDOW_TYPE_TOOLTIP; + return mus::mojom::WindowType::TOOLTIP; case views::Widget::InitParams::TYPE_BUBBLE: - return mus::mojom::WINDOW_TYPE_BUBBLE; + return mus::mojom::WindowType::BUBBLE; case views::Widget::InitParams::TYPE_DRAG: - return mus::mojom::WINDOW_TYPE_DRAG; + return mus::mojom::WindowType::DRAG; } - return mus::mojom::WINDOW_TYPE_POPUP; + return mus::mojom::WindowType::POPUP; } } // namespace mojo |