### Install Android Application using ADB Source: https://developer.chrome.com/docs/android/trusted-web-activity/quick-start.md.txt Installs a signed APK file (app-release-signed.apk) onto a connected Android device using the Android Debug Bridge (adb) tool. This is an alternative to using the Bubblewrap install command. ```bash adb install app-release-signed.apk ``` -------------------------------- ### Install Bubblewrap CLI Source: https://developer.chrome.com/docs/android/trusted-web-activity/quick-start.md.txt Installs the Bubblewrap command-line interface globally using npm. This tool is used to generate, build, and run Progressive Web Apps within Android applications using Trusted Web Activity. ```bash npm i -g @bubblewrap/cli ``` -------------------------------- ### Install and Test Android App with Bubblewrap Source: https://developer.chrome.com/docs/android/trusted-web-activity/quick-start.md.txt Installs and tests the generated Android application on a connected local device. This command simplifies the deployment process for testing purposes. ```bash bubblewrap install ``` -------------------------------- ### Build Android Application with Bubblewrap Source: https://developer.chrome.com/docs/android/trusted-web-activity/quick-start.md.txt Generates a signed APK file for the Android application after the project has been initialized. This APK can be installed on a device or uploaded to the Play Store. ```bash bubblewrap build ``` -------------------------------- ### Manually Start ChromeDriver Source: https://developer.chrome.com/docs/chromedriver/get-started/android.md.txt Starts the ChromeDriver executable from the command line. This is an alternative to starting ChromeDriver through a Selenium library. ```bash $ ./chromedriver ``` -------------------------------- ### WebGPU Compute Pipeline Setup Source: https://developer.chrome.com/docs/capabilities/web-apis/gpu-compute.md.txt JavaScript code to set up a compute pipeline for WebGPU operations. It defines the pipeline layout using bind group layouts and specifies the compute shader module and entry point. This is essential for executing compute shaders on the GPU. Dependencies include the WebGPU device object and a shader module. ```javascript const computePipeline = device.createComputePipeline({ layout: device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout] }), compute: { module: shaderModule } }); ``` -------------------------------- ### Manage ChromeDriver Lifetime with ChromeDriverService (Java) Source: https://developer.chrome.com/docs/chromedriver/get-started.md.txt This Java example demonstrates using `ChromeDriverService` to manage the ChromeDriver server process independently. It allows starting and stopping the service explicitly, which is beneficial for large test suites to avoid repeated server startup/shutdown overhead. It uses JUnit 4 annotations for setup and teardown. ```Java import java.io.*; import org.junit.*; import org.openqa.selenium.*; import org.openqa.selenium.chrome.*; import org.openqa.selenium.remote.*; public class GettingStartedWithService { private static ChromeDriverService service; private WebDriver driver; @BeforeClass public static void createAndStartService() throws IOException { service = new ChromeDriverService.Builder() .usingDriverExecutable(new File("/path/to/chromedriver")) .usingAnyFreePort() .build(); service.start(); } @AfterClass public static void stopService() { service.stop(); } @Before public void createDriver() { driver = new RemoteWebDriver(service.getUrl(), new ChromeOptions()); } @After public void quitDriver() { driver.quit(); } @Test public void testGoogleSearch() { driver.get("http://www.google.com"); // rest of the test... } } ``` -------------------------------- ### Manage ChromeDriver Lifetime with ChromeDriverService (Python) Source: https://developer.chrome.com/docs/chromedriver/get-started.md.txt This Python example shows how to manage the ChromeDriver server process using `selenium.webdriver.chrome.service.Service`. It allows explicit control over starting and stopping the service, which can improve performance in test suites by avoiding repeated server initialization. The `RemoteWebDriver` is then instantiated using the service URL. ```Python import time from selenium import webdriver from selenium.webdriver.chrome.service import Service service = Service('/path/to/chromedriver') service.start() driver = webdriver.Remote(service.service_url) driver.get('http://www.google.com/'); time.sleep(5) # Let the user actually see something! driver.quit() ``` -------------------------------- ### Get Valid Channels for a Platform (API Example) Source: https://developer.chrome.com/docs/web-platform/versionhistory/reference.md.txt This example demonstrates how to make an API request to retrieve a list of valid channels for a specified product and platform. It uses the GET HTTP method and requires product and platform identifiers as path parameters. ```HTTP GET /{product}/platforms/{platform}/channels ``` -------------------------------- ### Install go/bundle CLI Source: https://developer.chrome.com/docs/web-platform/web-bundles.md.txt Installs the go/bundle command-line interface, a reference implementation for the Web Bundles specification, using Go's package management system. ```bash go get -u github.com/WICG/webpackage/go/bundle/cmd/... ``` -------------------------------- ### Create and Configure PressureObserver Source: https://developer.chrome.com/docs/web-platform/compute-pressure.md.txt This example shows how to create a new PressureObserver instance, providing a callback function that will be executed when pressure updates are detected. It also demonstrates how to start observing a specific source, like 'cpu', with a defined sample interval. ```javascript const observer = new PressureObserver((records) => { // Process pressure records here }); observer.observe("cpu", { sampleInterval: 2_000 }); ``` -------------------------------- ### Install Selenium Python Bindings Source: https://developer.chrome.com/docs/chromedriver/get-started/android.md.txt Installs the Selenium WebDriver language bindings for Python using pip. This is a prerequisite for writing automated tests with Selenium. ```bash $ pip install selenium ``` -------------------------------- ### Build and Serve Web App with Emscripten Source: https://developer.chrome.com/docs/web-platform/webgpu/build-app.md.txt Demonstrates the command-line process for building a C++ application with Emscripten using `emcmake` and serving the generated output via a local HTTP server. This allows testing the web version of the application directly in a browser. ```bash # Build the app with Emscripten. $ emcmake cmake -B build-web && cmake --build build-web # Start a HTTP server. $ npx http-server ``` -------------------------------- ### Start Android Debug Bridge Server Source: https://developer.chrome.com/docs/chromedriver/get-started/android.md.txt Starts the Android Debug Bridge (adb) server, which is essential for communicating with Android devices and emulators. This command is run from the command line. ```bash $ adb start-server ``` -------------------------------- ### Initialize Android Project with Bubblewrap Source: https://developer.chrome.com/docs/android/trusted-web-activity/quick-start.md.txt Initializes a new Android project that wraps a Progressive Web App. It reads the Web Manifest from the provided URL and prompts the user to confirm values for the Android project generation. ```bash bubblewrap init --manifest=https://my-twa.com/manifest.json ``` -------------------------------- ### Background Script with Storage API Initialization Source: https://developer.chrome.com/docs/extensions/mv2/getstarted.md.txt A JavaScript background script that listens for the extension's installation event. Upon installation, it uses the chrome.storage.sync API to set a default color value, which can be accessed by other parts of the extension. ```javascript chrome.runtime.onInstalled.addListener(function() { chrome.storage.sync.set({color: '#3aa757'}, function() { console.log("The color is green."); }); }); ``` -------------------------------- ### Platform APIs Source: https://developer.chrome.com/docs/web-platform/versionhistory/examples.md.txt Examples for listing platforms and their associated channel and version combinations. ```APIDOC ## GET /v1/chrome/platforms/ ### Description Lists all available platforms. ### Method GET ### Endpoint https://versionhistory.googleapis.com/v1/chrome/platforms/ ### Parameters No parameters. ### Request Example ``` GET https://versionhistory.googleapis.com/v1/chrome/platforms/ ``` ### Response #### Success Response (200) - **platforms** (array) - A list of platform objects. #### Response Example ```json { "platforms": [ { "name": "win" }, { "name": "mac" }, { "name": "linux" }, { "name": "android" }, { "name": "ios" }, { "name": "chromeos" } ] } ``` ## GET /v1/chrome/platforms/all/channels ### Description Lists all platform and channel combinations. ### Method GET ### Endpoint https://versionhistory.googleapis.com/v1/chrome/platforms/all/channels ### Parameters No parameters. ### Request Example ``` GET https://versionhistory.googleapis.com/v1/chrome/platforms/all/channels ``` ### Response #### Success Response (200) - **platformChannels** (array) - A list of platform-channel combination objects. #### Response Example ```json { "platformChannels": [ { "platform": "win", "channel": "stable" }, { "platform": "win", "channel": "beta" }, { "platform": "win", "channel": "dev" }, { "platform": "mac", "channel": "stable" }, { "platform": "mac", "channel": "beta" }, { "platform": "mac", "channel": "dev" }, { "platform": "linux", "channel": "stable" }, { "platform": "linux", "channel": "beta" }, { "platform": "linux", "channel": "dev" }, { "platform": "android", "channel": "stable" }, { "platform": "android", "channel": "beta" }, { "platform": "android", "channel": "dev" }, { "platform": "ios", "channel": "stable" }, { "platform": "ios", "channel": "beta" }, { "platform": "ios", "channel": "dev" }, { "platform": "chromeos", "channel": "stable" }, { "platform": "chromeos", "channel": "beta" }, { "platform": "chromeos", "channel": "dev" } ] } ``` ## GET /v1/chrome/platforms/all/channels/all/versions ### Description Lists all versions for all platform and channel combinations. ### Method GET ### Endpoint https://versionhistory.googleapis.com/v1/chrome/platforms/all/channels/all/versions ### Parameters No parameters. ### Request Example ``` GET https://versionhistory.googleapis.com/v1/chrome/platforms/all/channels/all/versions ``` ### Response #### Success Response (200) - **versions** (array) - A list of version objects, each containing platform, channel, and version information. #### Response Example ```json { "versions": [ { "platform": "win", "channel": "stable", "version": "85.0.4183.83" }, { "platform": "win", "channel": "stable", "version": "84.0.4147.105" }, { "platform": "mac", "channel": "stable", "version": "85.0.4183.83" }, { "platform": "mac", "channel": "stable", "version": "84.0.4147.105" }, { "platform": "linux", "channel": "stable", "version": "85.0.4183.83" }, { "platform": "linux", "channel": "stable", "version": "84.0.4147.105" }, { "platform": "android", "channel": "stable", "version": "85.0.4183.83" }, { "platform": "android", "channel": "stable", "version": "84.0.4147.105" }, { "platform": "ios", "channel": "stable", "version": "85.0.4183.83" }, { "platform": "ios", "channel": "stable", "version": "84.0.4147.105" }, { "platform": "chromeos", "channel": "stable", "version": "85.0.4183.83" }, { "platform": "chromeos", "channel": "stable", "version": "84.0.4147.105" }, { "platform": "win", "channel": "beta", "version": "86.0.4240.75" }, { "platform": "win", "channel": "beta", "version": "85.0.4183.83" }, { "platform": "win", "channel": "dev", "version": "87.0.4280.60" }, { "platform": "win", "channel": "dev", "version": "86.0.4240.75" } ] } ``` ``` -------------------------------- ### Initialize WebGPU Instance and Create GPU Device Source: https://developer.chrome.com/docs/web-platform/webgpu/build-app.md.txt This C++ code initializes the WebGPU instance and obtains a GPU adapter and device. It demonstrates the use of `wgpu::CreateInstance`, `instance.RequestAdapter`, and `adapter.RequestDevice` with callbacks to handle asynchronous operations and potential errors. This is the C++ equivalent of JavaScript's `navigator.gpu`. ```cpp #include #include #include wgpu::Instance instance; wgpu::Adapter adapter; wgpu::Device device; void Init() { static const auto kTimedWaitAny = wgpu::InstanceFeatureName::TimedWaitAny; wgpu::InstanceDescriptor instanceDesc{.requiredFeatureCount = 1, .requiredFeatures = &kTimedWaitAny}; instance = wgpu::CreateInstance(&instanceDesc); wgpu::Future f1 = instance.RequestAdapter( nullptr, wgpu::CallbackMode::WaitAnyOnly, [](wgpu::RequestAdapterStatus status, wgpu::Adapter a, wgpu::StringView message) { if (status != wgpu::RequestAdapterStatus::Success) { std::cout << "RequestAdapter: " << message << "\n"; exit(0); } adapter = std::move(a); }); instance.WaitAny(f1, UINT64_MAX); wgpu::DeviceDescriptor desc{}; desc.SetUncapturedErrorCallback([](const wgpu::Device&, wgpu::ErrorType errorType, wgpu::StringView message) { std::cout << "Error: " << errorType << " - message: " << message << "\n"; }); wgpu::Future f2 = adapter.RequestDevice( &desc, wgpu::CallbackMode::WaitAnyOnly, [](wgpu::RequestDeviceStatus status, wgpu::Device d, wgpu::StringView message) { if (status != wgpu::RequestDeviceStatus::Success) { std::cout << "RequestDevice: " << message << "\n"; exit(0); } device = std::move(d); }); instance.WaitAny(f2, UINT64_MAX); } int main() { Init(); Start(); } ``` -------------------------------- ### Prompt API - Create Session Source: https://developer.chrome.com/docs/ai/prompt-api.md.txt Initiates a session with the Gemini Nano model, allowing for model download and progress monitoring. ```APIDOC ## POST /llmstxt/developer_chrome_llms_txt/create_session ### Description Creates a session with the Language Model. This function can also include a monitor callback to track download progress. ### Method POST ### Endpoint `/llmstxt/developer_chrome_llms_txt/create_session` ### Parameters #### Request Body - **monitor** (function) - Optional. A callback function to monitor download progress. - **m** (event) - The event object, which can include 'downloadprogress'. ### Request Example ```javascript const session = await LanguageModel.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`); }); }, }); ``` ### Response #### Success Response (200) - **session** (object) - An object representing the active Language Model session. #### Response Example ```json { "session": "" } ``` ``` -------------------------------- ### Initialize Window and Surface in C++ Source: https://developer.chrome.com/docs/web-platform/webgpu/build-app.md.txt Initializes the application window using GLFW and creates a WebGPU surface associated with it. This function sets up the main application loop, handling events, rendering, and surface presentation. It's a critical part of setting up the rendering context. ```c++ void Start() { ... surface = wgpu::glfw::CreateSurfaceForWindow(instance, window); InitGraphics(); while (!glfwWindowShouldClose(window)) { glfwPollEvents(); Render(); surface.Present(); instance.ProcessEvents(); } } ``` -------------------------------- ### Chrome Extension Manifest Configuration Source: https://developer.chrome.com/docs/extensions/mv2/getstarted.md.txt Specifies the necessary permissions and configuration for a Chrome extension. This example includes 'activeTab', 'declarativeContent', and 'storage' permissions, essential for tab manipulation and data persistence. It also indicates the manifest version. ```json { "name": "Getting Started Example", "permissions": ["activeTab", "declarativeContent", "storage"], "manifest_version": 2 } ``` -------------------------------- ### Launch Chrome App from Command Line Source: https://developer.chrome.com/docs/apps/first_app.md.txt Provides command-line options for loading, launching, and reloading Chrome Apps. Useful for development and testing purposes. ```bash # Loads and launches an unpacked application from a specified path chrome --load-and-launch-app=/path/to/app/ # Launches an already loaded app using its ID chrome --app-id=ajjhbohkjpincjgiieeomimlgnll ``` -------------------------------- ### chrome.runtime.onStartup.addListener Source: https://developer.chrome.com/docs/extensions/mv2/reference/runtime.md.txt Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started. ```APIDOC ## chrome.runtime.onStartup.addListener ### Description Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started, even if this extension is operating in 'split' incognito mode. ### Method ADDLISTENER ### Endpoint chrome.runtime.onStartup ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript chrome.runtime.onStartup.addListener(callback); ``` ### Response #### Success Response (200) None #### Response Example None ### Callback Parameter - **callback** (function) - Required - The callback function to execute when the event is fired. ``` -------------------------------- ### Start Network Connection using TypeScript Source: https://developer.chrome.com/docs/apps/reference/networking/onc.md.txt Initiates a connection to a specified network using its GUID. This method is designed for starting connections and accepts the network GUID and an optional callback function. Promises are supported in Manifest V3 and later. ```typescript chrome.networking.onc.startConnect( networkGuid: string, callback?: function ): Promise ``` -------------------------------- ### Set Up Your Developer Account Source: https://context7_llms Instructions on how to set up a Chrome Web Store developer account. ```APIDOC ## Set Up Your Developer Account ### Description Step-by-step guide on how to create and set up your developer account for the Chrome Web Store. ### Method GET ### Endpoint /docs/webstore/set-up-account.md.txt ### Parameters None ### Request Example None ### Response #### Success Response (200) - **content** (string) - The text content of the account setup guide. #### Response Example ``` { "content": "How to set up your Chrome Web Store developer account." } ``` ``` -------------------------------- ### Create Language Model Session with Download Progress Source: https://developer.chrome.com/docs/ai/prompt-api.md.txt This code example shows how to create a session with the language model and set up a listener to monitor download progress. This is essential for providing user feedback during the model download process, which can take time. The monitor function receives progress events. ```javascript const session = await LanguageModel.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`); }); }, }); ``` -------------------------------- ### Specify Origin Trial Tokens in Chrome Extension Manifest Source: https://developer.chrome.com/docs/web-platform/origin-trials.md.txt This example shows how to declare origin trial tokens within the manifest.json file of a Chrome extension. This is the method for using trial features in background scripts, popups, sidepanels, or offscreen documents. ```json "trial_tokens": ["AnlT7gRo/750gGKtoI/A3D2rL5yAQA9wISlLqHGE6vJQinPfk0HiIij5LhWs+iuB7mTeotXmEXkvdpOAC1YjAgAAAG97Im9yaWdpbiI6ImNocm9tZS1leHRlbnNpb246Ly9sampoamFha21uY2lib25uanBhb2dsYmhjamVvbGhrayIsImZlYXR1cmUiOiJJQ2Fubm90QmVsaWV2Z ÇünküouW1hzdGVkWW91clRpbWVEZWNvZGluZ1RoaXMiLCJleHBpcnkiO... ``` -------------------------------- ### HTTP Request Headers Example Source: https://developer.chrome.com/docs/privacy-security/user-agent-client-hints.md.txt This snippet demonstrates an initial HTTP request from a browser, including basic User-Agent Client Hints. ```http GET /downloads HTTP/1.1 Host: example.site Sec-CH-UA: "Chromium";v="93", "Google Chrome";v="93", " Not;A Brand";v="99" Sec-CH-UA-Mobile: ?1 Sec-CH-UA-Platform: "Android" ``` -------------------------------- ### Programmatically Enable Origin Trial Feature (JavaScript) Source: https://developer.chrome.com/docs/web-platform/origin-trials.md.txt This example illustrates how to programmatically enable an origin trial feature using JavaScript. The `defaultView.originTrial` API allows dynamic token registration, which is useful for scenarios where meta tags or HTTP headers are not feasible. ```javascript if (document.defaultView.originTrial) { document.defaultView.originTrial.register('TOKEN_GOES_HERE'); } ``` -------------------------------- ### Write Data to GPU Buffer Memory with WebGPU Source: https://developer.chrome.com/docs/capabilities/web-apis/gpu-compute.md.txt This example demonstrates writing four bytes to a GPU buffer. It creates a buffer mapped at creation, retrieves its memory as an ArrayBuffer, and uses a Uint8Array to set the byte values. The buffer must be unmapped for GPU access. Dependencies: WebGPU API, `device.createBuffer`, `GPUBufferUsage.MAP_WRITE`. ```javascript // Get a GPU buffer in a mapped state and an arrayBuffer for writing. const gpuBuffer = device.createBuffer({ mappedAtCreation: true, size: 4, usage: GPUBufferUsage.MAP_WRITE }); const arrayBuffer = gpuBuffer.getMappedRange(); // Write bytes to buffer. new Uint8Array(arrayBuffer).set([0, 1, 2, 3]); gpuBuffer.unmap(); ``` -------------------------------- ### Build Preact TodoMVC Source: https://developer.chrome.com/docs/web-platform/web-bundles.md.txt Builds the Preact TodoMVC application, preparing its resources for bundling into a Web Bundle. This involves cloning the repository, installing dependencies, and running the build script. ```bash git clone https://github.com/developit/preact-todomvc.git cd preact-todomvc npm i npm run build ``` -------------------------------- ### Chrome App Manifest File (manifest.json) Source: https://developer.chrome.com/docs/apps/first_app.md.txt Defines the core information about your Chrome App, including its name, description, version, manifest version, background script, and icons. It tells Chrome how to handle and launch your app. ```json { "name": "Hello World!", "description": "My first Chrome App.", "version": "0.1", "manifest_version": 2, "app": { "background": { "scripts": ["background.js"] } }, "icons": { "16": "calculator-16.png", "128": "calculator-128.png" } } ``` -------------------------------- ### Handle TTS Language Status Request (TypeScript) Source: https://developer.chrome.com/docs/extensions/mv2/reference/ttsEngine.md.txt Listens for requests to get the installation status of a TTS language. This allows clients to check if a specific language is available or being installed. ```typescript chrome.ttsEngine.onLanguageStatusRequest.addListener( callback: (requestor: TtsClient, lang: string) => void ); ``` -------------------------------- ### Get all platform and channel combinations Source: https://developer.chrome.com/docs/web-platform/versionhistory/reference.md.txt Lists all available platform and channel combinations for a given product. ```APIDOC ## GET /{product}/platforms/all/channels ### Description Lists all platform and channel combinations for the given product. ### Method GET ### Endpoint `https://versionhistory.googleapis.com/v1/{product}/platforms/all/channels` ### Parameters #### Path Parameters - **product** (string) - Required - A product identifier (e.g., `chrome`). ### Request Example ```json { "example": "GET /v1/chrome/platforms/all/channels" } ``` ### Response #### Success Response (200) - **channels** (array) - A list of channel objects. - **platform** (string) - The platform identifier. - **channel** (string) - The channel identifier. #### Response Example ```json { "example": "{ \"channels\": [ { \"platform\": \"win64\", \"channel\": \"stable\" } ] }" } ``` ``` -------------------------------- ### Start ChromeDriver Server Source: https://developer.chrome.com/docs/chromedriver/get-started.md.txt This snippet shows how to start the ChromeDriver server from the terminal. It listens on a specified port (defaulting to 9515) and waits for incoming connections from WebDriver clients. Ensure chromedriver is in your system's PATH or specify its location. ```bash ./chromedriver Starting ChromeDriver 76.0.3809.68 (...) on port 9515 ... ``` -------------------------------- ### Configure and Initialize VideoEncoder Source: https://developer.chrome.com/docs/web-platform/best-practices/webcodecs.md.txt Demonstrates the process of initializing and configuring a VideoEncoder. It includes checking codec support using `isConfigSupported` and setting up the `output` and `error` callbacks. ```javascript const init = { output: handleChunk, error: (e) => { console.log(e.message); }, }; const config = { codec: "vp8", width: 640, height: 480, bitrate: 2_000_000, // 2 Mbps framerate: 30, }; const { supported } = await VideoEncoder.isConfigSupported(config); if (supported) { const encoder = new VideoEncoder(init); encoder.configure(config); } else { // Try another config. } ``` -------------------------------- ### getFontList() Source: https://developer.chrome.com/docs/extensions/mv2/reference/fontSettings.md.txt Gets a list of all available fonts installed on the system. ```APIDOC ## GET /fontSettings/getFontList ### Description Gets a list of fonts available on the system. ### Method GET ### Endpoint /fontSettings/getFontList ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **results** (array) - An array of FontName objects, where each object contains the font ID. #### Response Example ```json { "results": [ { "fontId": "Arial" }, { "fontId": "Times New Roman" } ] } ``` ``` -------------------------------- ### Order API Results by Start Time Ascending (API Example) Source: https://developer.chrome.com/docs/web-platform/versionhistory/reference.md.txt This example shows how to explicitly order API results by 'starttime' in ascending order. This ensures that the oldest releases appear first. ```HTTP GET /chrome/platforms/win/channels/stable/versions/all/releases?order_by=starttime%20asc ``` -------------------------------- ### HTTP Final Response Example with Link Headers Source: https://developer.chrome.com/docs/web-platform/early-hints.md.txt This snippet illustrates a typical HTTP 200 OK response following an Early Hints response. It includes the main resource content along with various Link HTTP headers. These headers reiterate preconnect and preload directives, and can also include additional critical resources identified during the generation of the main resource, ensuring comprehensive resource optimization. ```http 200 OK Content-Length: 7531 Content-Type: text/html; charset=UTF-8 Content-encoding: br Link: ; rel=preconnect Link: ; rel=preload; as=style Link: ; rel=preload; as=script Link: ; rel=preload; as=style Example ``` -------------------------------- ### Order API Results by Start Time (API Example) Source: https://developer.chrome.com/docs/web-platform/versionhistory/reference.md.txt This example demonstrates how to order API results by the 'starttime' parameter. The order_by parameter can be specified with 'asc' for ascending or 'desc' for descending order. ```HTTP GET /chrome/platforms/win/channels/stable/versions/all/releases?order_by=starttime ``` -------------------------------- ### PPB_FileIO API Reference Source: https://developer.chrome.com/docs/native-client/migration.md.txt Detailed documentation for each method within the PPB_FileIO API, including its purpose, associated web APIs, and any limitations. ```APIDOC ## PPB_FileIO API Documentation ### Overview The PPB_FileIO API provides functions for interacting with the file system, similar to standard file I/O operations. It maps to various Web APIs and has specific limitations. ### Methods #### Create * **Description**: Creates or opens a file system entry. * **Assumes Threads**: Not specified. * **Emscripten**: FS (partial) * **Web API**: `window.chooseFileSystemEntries()` * **Limitations**: Create and open are used differently, but the pieces are of equal power. #### Open * **Description**: Opens a file system entry for reading and writing. * **Assumes Threads**: Not specified. * **Emscripten**: FS (partial) * **Web API**: `window.chooseFileSystemEntries()` * **Limitations**: None specified. #### Query * **Description**: Retrieves metadata about a file system entry. * **Assumes Threads**: Not specified. * **Emscripten**: FS (partial) * **Web API**: `Blob.size`, `FileSystemHandle.getFile()`, `FileSystemHandle.getDirectory()`, `File.lastModified` * **Limitations**: GAP (partial) - `Blob.type` can also be used to check the MIME type. The file system type, creation time, and last access time cannot be determined with the Native File System API. #### Touch * **Description**: Updates the modification time of a file system entry. * **Assumes Threads**: Not specified. * **Emscripten**: FS (partial) * **Web API**: `FileSystemDirectoryHandle.getFile("name", {create: true})` * **Limitations**: None specified. #### Read * **Description**: Reads data from a file system entry. * **Assumes Threads**: Not specified. * **Emscripten**: FS (partial) * **Web API**: `Blob.slice().arrayBuffer()` * **Limitations**: None specified. #### Write * **Description**: Writes data to a file system entry. * **Assumes Threads**: Not specified. * **Emscripten**: FS (partial) * **Web API**: `FileSystemWriter.write()` * **Limitations**: None specified. #### SetLength * **Description**: Sets the length of a file system entry. * **Assumes Threads**: Not specified. * **Emscripten**: FS (partial) * **Web API**: `FileSystemWriter.truncate()` * **Limitations**: None specified. #### Flush * **Description**: Flushes any buffered data to the file system. * **Assumes Threads**: Not specified. * **Emscripten**: GAP (partial) * **Web API**: GAP (partial) - Files are flushed when `FileSystemWrite.close()` is called. * **Limitations**: This is intended by design because the Native File System API files are exposed to the OS, therefore a Safe Browsing check needs to be performed before data is shown to the OS. #### Close * **Description**: Closes a file system entry and flushes any pending writes. * **Assumes Threads**: Not specified. * **Emscripten**: FS (partial) * **Web API**: `FileSystemWriter.close()` * **Limitations**: Does not cancel pending operations, but flushes any data written so far to disk. #### ReadToArray * **Description**: Reads data from a file system entry into an array buffer. * **Assumes Threads**: Not specified. * **Emscripten**: GAP * **Web API**: `Blob.slice().arrayBuffer()` or `Blob.arrayBuffer()` * **Limitations**: Allows multiple subrange reads in parallel. ``` -------------------------------- ### Manifest JSON for Hello World Extension Source: https://developer.chrome.com/docs/extensions/get-started/tutorial/hello-world.md.txt Defines the core properties of a Chrome extension, including its name, description, version, manifest version, and action details like the popup and icon. ```json { "name": "Hello Extensions", "description": "Base Level Extension", "version": "1.0", "manifest_version": 3, "action": { "default_popup": "hello.html", "default_icon": "hello_extensions.png" } } ``` -------------------------------- ### Get Localized Message with Placeholders - JSON (Example) Source: https://developer.chrome.com/docs/extensions/reference/api/i18n.md.txt An example of a locale message definition in JSON format. This shows how to define a message string with placeholders and their descriptions. ```json "error": { "message": "Error: $details$", "description": "Generic error template. Expects error parameter to be passed in.", "placeholders": { "details": { "content": "$1", "example": "Failed to fetch RSS feed." } } } ``` -------------------------------- ### Configure WebGPU Surface and Graphics Source: https://developer.chrome.com/docs/web-platform/webgpu/build-app.md.txt Sets up the wgpu::Surface and configures it with device capabilities, format, and dimensions. This function is called during the initialization phase of the graphics application. It retrieves surface capabilities and configures the surface for rendering. ```c++ #include ... wgpu::Surface surface; wgpu::TextureFormat format; void ConfigureSurface() { wgpu::SurfaceCapabilities capabilities; surface.GetCapabilities(adapter, &capabilities); format = capabilities.formats[0]; wgpu::SurfaceConfiguration config{.device = device, .format = format, .width = kWidth, .height = kHeight, .presentMode = wgpu::PresentMode::Fifo}; surface.Configure(&config); } void InitGraphics() { ConfigureSurface(); } ``` -------------------------------- ### GET /chrome.management.getAll Source: https://developer.chrome.com/docs/extensions/mv2/reference/management.md.txt Retrieves a comprehensive list of all installed extensions and applications. ```APIDOC ## GET /chrome.management.getAll ### Description Returns a list of information about installed extensions and apps. ### Method GET ### Endpoint chrome.management.getAll ### Parameters #### Path Parameters N/A #### Query Parameters - **callback** (function, optional) - The callback parameter looks like: `(result: ExtensionInfo[]) => void` ### Request Example ```json { "callback": "(result: ExtensionInfo[]) => void" } ``` ### Response #### Success Response (200) - **result** (ExtensionInfo[]) - An array containing information about all installed extensions and apps. #### Response Example ```json [ { "id": "extension_id_1", "name": "Extension One", "type": "extension" }, { "id": "app_id_2", "name": "My App", "type": "packaged_app" } ] ``` ``` -------------------------------- ### Selenium WebDriver Test with ChromeDriver (Python) Source: https://developer.chrome.com/docs/chromedriver/get-started.md.txt A sample Python test using Selenium WebDriver and ChromeDriver to perform a Google search. It shows how to instantiate the Chrome driver, specifying the path to the executable, navigating to a URL, searching, and quitting the driver. If the path is not provided, WebDriver will search the system's PATH. ```Python import time from selenium import webdriver driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path. driver.get('http://www.google.com/') time.sleep(5) # Let the user actually see something! search_box = driver.find_element_by_name('q') search_box.send_keys('ChromeDriver') search_box.submit() time.sleep(5) # Let the user actually see something! driver.quit() ``` -------------------------------- ### Example Update Manifest XML Source: https://developer.chrome.com/docs/apps/autoupdate.md.txt An example of the XML structure for a Chrome extension update manifest. This format is used to inform the Chrome browser about available updates for installed extensions. ```xml ```