Wednesday, October 12, 2011

Chrome Extensions vs. Apps vs. Themes and what it looks like in your extensions directory

If you look in your chrome extensions directory on disk, things are a little confusing.

  1. There are extensions, which you can see listed at about:extensions.
  2. There are apps, which can be either packaged or hosted and will contain an app launch stanza like this in the manifest.json
       "app": {
          "launch": {
             "web_url": "https://mail.google.com/mail/mu/?mui=ca"
          },
          "urls": [ "https://mail.google.com/mail/mu/" ]
       },
    
    These don't seem to appear anywhere in the UI apart from when you open a new tab (there is no about:apps, see about:about for a full list of what is available).
  3. Themes, which are packaged in a similar way, but don't contain javascript or HTML. The manifest.json will have entries like this:
       "theme": {
          "colors": {
             "bookmark_text": [ 105, 96, 87 ],
             "frame": [ 92, 82, 73 ],
             "ntp_background": [ 235, 234, 211 ],
             "ntp_link": [ 105, 96, 87 ],
             "ntp_section": [ 158, 163, 139, 1 ],
             "ntp_section_link": [ 105, 96, 87 ],
             "ntp_section_text": [ 105, 96, 87 ],
             "ntp_text": [ 105, 96, 87 ],
             "tab_background_text": [ 255, 255, 255 ],
             "tab_text": [ 255, 255, 255 ],
             "toolbar": [ 158, 163, 139 ]
          },
    
Also, just figuring out the name of extensions can be confusing. In the manifest.json you will often see:
"name": "__MSG_some_name__",
Which means you need to go look in the relevant locale file like _locales/en/messages.json to find the actual name, it will look like this (note MSG and underscores stripped):
{
   "some_name": {
      "message": "My Rad Extension"
   }
}
The exception is if it is a theme, the messages.json file will look like:
{"themeName": {"message": "Earthy", "description": "theme name"}}
Except it also has a UTF-8 Byte Order Mark prepended to the start of the file, which is the three bytes 'ef bb bf'. If you're trying to parse it with an external JSON parser, those bytes might cause it to fail.

No comments: