Commit 384bf5d9 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Extensions Web UI: Split file to break circular dependency

Split out KeyboardShortcutDelegate into a separate file to break the
following circular dependency, created when we migrate to Polymer 3:

- shortcut_input.* depends on the KeyboardShortcutDelegate class from
keyboard_shortcuts.*
- keyboard_shortcuts.* imports shortcut_input.*, since it uses
shortcut-input.

Bug: 1004967
Change-Id: I9b75267eddea8eb4555b2080a90ba7e8ffca0a6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1832792Reviewed-by: default avatarJohn Lee <johntlee@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701372}
parent 6c3202e0
......@@ -71,6 +71,7 @@ js_type_check("extensions_resources") {
":item_behavior",
":item_list",
":item_util",
":keyboard_shortcut_delegate",
":keyboard_shortcuts",
":kiosk_browser_proxy",
":kiosk_dialog",
......@@ -209,9 +210,17 @@ js_library("item_util") {
externs_list = [ "$externs_path/developer_private.js" ]
}
js_library("keyboard_shortcut_delegate") {
deps = [
"//ui/webui/resources/js:cr",
]
externs_list = [ "$externs_path/developer_private.js" ]
}
js_library("keyboard_shortcuts") {
deps = [
":item_behavior",
":keyboard_shortcut_delegate",
"//ui/webui/resources/cr_elements:cr_container_shadow_behavior",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
......@@ -326,6 +335,7 @@ js_library("service") {
deps = [
":error_page",
":item",
":keyboard_shortcut_delegate",
":load_error",
":navigation_helper",
":pack_dialog",
......@@ -347,6 +357,7 @@ js_library("service") {
js_library("shortcut_input") {
deps = [
":keyboard_shortcut_delegate",
":shortcut_util",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
......
......@@ -85,6 +85,12 @@
<structure name="IDR_EXTENSIONS_ERROR_PAGE_JS"
file="error_page.js"
type="chrome_html" />
<structure name="IDR_EXTENSIONS_KEYBOARD_SHORTCUT_DELEGATE_HTML"
file="keyboard_shortcut_delegate.html"
type="chrome_html" />
<structure name="IDR_EXTENSIONS_KEYBOARD_SHORTCUT_DELEGATE_JS"
file="keyboard_shortcut_delegate.js"
type="chrome_html" />
<structure name="IDR_EXTENSIONS_KEYBOARD_SHORTCUTS_HTML"
file="keyboard_shortcuts.html"
type="chrome_html" />
......
<script src="keyboard_shortcut_delegate.js"></script>
// Copyright 2016 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.
cr.define('extensions', function() {
'use strict';
/** @interface */
class KeyboardShortcutDelegate {
/**
* Called when shortcut capturing changes in order to suspend or re-enable
* global shortcut handling. This is important so that the shortcuts aren't
* processed normally as the user types them.
* TODO(devlin): From very brief experimentation, it looks like preventing
* the default handling on the event also does this. Investigate more in the
* future.
* @param {boolean} isCapturing
*/
setShortcutHandlingSuspended(isCapturing) {}
/**
* Updates an extension command's keybinding.
* @param {string} extensionId
* @param {string} commandName
* @param {string} keybinding
*/
updateExtensionCommandKeybinding(extensionId, commandName, keybinding) {}
/**
* Updates an extension command's scope.
* @param {string} extensionId
* @param {string} commandName
* @param {chrome.developerPrivate.CommandScope} scope
*/
updateExtensionCommandScope(extensionId, commandName, scope) {}
}
return {
KeyboardShortcutDelegate: KeyboardShortcutDelegate,
};
});
......@@ -7,6 +7,7 @@
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="item_behavior.html">
<link rel="import" href="keyboard_shortcut_delegate.html">
<link rel="import" href="shortcut_input.html">
<dom-module id="extensions-keyboard-shortcuts">
......
......@@ -5,36 +5,6 @@
cr.define('extensions', function() {
'use strict';
/** @interface */
class KeyboardShortcutDelegate {
/**
* Called when shortcut capturing changes in order to suspend or re-enable
* global shortcut handling. This is important so that the shortcuts aren't
* processed normally as the user types them.
* TODO(devlin): From very brief experimentation, it looks like preventing
* the default handling on the event also does this. Investigate more in the
* future.
* @param {boolean} isCapturing
*/
setShortcutHandlingSuspended(isCapturing) {}
/**
* Updates an extension command's keybinding.
* @param {string} extensionId
* @param {string} commandName
* @param {string} keybinding
*/
updateExtensionCommandKeybinding(extensionId, commandName, keybinding) {}
/**
* Updates an extension command's scope.
* @param {string} extensionId
* @param {string} commandName
* @param {chrome.developerPrivate.CommandScope} scope
*/
updateExtensionCommandScope(extensionId, commandName, scope) {}
}
// The UI to display and manage keyboard shortcuts set for extension commands.
const KeyboardShortcuts = Polymer({
is: 'extensions-keyboard-shortcuts',
......@@ -127,7 +97,6 @@ cr.define('extensions', function() {
});
return {
KeyboardShortcutDelegate: KeyboardShortcutDelegate,
KeyboardShortcuts: KeyboardShortcuts,
};
});
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