Commit 942700d1 authored by Hwanseung Lee's avatar Hwanseung Lee Committed by Commit Bot

Convert enum to enum class for SourceState

Use enum class instead of enum for
DesktopDragDropClientAuraX11::SourceState
enum class is more type safety.

Bug: 940736
Change-Id: Ib5365bbfda80b10301f6b6b6d25975e44b7e745a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713546Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Hwanseung Lee <hs1217.lee@samsung.com>
Cr-Commit-Position: refs/heads/master@{#681129}
parent 3ca5e1ab
...@@ -591,8 +591,8 @@ void DesktopDragDropClientAuraX11::OnXdndStatus( ...@@ -591,8 +591,8 @@ void DesktopDragDropClientAuraX11::OnXdndStatus(
if (source_window != source_current_window_) if (source_window != source_current_window_)
return; return;
if (source_state_ != SOURCE_STATE_PENDING_DROP && if (source_state_ != SourceState::kPendingDrop &&
source_state_ != SOURCE_STATE_OTHER) { source_state_ != SourceState::kOther) {
return; return;
} }
...@@ -606,13 +606,13 @@ void DesktopDragDropClientAuraX11::OnXdndStatus( ...@@ -606,13 +606,13 @@ void DesktopDragDropClientAuraX11::OnXdndStatus(
negotiated_operation_ = ui::DragDropTypes::DRAG_NONE; negotiated_operation_ = ui::DragDropTypes::DRAG_NONE;
} }
if (source_state_ == SOURCE_STATE_PENDING_DROP) { if (source_state_ == SourceState::kPendingDrop) {
// We were waiting on the status message so we could send the XdndDrop. // We were waiting on the status message so we could send the XdndDrop.
if (negotiated_operation_ == ui::DragDropTypes::DRAG_NONE) { if (negotiated_operation_ == ui::DragDropTypes::DRAG_NONE) {
move_loop_->EndMoveLoop(); move_loop_->EndMoveLoop();
return; return;
} }
source_state_ = SOURCE_STATE_DROPPED; source_state_ = SourceState::kDropped;
SendXdndDrop(source_window); SendXdndDrop(source_window);
return; return;
} }
...@@ -744,7 +744,7 @@ int DesktopDragDropClientAuraX11::StartDragAndDrop( ...@@ -744,7 +744,7 @@ int DesktopDragDropClientAuraX11::StartDragAndDrop(
waiting_on_status_ = false; waiting_on_status_ = false;
next_position_message_.reset(); next_position_message_.reset();
status_received_since_enter_ = false; status_received_since_enter_ = false;
source_state_ = SOURCE_STATE_OTHER; source_state_ = SourceState::kOther;
drag_operation_ = operation; drag_operation_ = operation;
negotiated_operation_ = ui::DragDropTypes::DRAG_NONE; negotiated_operation_ = ui::DragDropTypes::DRAG_NONE;
...@@ -863,7 +863,7 @@ void DesktopDragDropClientAuraX11::OnMouseMovement( ...@@ -863,7 +863,7 @@ void DesktopDragDropClientAuraX11::OnMouseMovement(
void DesktopDragDropClientAuraX11::OnMouseReleased() { void DesktopDragDropClientAuraX11::OnMouseReleased() {
repeat_mouse_move_timer_.Stop(); repeat_mouse_move_timer_.Stop();
if (source_state_ != SOURCE_STATE_OTHER) { if (source_state_ != SourceState::kOther) {
// The user has previously released the mouse and is clicking in // The user has previously released the mouse and is clicking in
// frustration. // frustration.
move_loop_->EndMoveLoop(); move_loop_->EndMoveLoop();
...@@ -875,7 +875,7 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() { ...@@ -875,7 +875,7 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() {
if (status_received_since_enter_) { if (status_received_since_enter_) {
// If we are waiting for an XdndStatus message, we need to wait for it // If we are waiting for an XdndStatus message, we need to wait for it
// to complete. // to complete.
source_state_ = SOURCE_STATE_PENDING_DROP; source_state_ = SourceState::kPendingDrop;
// Start timer to end the move loop if the target takes too long to send // Start timer to end the move loop if the target takes too long to send
// the XdndStatus and XdndFinished messages. // the XdndStatus and XdndFinished messages.
...@@ -896,7 +896,7 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() { ...@@ -896,7 +896,7 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() {
StartEndMoveLoopTimer(); StartEndMoveLoopTimer();
// We have negotiated an action with the other end. // We have negotiated an action with the other end.
source_state_ = SOURCE_STATE_DROPPED; source_state_ = SourceState::kDropped;
SendXdndDrop(source_current_window_); SendXdndDrop(source_current_window_);
return; return;
} }
...@@ -989,7 +989,7 @@ void DesktopDragDropClientAuraX11::SendXClientEvent(::Window xid, ...@@ -989,7 +989,7 @@ void DesktopDragDropClientAuraX11::SendXClientEvent(::Window xid,
void DesktopDragDropClientAuraX11::ProcessMouseMove( void DesktopDragDropClientAuraX11::ProcessMouseMove(
const gfx::Point& screen_point, const gfx::Point& screen_point,
unsigned long event_time) { unsigned long event_time) {
if (source_state_ != SOURCE_STATE_OTHER) if (source_state_ != SourceState::kOther)
return; return;
// Find the current window the cursor is over. // Find the current window the cursor is over.
......
...@@ -122,19 +122,19 @@ class VIEWS_EXPORT DesktopDragDropClientAuraX11 ...@@ -122,19 +122,19 @@ class VIEWS_EXPORT DesktopDragDropClientAuraX11
Widget* drag_widget() { return drag_widget_.get(); } Widget* drag_widget() { return drag_widget_.get(); }
private: private:
enum SourceState { enum class SourceState {
// |source_current_window_| will receive a drop once we receive an // |source_current_window_| will receive a drop once we receive an
// XdndStatus from it. // XdndStatus from it.
SOURCE_STATE_PENDING_DROP, kPendingDrop,
// The move looped will be ended once we receive XdndFinished from // The move looped will be ended once we receive XdndFinished from
// |source_current_window_|. We should not send XdndPosition to // |source_current_window_|. We should not send XdndPosition to
// |source_current_window_| while in this state. // |source_current_window_| while in this state.
SOURCE_STATE_DROPPED, kDropped,
// There is no drag in progress or there is a drag in progress and the // There is no drag in progress or there is a drag in progress and the
// user has not yet released the mouse. // user has not yet released the mouse.
SOURCE_STATE_OTHER, kOther,
}; };
// Processes a mouse move at |screen_point|. // Processes a mouse move at |screen_point|.
...@@ -255,7 +255,7 @@ class VIEWS_EXPORT DesktopDragDropClientAuraX11 ...@@ -255,7 +255,7 @@ class VIEWS_EXPORT DesktopDragDropClientAuraX11
// Source side information. // Source side information.
ui::OSExchangeDataProviderAuraX11 const* source_provider_ = nullptr; ui::OSExchangeDataProviderAuraX11 const* source_provider_ = nullptr;
::Window source_current_window_ = x11::None; ::Window source_current_window_ = x11::None;
SourceState source_state_ = SOURCE_STATE_OTHER; SourceState source_state_ = SourceState::kOther;
// The current drag-drop client that has an active operation. Since we have // The current drag-drop client that has an active operation. Since we have
// multiple root windows and multiple DesktopDragDropClientAuraX11 instances // multiple root windows and multiple DesktopDragDropClientAuraX11 instances
......
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