diff --git a/api-samples/search/README.md b/api-samples/search/README.md new file mode 100644 index 0000000000..5e5e91b7c8 --- /dev/null +++ b/api-samples/search/README.md @@ -0,0 +1,16 @@ +# chrome.search + +This sample demonstrates how to use the [`chrome.search` API](https://developer.chrome.com/docs/extensions/reference/api/search). + +## Overview + +This extension provides a different way to search via the default provider. +A popup appears when the extension icon is clicked. From there you can specify your query and the location where search results should be displayed. + +## Running this extension + +1. Clone this repository. +2. Load this directory in Chrome as an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked). +3. Click the extension icon to open the popup. +4. Type the query and select a location. +5. Click the **Search** button. diff --git a/api-samples/search/manifest.json b/api-samples/search/manifest.json new file mode 100644 index 0000000000..0179c83b36 --- /dev/null +++ b/api-samples/search/manifest.json @@ -0,0 +1,10 @@ +{ + "manifest_version": 3, + "name": "Search", + "version": "1.0", + "description": "Uses the chrome.search API to do a search query via the default provider", + "action": { + "default_popup": "popup.html" + }, + "permissions": ["search"] +} \ No newline at end of file diff --git a/api-samples/search/popup.css b/api-samples/search/popup.css new file mode 100644 index 0000000000..ff17444b43 --- /dev/null +++ b/api-samples/search/popup.css @@ -0,0 +1,26 @@ +body { + width: 200px; +} + +.container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; +} + +.row { + margin: 3px; +} + +input { + padding: 4px; +} + +button { + width: 100%; + padding: 8px; + border-radius: 4px; + margin-top: 12px; +} diff --git a/api-samples/search/popup.html b/api-samples/search/popup.html new file mode 100644 index 0000000000..79e57946be --- /dev/null +++ b/api-samples/search/popup.html @@ -0,0 +1,27 @@ + + +
+