summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/extensions
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-05-20 09:47:09 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-06-07 11:15:42 +0000
commit189d4fd8fad9e3c776873be51938cd31a42b6177 (patch)
tree6497caeff5e383937996768766ab3bb2081a40b2 /chromium/chrome/browser/resources/extensions
parent8bc75099d364490b22f43a7ce366b366c08f4164 (diff)
BASELINE: Update Chromium to 90.0.4430.221
Change-Id: Iff4d9d18d2fcf1a576f3b1f453010f744a232920 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/chrome/browser/resources/extensions')
-rw-r--r--chromium/chrome/browser/resources/extensions/BUILD.gn25
-rw-r--r--chromium/chrome/browser/resources/extensions/DIR_METADATA4
-rw-r--r--chromium/chrome/browser/resources/extensions/OWNERS3
-rw-r--r--chromium/chrome/browser/resources/extensions/detail_view.html9
-rw-r--r--chromium/chrome/browser/resources/extensions/item.html2
-rw-r--r--chromium/chrome/browser/resources/extensions/item.js10
-rw-r--r--chromium/chrome/browser/resources/extensions/item_behavior.js14
-rw-r--r--chromium/chrome/browser/resources/extensions/item_list.js9
-rw-r--r--chromium/chrome/browser/resources/extensions/manager.js2
-rw-r--r--chromium/chrome/browser/resources/extensions/shortcut_input.html17
-rw-r--r--chromium/chrome/browser/resources/extensions/shortcut_input.js81
-rw-r--r--chromium/chrome/browser/resources/extensions/toggle_row.html14
-rw-r--r--chromium/chrome/browser/resources/extensions/toolbar.js2
13 files changed, 109 insertions, 83 deletions
diff --git a/chromium/chrome/browser/resources/extensions/BUILD.gn b/chromium/chrome/browser/resources/extensions/BUILD.gn
index cfed148d68b..d75482bdfbf 100644
--- a/chromium/chrome/browser/resources/extensions/BUILD.gn
+++ b/chromium/chrome/browser/resources/extensions/BUILD.gn
@@ -2,13 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/chromeos/ui_mode.gni")
import("//chrome/common/features.gni")
+import("//extensions/buildflags/buildflags.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
-import("//tools/grit/preprocess_grit.gni")
+import("//tools/grit/preprocess_if_expr.gni")
import("//tools/polymer/html_to_js.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
-import("../optimize_webui.gni")
+import("../tools/optimize_webui.gni")
+
+assert(enable_extensions, "enable extensions check failed")
preprocess_folder = "preprocessed"
preprocess_manifest = "preprocessed_manifest.json"
@@ -59,7 +63,7 @@ generate_grd("build_grd") {
}
}
-preprocess_grit("preprocess") {
+preprocess_if_expr("preprocess") {
in_folder = "./"
out_folder = "$target_gen_dir/$preprocess_folder"
out_manifest = "$target_gen_dir/$preprocess_manifest"
@@ -74,12 +78,12 @@ preprocess_grit("preprocess") {
"shortcut_util.js",
]
- if (is_chromeos) {
+ if (is_chromeos_ash) {
in_files += [ "kiosk_browser_proxy.js" ]
}
}
-preprocess_grit("preprocess_generated") {
+preprocess_if_expr("preprocess_generated") {
deps = [ ":web_components" ]
in_folder = target_gen_dir
out_folder = "$target_gen_dir/$preprocess_folder"
@@ -116,7 +120,7 @@ preprocess_grit("preprocess_generated") {
"toolbar.js",
]
- if (is_chromeos) {
+ if (is_chromeos_ash) {
in_files += [ "kiosk_dialog.js" ]
}
}
@@ -163,12 +167,12 @@ html_to_js("web_components_local") {
"toolbar.js",
]
- if (is_chromeos) {
+ if (is_chromeos_ash) {
js_files += [ "kiosk_dialog.js" ]
}
}
-grit("extensions_resources") {
+grit("resources") {
defines = chrome_grit_defines
# These arguments are needed since the grd is generated at build time.
@@ -218,7 +222,7 @@ js_type_check("extensions_module_resources") {
":toggle_row",
":toolbar",
]
- if (is_chromeos) {
+ if (is_chromeos_ash) {
deps += [ ":kiosk_dialog" ]
}
}
@@ -301,7 +305,6 @@ js_library("item") {
"//ui/webui/resources/cr_elements/cr_toast:cr_toast_manager.m",
"//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:i18n_behavior.m",
- "//ui/webui/resources/js:load_time_data.m",
]
externs_list = [ "$externs_path/developer_private.js" ]
}
@@ -356,7 +359,7 @@ js_library("kiosk_browser_proxy") {
deps = [ "//ui/webui/resources/js:cr.m" ]
}
-if (is_chromeos) {
+if (is_chromeos_ash) {
js_library("kiosk_dialog") {
deps = [
":item_behavior",
diff --git a/chromium/chrome/browser/resources/extensions/DIR_METADATA b/chromium/chrome/browser/resources/extensions/DIR_METADATA
new file mode 100644
index 00000000000..81a57a13916
--- /dev/null
+++ b/chromium/chrome/browser/resources/extensions/DIR_METADATA
@@ -0,0 +1,4 @@
+monorail {
+ component: "Platform>Extensions"
+}
+team_email: "extensions-dev@chromium.org"
diff --git a/chromium/chrome/browser/resources/extensions/OWNERS b/chromium/chrome/browser/resources/extensions/OWNERS
index 8483f0b410a..aad0b9203df 100644
--- a/chromium/chrome/browser/resources/extensions/OWNERS
+++ b/chromium/chrome/browser/resources/extensions/OWNERS
@@ -1,4 +1 @@
rdevlin.cronin@chromium.org
-
-# TEAM: extensions-dev@chromium.org
-# COMPONENT: Platform>Extensions
diff --git a/chromium/chrome/browser/resources/extensions/detail_view.html b/chromium/chrome/browser/resources/extensions/detail_view.html
index 17bb9b7e1d5..b5851fffd44 100644
--- a/chromium/chrome/browser/resources/extensions/detail_view.html
+++ b/chromium/chrome/browser/resources/extensions/detail_view.html
@@ -58,8 +58,11 @@
}
.inspectable-view {
+ display: inline;
height: 20px;
+ overflow-wrap: anywhere;
width: auto; /* override the default button size of 24x24 */
+ word-break: normal;
}
@media (prefers-color-scheme: light) {
@@ -97,10 +100,7 @@
extensions-toggle-row {
box-sizing: border-box;
- padding-inline-end: 0;
- padding-inline-start: 0;
- --toggle-row-label-horizontal-padding: var(--cr-section-padding);
- --toggle-row-label-vertical-padding: var(--cr-section-vertical-padding);
+ padding: var(--cr-section-vertical-padding) var(--cr-section-padding);
}
#load-path {
@@ -128,6 +128,7 @@
aria-label="$i18n{back}" on-click="onCloseButtonTap_">
</cr-icon-button>
<img id="icon" src="[[data.iconUrl]]"
+ aria-label$="[[a11yAssociation(data.name)]]"
alt$="[[appOrExtension(
data.type,
'$i18nPolymer{appIcon}',
diff --git a/chromium/chrome/browser/resources/extensions/item.html b/chromium/chrome/browser/resources/extensions/item.html
index fb2f6d20bdb..ee4785fc461 100644
--- a/chromium/chrome/browser/resources/extensions/item.html
+++ b/chromium/chrome/browser/resources/extensions/item.html
@@ -168,7 +168,7 @@
element that's hidden when referenced by an aria label. Unfortunately,
this text can be found by Ctrl + F because it isn't hidden. -->
<div id="a11yAssociation" aria-hidden="true">
- [[a11yAssociation_(data.name)]]
+ [[a11yAssociation(data.name)]]
</div>
<div id="card" class$="[[computeClasses_(data.state, inDevMode)]]">
<div id="main">
diff --git a/chromium/chrome/browser/resources/extensions/item.js b/chromium/chrome/browser/resources/extensions/item.js
index e5e8c74e43a..1bf7fd1f15d 100644
--- a/chromium/chrome/browser/resources/extensions/item.js
+++ b/chromium/chrome/browser/resources/extensions/item.js
@@ -23,7 +23,6 @@ import 'chrome://resources/polymer/v3_0/paper-tooltip/paper-tooltip.js';
import {getToastManager} from 'chrome://resources/cr_elements/cr_toast/cr_toast_manager.m.js';
import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js';
import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
-import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {flush, html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {ItemBehavior} from './item_behavior.js';
@@ -168,15 +167,6 @@ Polymer({
return /** @type {?HTMLElement} */ (this.$$('#errors-button'));
},
- /** @private string */
- a11yAssociation_() {
- // Don't use I18nBehavior.i18n because of additional checks it performs.
- // Polymer ensures that this string is not stamped into arbitrary HTML.
- // |this.data.name| can contain any data including html tags.
- // ex: "My <video> download extension!"
- return loadTimeData.getStringF('extensionA11yAssociation', this.data.name);
- },
-
/** @private */
observeIdVisibility_(inDevMode, showingDetails, id) {
flush();
diff --git a/chromium/chrome/browser/resources/extensions/item_behavior.js b/chromium/chrome/browser/resources/extensions/item_behavior.js
index 984ab93ce0f..bbe7380864f 100644
--- a/chromium/chrome/browser/resources/extensions/item_behavior.js
+++ b/chromium/chrome/browser/resources/extensions/item_behavior.js
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import {assertNotReached} from 'chrome://resources/js/assert.m.js';
+import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
/** @polymerBehavior */
export const ItemBehavior = {
@@ -25,4 +26,17 @@ export const ItemBehavior = {
}
assertNotReached('Item type is not App or Extension.');
},
+
+ /**
+ * @param {string} name
+ * @return {string} The a11y association descriptor, e.g. "Related to <ext>".
+ */
+ a11yAssociation(name) {
+ // Don't use I18nBehavior.i18n because of additional checks it performs.
+ // Polymer ensures that this string is not stamped into arbitrary HTML.
+ // `name` can contain any data including html tags, e.g.
+ // "My <video> download extension!"
+ return loadTimeData.getStringF('extensionA11yAssociation', name);
+ },
+
};
diff --git a/chromium/chrome/browser/resources/extensions/item_list.js b/chromium/chrome/browser/resources/extensions/item_list.js
index 82136e86fa8..22b1ef2f95f 100644
--- a/chromium/chrome/browser/resources/extensions/item_list.js
+++ b/chromium/chrome/browser/resources/extensions/item_list.js
@@ -99,9 +99,12 @@ Polymer({
*/
computeFilter_() {
const formattedFilter = this.filter.trim().toLowerCase();
- return formattedFilter ?
- i => i.name.toLowerCase().includes(formattedFilter) :
- null;
+ if (!formattedFilter) {
+ return null;
+ }
+
+ return i => [i.name, i.id].some(
+ s => s.toLowerCase().includes(formattedFilter));
},
/** @private */
diff --git a/chromium/chrome/browser/resources/extensions/manager.js b/chromium/chrome/browser/resources/extensions/manager.js
index 271dfba94a3..3bef81eb86f 100644
--- a/chromium/chrome/browser/resources/extensions/manager.js
+++ b/chromium/chrome/browser/resources/extensions/manager.js
@@ -5,7 +5,7 @@
import 'chrome://resources/cr_elements/cr_drawer/cr_drawer.m.js';
import 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.m.js';
import 'chrome://resources/cr_elements/cr_toast/cr_toast_manager.m.js';
-import 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar.m.js';
+import 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar.js';
import 'chrome://resources/cr_elements/cr_view_manager/cr_view_manager.m.js';
import 'chrome://resources/cr_elements/hidden_style_css.m.js';
import 'chrome://resources/cr_elements/shared_vars_css.m.js';
diff --git a/chromium/chrome/browser/resources/extensions/shortcut_input.html b/chromium/chrome/browser/resources/extensions/shortcut_input.html
index 9170ffddd5c..a4ac6dd0880 100644
--- a/chromium/chrome/browser/resources/extensions/shortcut_input.html
+++ b/chromium/chrome/browser/resources/extensions/shortcut_input.html
@@ -15,23 +15,18 @@
right: inherit;
}
- /* Invisible so the element is still in the tab order. */
- [invisible] {
- opacity: 0;
- }
</style>
<div id="main">
- <cr-input id="input" placeholder="$i18n{shortcutTypeAShortcut}"
+ <cr-input id="input" readonly="[[readonly_]]"
+ placeholder="[[computePlaceholder_(readonly_)]]"
invalid="[[getIsInvalid_(error_)]]"
error-message="[[getErrorString_(error_,
'$i18nPolymer{shortcutIncludeStartModifier}',
'$i18nPolymer{shortcutTooManyModifiers}',
'$i18nPolymer{shortcutNeedCharacter}')]]"
- value="[[computeText_(capturing_, shortcut, pendingShortcut_)]]">
- <cr-icon-button id="clear" aria-label="$i18nPolymer{clear}"
- slot="suffix" class="icon-cancel no-overlap"
- invisible$="[[computeClearInvisible_(capturing_, shortcut)]]"
- hidden$="[[computeClearHidden_(shortcut)]]"
- on-click="onClearClick_"></cr-icon-button>
+ value="[[computeText_(shortcut)]]">
+ <cr-icon-button id="edit" aria-label="$i18nPolymer{editShortcut}"
+ slot="suffix" class="icon-edit no-overlap"
+ on-click="onEditClick_"></cr-icon-button>
</cr-input>
</div>
diff --git a/chromium/chrome/browser/resources/extensions/shortcut_input.js b/chromium/chrome/browser/resources/extensions/shortcut_input.js
index 3d03a6949ac..ceb1813b9eb 100644
--- a/chromium/chrome/browser/resources/extensions/shortcut_input.js
+++ b/chromium/chrome/browser/resources/extensions/shortcut_input.js
@@ -63,6 +63,14 @@ Polymer({
value: ShortcutError.NO_ERROR,
},
+
+ /** @private */
+ readonly_: {
+ type: Boolean,
+ value: true,
+ reflectToAttribute: true,
+ },
+
/** @private */
pendingShortcut_: {
type: String,
@@ -82,7 +90,7 @@ Polymer({
/** @private */
startCapture_() {
- if (this.capturing_) {
+ if (this.capturing_ || this.readonly_) {
return;
}
this.capturing_ = true;
@@ -99,6 +107,17 @@ Polymer({
this.$.input.blur();
this.error_ = ShortcutError.NO_ERROR;
this.delegate.setShortcutHandlingSuspended(false);
+ this.readonly_ = true;
+ },
+
+ /** @private */
+ clearShortcut_() {
+ this.pendingShortcut_ = '';
+ this.shortcut = '';
+ // We commit the empty shortcut in order to clear the current shortcut
+ // for the extension.
+ this.commitPending_();
+ this.endCapture_();
},
/**
@@ -106,7 +125,11 @@ Polymer({
* @private
*/
onKeyDown_(e) {
- if (e.target === this.$.clear) {
+ if (this.readonly_) {
+ return;
+ }
+
+ if (e.target === this.$.edit) {
return;
}
@@ -138,11 +161,15 @@ Polymer({
* @private
*/
onKeyUp_(e) {
- // Ignores pressing 'Space' or 'Enter' on the clear button. In 'Enter's
- // case, the clear button disappears before key-up, so 'Enter's key-up
- // target becomes the input field, not the clear button, and needs to
+ // Ignores pressing 'Space' or 'Enter' on the edit button. In 'Enter's
+ // case, the edit button disappears before key-up, so 'Enter's key-up
+ // target becomes the input field, not the edit button, and needs to
// be caught explicitly.
- if (e.target === this.$.clear || e.key === 'Enter') {
+ if (this.readonly_) {
+ return;
+ }
+
+ if (e.target === this.$.edit || e.key === 'Enter') {
return;
}
@@ -224,31 +251,26 @@ Polymer({
},
/**
- * @return {string} The text to be displayed in the shortcut field.
+ * @return {string} The placeholder text.
* @private
*/
- computeText_() {
- const shortcutString =
- this.capturing_ ? this.pendingShortcut_ : this.shortcut;
- return shortcutString.split('+').join(' + ');
+ computePlaceholder_() {
+ if (this.readonly_) {
+ return this.shortcut ? this.i18n('shortcutSet', this.computeText_()) :
+ this.i18n('shortcutNotSet');
+ }
+ return this.i18n('shortcutTypeAShortcut');
},
- /**
- * Invisible when capturing AND we have a shortcut.
- * @return {boolean} Whether the clear button is invisible.
- * @private
- */
- computeClearInvisible_() {
- return this.capturing_ && !!this.shortcut;
- },
/**
- * Hidden when no shortcut is set.
- * @return {boolean} Whether the clear button is hidden.
+ * @return {string} The text to be displayed in the shortcut field.
* @private
*/
- computeClearHidden_() {
- return !this.shortcut;
+ computeText_() {
+ const shortcutString =
+ this.capturing_ ? this.pendingShortcut_ : this.shortcut;
+ return shortcutString.split('+').join(' + ');
},
/**
@@ -260,12 +282,13 @@ Polymer({
},
/** @private */
- onClearClick_() {
- assert(this.shortcut);
-
- this.pendingShortcut_ = '';
- this.commitPending_();
- this.endCapture_();
+ onEditClick_() {
+ // TODO(ghazale): The clearing functionality should be improved.
+ // Instead of clicking the edit button, and then clicking elsewhere to
+ // commit the "empty" shortcut, we want to introduce a separate clear
+ // button.
+ this.clearShortcut_();
+ this.readonly_ = false;
this.$.input.focus();
},
});
diff --git a/chromium/chrome/browser/resources/extensions/toggle_row.html b/chromium/chrome/browser/resources/extensions/toggle_row.html
index 9752fed0ef8..f696b3d2a85 100644
--- a/chromium/chrome/browser/resources/extensions/toggle_row.html
+++ b/chromium/chrome/browser/resources/extensions/toggle_row.html
@@ -1,6 +1,7 @@
<style>
:host {
- display: block;
+ align-items: center;
+ display: flex;
touch-action: none;
}
@@ -9,14 +10,9 @@
}
label {
- align-items: center;
box-sizing: border-box;
cursor: pointer;
- display: flex;
flex: 1;
- padding: var(--toggle-row-label-vertical-padding, 0)
- var(--toggle-row-label-horizontal-padding, 0);
- width: 100%;
}
cr-toggle {
@@ -28,11 +24,11 @@
margin-inline-end: 20px;
}
</style>
-<label id="label">
+<label id="label" aria-hidden="true">
<input id="native" type="checkbox" checked="[[checked]]"
on-change="onNativeChange_" on-click="onNativeClick_"
disabled="[[disabled]]">
<slot></slot>
- <cr-toggle id="crToggle" checked="{{checked}}" aria-labelledby="label"
- on-change="onCrToggleChange_" disabled="[[disabled]]"></cr-toggle>
</label>
+<cr-toggle id="crToggle" checked="{{checked}}" aria-labelledby="label"
+ on-change="onCrToggleChange_" disabled="[[disabled]]"></cr-toggle>
diff --git a/chromium/chrome/browser/resources/extensions/toolbar.js b/chromium/chrome/browser/resources/extensions/toolbar.js
index f67703752bb..25a38b7082b 100644
--- a/chromium/chrome/browser/resources/extensions/toolbar.js
+++ b/chromium/chrome/browser/resources/extensions/toolbar.js
@@ -4,7 +4,7 @@
import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
import 'chrome://resources/cr_elements/cr_toggle/cr_toggle.m.js';
-import 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar.m.js';
+import 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar.js';
import 'chrome://resources/cr_elements/hidden_style_css.m.js';
import 'chrome://resources/cr_elements/policy/cr_tooltip_icon.m.js';
import 'chrome://resources/cr_elements/shared_vars_css.m.js';