how to take screenshot when using chrome.app.window.create

I’ve created a chrome extension and opening a new window in background.js using:

chrome.app.window.create

I would like to take a screenshot of the screen, but from what I’ve read I need to use:

chrome.tabs.captureVisibleTab

but chrome.tabs is undefined

I have permissions:

"tabs",
"activeTab"

How do I take a screenshot?

How to access the cache folder on ChromeOS App used by Service Workers

I am creating a kiosk app for the ChromeOS platform.
This kiosk app has a offline functionality using Service Workers.

We are downloading all the necessary files when the page first loads and if the device goes offline the files that are saved in the cache folder are accessed and there is no interruption on the site. And when the device goes online it pushes all the collected data to the server.

We have build a similar app on Windows using Chromium and we were able to set the location of the cache folder and therefore could access the data to perform other tasks like zipping up the cache folder to make it portable.

On my Chromebook, we created a prototype application and the service workers work as expected (because it is Chrome) – when the device goes offline the files from the cache folder are accessed. But the issue is that I can not see or know how to access the cache folder.

Is there a way to set the location where there cache folder will save the files for my ChromeOS app?

How to get network mac addresses on chrome os

I have built a chrome os extension to be used on a ChromeBox and I’d like to retrieve the network mac addresses.

The following API’s aren’t available during development and I’m not able to debug the outputs during production.

So I’m wondering if someone can supply the output structure of the following API’s?

I want to use:

chrome.networkingPrivate.getNetworks
chrome.networkingPrivate.getProperties

Chrome OS Notification Shelf Icon

How can I create a shelf icon for Chrome OS notifications? Using web notifications would be preferred, but using extension notifications is also acceptable.

Update: It seems that appIconMaskUrl of extension notifications adds an icon to the shelf, but the icon is an all white square.

This image demonstrates the desired behavior.

enter image description here

How to manipulate the autoplay policy in a Google Chrome kiosk app

As of version 66 of Google Chrome onwards it will no longer automatically start playback of audio and video files when the playback volume is not muted.

This change was made to prevent autoplay on add-videos and other annoying web page elements. However, this has negative consequences for a number of perfectly valid applications of the autoplay feature, for instance in signage applications.

The new default behaviour of not auto playing a video with sound can be overridden at the startup of the Google Chrome browser with the command line options

--autoplay-policy=no-user-gesture-required

or

--no-user-gesture-required

The new default autoplay behaviour is also present in the Chrome browser on ChromeOS (currently in the beta channel). For Kiosk-apps running on ChromeOS there are no command line options, only configuration using the Manifest.json file.

Currently there is no option in the documentation of the Manifest.json format that allows changing the autoplay policy.

Is there a non documented way or a way outside the Manifest.json to change the new Chrome default autoplay policy in Kiosk apps?

Chrome OS key remapping

So I know that you can remap the keys in Chrome OS through custom extensions, But I am not sure how to.

Could I get some examples of remapping the numpad or a template that I only need to fill in the desired key for?

Chrome package app access to media files

I have google chrome package app.

I need to read locally saved photo and video and give them up to the HTML page.

How can I do this?

I try:

chrome.mediaGalleries.getMediaFileSystems(
  {interactive: 'no'},
  function(mediaFileSystems){
    mediaFileSystems.forEach(
      function(item, indx, arr){
        var mData = chrome.mediaGalleries.getMediaFileSystemMetadata(item);
        console.log(mData);
      });
  });

But console remains empty.

chrome.mediaGalleries / cannot read property ‘getMediaFileSystem’

I have some problem with chrome app:

I need to get a local img, but chrome.mediaGalleries.getMediaFileSystem does not work.

But its already added to permission : “fileSystem”:[“read”,”allAutoDetected”]

Where can be a problem?

get chrome app console logs in chrome os debug log

I’ve got a chrome app with several isolated layers (webviews, iframes), all those layers are logging some debugging stuff to console with console.log().

I managed to get all console logs inside a chrome debug log when launching chrome on mac os with --enable-logging --v=1 flags.

The problem is I can’t get all the console.logs when running the app in chrome os. For chrome os debugging I wrote the following into /etc/chrome_dev.conf file:

CHROME_LOG_FILE=/tmp/chrome_debug.log
--enable-logging --v=1

So I expect pretty much the same logs as I get when running chrome app on mac os, but I do not see any console.logs in /tmp/chrome_debug.log.

Would appreciate any advice how to get my app console.logs in chrome debug log on chrome os

How to shutdown or log off a user from a chromebook using Javascript APIs in a chrome extension

I’m making a chrome extension that handles logging off and shutting the chromebook down. I looked on https://developer.chrome.com/apps/api_index for a way to be able to restart the chromebook, but I didn’t find anything.

Right now, this only has to work on Chrome OS.