| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DragAndDropCommand_h | 5 #ifndef DragAndDropCommand_h |
| 6 #define DragAndDropCommand_h | 6 #define DragAndDropCommand_h |
| 7 | 7 |
| 8 #include "core/editing/commands/CompositeEditCommand.h" | 8 #include "core/editing/commands/CompositeEditCommand.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 // |DragAndDropCommand| is a dummy command. It doesn't do anything by itself, | 12 // |DragAndDropCommand| is a dummy command. It doesn't do anything by itself, |
| 13 // but will act as a catcher for the following |DeleteByDrag| and | 13 // but will act as a catcher for the following |DeleteByDrag| and |
| 14 // |InsertFromDrop| commands, and combine them into a single undo entry. | 14 // |InsertFromDrop| commands, and combine them into a single undo entry. |
| 15 // In the future when necessary, this mechanism can be generalized into a common | 15 // In the future when necessary, this mechanism can be generalized into a common |
| 16 // command wrapper to achieve undo group. | 16 // command wrapper to achieve undo group. |
| 17 class DragAndDropCommand final : public CompositeEditCommand { | 17 class DragAndDropCommand final : public CompositeEditCommand { |
| 18 public: | 18 public: |
| 19 static DragAndDropCommand* create(Document& document) { | 19 static DragAndDropCommand* create(Document& document, CommandSource source) { |
| 20 return new DragAndDropCommand(document); | 20 return new DragAndDropCommand(document, source); |
| 21 } | 21 } |
| 22 | 22 |
| 23 bool isCommandGroupWrapper() const override; | 23 bool isCommandGroupWrapper() const override; |
| 24 bool isDragAndDropCommand() const override; | 24 bool isDragAndDropCommand() const override; |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 explicit DragAndDropCommand(Document&); | 27 DragAndDropCommand(Document&, CommandSource); |
| 28 | 28 |
| 29 void doApply(EditingState*) override; | 29 void doApply(EditingState*) override; |
| 30 InputEvent::InputType inputType() const override; | 30 InputEvent::InputType inputType() const override; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 } // namespace blink | 33 } // namespace blink |
| 34 | 34 |
| 35 #endif // DragAndDropCommand_h | 35 #endif // DragAndDropCommand_h |
| OLD | NEW |