0

I am now writing a new tab page replacement for Chrome 33.

While I am using chrome.management.getAll() to get app list, I found a strange thing.

Here is my code:

document.addEventListener('DOMContentLoaded', function () {
...
    chrome.management.getAll(getAllApps);
...});

function getAllApps(data) {
...
    console.log("Installed App Count:" + data.length);
    for (var i = data.length - 1; i >= 0; i--) {
        console.log("Found App: " + data[i].name + " type:" + data[i].type);
        if (data[i].type == 'theme' || 
            data[i].type == 'extension' ) {
            continue;
        };
    ...
    }
}

The output never lists Chrome Store.

But if I use chrome.management.get(), I could get the record of Chrome Store by its id.

Is there anything wrong in my code? Or is the Store is intended to be hidden?

Thank you. It is my first question here, so if there is any inappropriate words in my question, please forgive me.

CSakura
  • 538
  • 1
  • 6
  • 17

2 Answers2

1

The Store app is a component extension. Those extensions are built in to Chrome, not installed. As you can see from the documentation, getAll() returns only the user's installed extensions.

Your best bet is to hardcode the list of extensions that appear in a brand-new profile, which will consist only of component items (unless you're on a machine you don't control). Over time that list will diverge from the canonical list in the source code.

sowbug
  • 4,644
  • 22
  • 29
0

Both chrome.management.get() and chrome.management.getAll() show information about apps/extensions/themes installed on local computer, not information from Chrome Web Store.

Dmitrii Sorin
  • 3,855
  • 4
  • 31
  • 40
  • Dear @Dmitry Sorin , chrome.management.get returns this error: `Uncaught TypeError: Cannot read property 'get' of undefined` – Hosein Aqajani Dec 19 '15 at 11:24
  • @H.Aqjn usually this means that your extension/app doesn;t have this permission. – Dmitrii Sorin Dec 19 '15 at 16:39
  • Dear @Dmitry Sorin my manifest.json had these permissions: "tabs", "http://*/*", "nativeMessaging", "management" . So what is the problem? – Hosein Aqajani Dec 20 '15 at 12:49
  • @H.Aqjn is it extension or an app? If first, please supply a link to the source code. – Dmitrii Sorin Dec 22 '15 at 08:38
  • Dear @Dmitry Sorin , In last of my knowledge it is impossible to use `chrome.management` in content pages, in fact we could only use it in the `background page` , Therefore I have obliged to use message passing technique, please see and up-vote and if you know answer to this: [myQuestion](http://stackoverflow.com/questions/34380953/integrating-single-and-long-lived-messaging) , in this question I have provided two message passing type: 1-single: detecting initial info like add-on installation, 2-long-lived: which provide our task, Thanks in advance – Hosein Aqajani Dec 22 '15 at 10:30