Commit ce8c7d52 authored by Rose Garcia's avatar Rose Garcia Committed by Commit Bot

Add buttons for Switch Access cut, copy, and paste


Adding the buttons and messages for the Switch Access cut, copy, and paste
functionality. This includes adding the image files for the icons, added
strings and translation screenshots, and adding the buttons into the menu
manager so they appear in the menu.

Bug: 982004
Change-Id: I35e9b3b3dfe48b1730c23317115ee96be89141bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1719292Reviewed-by: default avatarAnastasia Helfinstein <anastasi@google.com>
Commit-Queue: Rose Garcia <rosalindag@google.com>
Cr-Commit-Position: refs/heads/master@{#682453}
parent 979d355e
......@@ -37,6 +37,8 @@ run_jsbundler("switch_access_copied_files") {
"background.js",
"commands.js",
"icons/back.svg",
"icons/copy.svg",
"icons/cut.svg",
"icons/decrement.svg",
"icons/dictation.svg",
"icons/increment.svg",
......@@ -50,6 +52,7 @@ run_jsbundler("switch_access_copied_files") {
"icons/moveForwardOneWordOfText.svg",
"icons/moveUpOneLineOfText.svg",
"icons/options.svg",
"icons/paste.svg",
"icons/scrollDownOrForward.svg",
"icons/scrollLeft.svg",
"icons/scrollRight.svg",
......
<!-- Copyright 2019 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. -->
<svg height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="m13 16h-8v-8h-2v8c0 1.1.9 2 2 2h8zm5-4v-8c0-1.1-.9-2-2-2h-7c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2zm-2 0h-7v-8h7z" fill="#E8EAED" fill-rule="evenodd"/></svg>
<!-- Copyright 2019 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. -->
<svg height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="m7.70950283 6.28949254 9.79049717 9.71050746v1.5h-1.5l-6.01810633-6.0676801-2.27426466 2.2742646c.18741883.3916353.29237099.830269.29237099 1.2934155 0 1.6568542-1.34314575 3-3 3s-3-1.3431458-3-3 1.34314575-3 3-3c.46314653 0 .90178018.1049522 1.29341545.292371l2.28006551-2.2800655-2.28398842-2.30280267c-.39064059.18624442-.8278918.29049717-1.28949254.29049717-1.65685425 0-3-1.34314575-3-3s1.34314575-3 3-3 3 1.34314575 3 3c0 .46160074-.10425275.89885195-.29049717 1.28949254zm-2.70950283-.28949254c.55228475 0 1-.44771525 1-1s-.44771525-1-1-1-1 .44771525-1 1 .44771525 1 1 1zm0 10c.55228475 0 1-.4477153 1-1s-.44771525-1-1-1-1 .4477153-1 1 .44771525 1 1 1zm11-13.5h2v1l-5.4494019 5.37683105-1.4087524-1.4232788zm-6 8c.2761424 0 .5-.2238576.5-.5 0-.27614237-.2238576-.5-.5-.5-.27614237 0-.5.22385763-.5.5 0 .2761424.22385763.5.5.5z" fill="#E8EAED" fill-rule="evenodd"/></svg>
<!-- Copyright 2019 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. -->
<svg height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="m16 3h-3.18c-.42-1.16-1.52-2-2.82-2s-2.4.84-2.82 2h-3.18c-1.1 0-2 .9-2 2v11c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-11c0-1.1-.9-2-2-2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm6 13h-12v-11h3v2h6v-2h3z" fill="#E8EAED" fill-rule="evenodd"/></svg>
......@@ -326,6 +326,9 @@ class MenuManager {
if (this.navigationManager_.selectionStarted()) {
actions.push(SAConstants.MenuAction.SELECT_END);
}
actions.push(SAConstants.MenuAction.CUT);
actions.push(SAConstants.MenuAction.COPY);
actions.push(SAConstants.MenuAction.PASTE);
}
} else if (actions.length > 0) {
actions.push(SAConstants.MenuAction.SELECT);
......
......@@ -93,6 +93,18 @@
<img src="icons/textSelectionEnd.svg">
<p class="i18n" msgid="selection_end"></p>
</button>
<button class="action" id="cut">
<img src="icons/cut.svg">
<p class="i18n" msgid="cut"></p>
</button>
<button class="action" id="copy">
<img src="icons/copy.svg">
<p class="i18n" msgid="copy"></p>
</button>
<button class="action" id="paste">
<img src="icons/paste.svg">
<p class="i18n" msgid="paste"></p>
</button>
<button class="action" id="dictation">
<img src="icons/dictation.svg">
<p class="i18n" msgid="dictation"></p>
......
......@@ -192,6 +192,15 @@
<message desc="The Switch Access action to set the end of a text selection area." name="IDS_SWITCH_ACCESS_SELECTION_END">
Selection end
</message>
<message desc="The Switch Access action to cut text." name="IDS_SWITCH_ACCESS_CUT">
Cut
</message>
<message desc="The Switch Access action to copy text." name="IDS_SWITCH_ACCESS_COPY">
Copy
</message>
<message desc="The Switch Access action to paste text." name="IDS_SWITCH_ACCESS_PASTE">
Paste
</message>
</messages>
</release>
</grit>
......@@ -130,6 +130,10 @@ SAConstants.DEFAULT_PREFERENCES = {
* @const
*/
SAConstants.MenuAction = {
// Copy text.
COPY: 'copy',
// Cut text.
CUT: 'cut',
// Decrement the value of an input field.
DECREMENT: chrome.automation.ActionType.DECREMENT,
// Activate dictation for voice input to an editable text region.
......@@ -156,6 +160,8 @@ SAConstants.MenuAction = {
MOVE_UP_ONE_LINE_OF_TEXT: 'moveUpOneLineOfText',
// Open and jump to the Switch Access settings in a new Chrome tab.
OPTIONS: 'options',
// Paste text.
PASTE: 'paste',
// Scroll the current element (or its ancestor) logically backwards.
// Primarily used by ARC++ apps.
SCROLL_BACKWARD: chrome.automation.ActionType.SCROLL_BACKWARD,
......@@ -204,4 +210,4 @@ SAConstants.KeyCode = {
UP_ARROW: 38,
RIGHT_ARROW: 39,
DOWN_ARROW: 40
};
\ No newline at end of file
};
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