diff --git a/api-samples/printing/background.js b/api-samples/printing/background.js new file mode 100644 index 0000000000..aa9bb9acbc --- /dev/null +++ b/api-samples/printing/background.js @@ -0,0 +1,19 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +chrome.action.onClicked.addListener(() => { + chrome.tabs.create({ + url: 'printers.html' + }); +}); diff --git a/api-samples/printing/manifest.json b/api-samples/printing/manifest.json index 3fc75a98fa..3a38132acc 100644 --- a/api-samples/printing/manifest.json +++ b/api-samples/printing/manifest.json @@ -3,8 +3,10 @@ "version": "1.0", "description": "Demonstrates all four methods of the chrome.printing namespace.", "permissions": ["printing"], + "background": { + "service_worker": "background.js" + }, "action": { - "default_popup": "printers.html", "default_icon": { "16": "icons/icon16.png", "48": "icons/icon48.png",