Chromium Code Reviews| Index: ui/wm/public/text_edit_command_x11.h |
| diff --git a/ui/wm/public/text_edit_command_x11.h b/ui/wm/public/text_edit_command_x11.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..91828e4da066a2c22fbcb323641733959b0bef8f |
| --- /dev/null |
| +++ b/ui/wm/public/text_edit_command_x11.h |
| @@ -0,0 +1,83 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_WM_PUBLIC_TEXT_EDIT_COMMAND_X11_H_ |
|
sky
2014/03/31 20:44:05
I tend to feel these classes are not particularly
|
| +#define UI_WM_PUBLIC_TEXT_EDIT_COMMAND_X11_H_ |
| + |
| +#include <string> |
| + |
| +#include "ui/wm/core/wm_core_export.h" |
| + |
| +namespace ui { |
| +namespace wm { |
| + |
| +// Represents a command that performs a specific transformation on text. |
| +class WM_CORE_EXPORT TextEditCommandX11 { |
|
sky
2014/03/31 20:44:05
Document copy and assignment explicitly allowed.
|
| + public: |
| + enum CommandId { |
| + COPY, |
| + CUT, |
| + DELETE_BACKWARD, |
| + DELETE_FORWARD, |
| + DELETE_TO_BEGINING_OF_LINE, |
| + DELETE_TO_BEGINING_OF_PARAGRAPH, |
| + DELETE_TO_END_OF_LINE, |
| + DELETE_TO_END_OF_PARAGRAPH, |
| + DELETE_WORD_BACKWARD, |
| + DELETE_WORD_FORWARD, |
| + INSERT_TEXT, |
| + MOVE_BACKWARD, |
| + MOVE_DOWN, |
| + MOVE_FORWARD, |
| + MOVE_LEFT, |
| + MOVE_PAGE_DOWN, |
| + MOVE_PAGE_UP, |
| + MOVE_RIGHT, |
| + MOVE_TO_BEGINING_OF_DOCUMENT, |
| + MOVE_TO_BEGINING_OF_LINE, |
| + MOVE_TO_BEGINING_OF_PARAGRAPH, |
| + MOVE_TO_END_OF_DOCUMENT, |
| + MOVE_TO_END_OF_LINE, |
| + MOVE_TO_END_OF_PARAGRAPH, |
| + MOVE_UP, |
| + MOVE_WORD_BACKWARD, |
| + MOVE_WORD_FORWARD, |
| + MOVE_WORD_LEFT, |
| + MOVE_WORD_RIGHT, |
| + PASTE, |
| + SELECT_ALL, |
| + SET_MARK, |
| + UNSELECT, |
| + INVALID_COMMAND, |
| + }; |
| + |
| + TextEditCommandX11(CommandId command_id, |
| + const std::string& argument, |
| + bool extend_selection) |
| + : command_id_(command_id), |
| + argument_(argument), |
| + extend_selection_(extend_selection) {} |
| + |
| + CommandId command_id() const { return command_id_; } |
| + std::string argument() const { return argument_; } |
|
sky
2014/03/31 20:44:05
const std::string&
|
| + bool extend_selection() const { return extend_selection_; } |
| + |
| + // We communicate these commands back to blink with a string representation. |
| + // This will combine the base command name with "AndModifySelection" if we |
| + // have |extend_selection_| set. |
| + std::string GetCommandString() const; |
| + |
| + private: |
| + CommandId command_id_; |
|
sky
2014/03/31 20:44:05
const (same for 74).
Elliot Glaysher
2014/03/31 21:40:09
You can't have const members for classes which can
|
| + |
| + std::string argument_; |
| + |
| + // In addition to executing the command, modify the selection. |
| + bool extend_selection_; |
| +}; |
| + |
| +} // namespace wm |
| +} // namespace ui |
| + |
| +#endif // UI_WM_PUBLIC_TEXT_EDIT_COMMAND_X11_H_ |